Reputation: 686
I want to perform a criteria count query on my supertype Class which has its own HBM and not count the subclasses.
The query would then be a "non-polymorphic" query.
I tried by adding polymorphism="explicit" to my hbm and it works, but i'd like to do it only on one query and not on every queries.
Upvotes: 4
Views: 863
Reputation: 373
I am not 100% what you are after, but you can specify the class type in a query like this:
select user from User as user where user.class=MyUserClass;
So in Hibernate, you can refer to "class" attribute to filter out results based on what class type the object has.
Upvotes: 1