-
1. Re: EntityQuery needs to find implementors of a specific interface
njrich28 Sep 6, 2010 10:53 AM (in response to andyxr)In what way does Seam complain?
-
2. Re: EntityQuery needs to find implementors of a specific interface
andyxr Sep 6, 2010 10:59 AM (in response to andyxr)Good question!
Well... it complains that the interface it's trying to retrieve isn't mapped:java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Bankable is not mapped [SELECT b FROM Bankable b where client.id = :el1]
Now I'm assuming this is the case because my interface (Bankable) has no JPA/Hibernate annotation. And that's kinda the second issue; how to annotate an interface. So far, it seems it's not really supported.
Confused? :-)
-
3. Re: EntityQuery needs to find implementors of a specific interface
njrich28 Sep 6, 2010 11:16 AM (in response to andyxr)This should definately work - Hibernate supports 'implicit polymorphism' in its queries. i.e. you should be able to create a query like 'select o from Object o' and it'll pull everything out of the database.
Try using the fully qualified name for your interface in your query e.g.
SELECT b FROM com.myorg.model.Bankable b where client.id = :el1
-
4. Re: EntityQuery needs to find implementors of a specific interface
andyxr Sep 6, 2010 11:33 AM (in response to andyxr)I'll certainly try that. Thanks. I've just tried the SELECT o FROM Object o, but it barfs on the FROM clause.
-
5. Re: EntityQuery needs to find implementors of a specific interface
andyxr Sep 6, 2010 11:40 AM (in response to andyxr)Neil,
I fully qualified the interface name in my ejbql and it's working!
Thanks for the top tip!
Andy