Can anybody help me?
This is really a question for the Hibernate forum!
I'm sorry Leo but I can't agree to you. My problem is happening in a extension of EntityQuery becouse of it's limitations, or mine. :-)
In one case the query will just list (and if need filter) the content of a table, in other case, the same extension of EntityQuery will need a query where will exists joins.
The question is: can I change the EJBQL and RESTRICTIONS dynamically?
If yes, what is the elegant way to do this?
Rogério De Pieri
The nice thing of Seam and JPA is that Seam intercepts the query string and looks for EL and replaces it on the fly. so basically YES you can change it dynamically. My personal preference to do this kind of things OUTSIDE the bean-code because you're mixing things which makes it difficult to maintain.
Whenevr I need a dynamic query I use the possibilities of components.xml to define it.
I've solved my problem overriding the method getEJBQL and it seems the solution is ok. I change the return no method according the user roles.
Thanks for your help