-
1. Re: EntityQuery and Query parameters
nickarls Mar 3, 2008 8:51 PM (in response to eroussel)Haven't used them myself but isn't there a
restrictions
concept with entityqueries? -
2. Re: EntityQuery and Query parameters
eroussel Mar 3, 2008 9:13 PM (in response to eroussel)Yes, but it turns out that I don't want to use parameters in a WHERE clause but with a select that does dynamic instantiation.
In that case I cannot use restrictions unfortunately.
-
3. Re: EntityQuery and Query parameters
kariem Mar 4, 2008 3:02 AM (in response to eroussel)Last time I was looking, I could not find any drop-in solution, but you can subclass EntityQuery and override the required methods. It's designed for extension.
I did something similar with HibernateEntityQuery (using a hibernate session), where I had to override createQuery() to create a org.hibernate.SQLQuery and do some pre-processing (before parseEjbql()).
In this method you can set the required parameters right after the query is created. This query is a familiar JPA javax.persistence.Query and actually where dynamic context parameters are set.
Don't forget to adapt createCountQuery() appropriately.
-
4. Re: EntityQuery and Query parameters
eroussel Mar 4, 2008 7:52 PM (in response to eroussel)Thanks for the tip Kariem!
-
5. Re: EntityQuery and Query parameters
andor.andor.nemeth.gmail.com Dec 10, 2008 11:58 AM (in response to eroussel)Kariem,
could you please post a code example?
Thanks in advance!