I have the below code in my Dao:
String query = SELECT COUNT(*) FROM CustomerData ;
Query query = session.createQuery(query);
List test = query.list();
it returns a list with a size of 2. It contains the following value [1,0]
How come it's returning 2 rows when it's not possible, as I have used COUNT(*) in the select clause, which will always return a single value?
Is Hibernate doing something here?
This issue may be caused by entity inheritance. Most likely that the CustomerData
is the base class of other subclasses.
So, you should select from the actual subclass.