in my application i have a query that ultimately returns a count(eg: select count(*) from TABLE_NAME ....). Executing this as a native query with ejb3's entity manager, I got a BigInteger as the return type. But another query executed the same way on another table returned me Long instead of BinInteger. Why is this so.. i mean why are the data types changing for the count operation returns? Is there any dependency that the can change the return type of the COUNT operation?