Friday, May 6, 2011

hibernate annotations, hql query by interfaces?

The hibernate (I'm using version 3.4) documentation for hql says that it supports interfaces, and I'm having trouble getting it to work. I have some persistent classes (not inherited from eachother, but sharing many functions) that all share an interfaces (CategorizableEntity). I can use it with instanceof in my java code, but I cannot query for it ("from CategorizableEntity").

I have it annotated with @Entity, but hibernate will not let me map it like the others. Is this possible? Is there a special way to map it that I can't find?

Thank you! Joshua

From stackoverflow
  • try to use the full name of your interface (eg: java.util.Set instead of Set)

0 comments:

Post a Comment