Foros de discusión

Using dynamic query Fetch from two entities

sangeeth k, modificado hace 11 años.

Using dynamic query Fetch from two entities

Regular Member Mensajes: 114 Fecha de incorporación: 22/04/12 Mensajes recientes
Hi team,

In dynamic query,

Can we use the dynamic query for 2 different entities for example

i have to fetch firstname and last name from user_ table and some other details from my custom table

at the same time.

Is that possible and valid question?


thanks

thumbnail
Prakash Khanchandani, modificado hace 11 años.

RE: Using dynamic query Fetch from two entities

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
I don't think so that is possible.

The reason I say this is because of the methods DynamicQueryFactoryUtil.forClass which returns the DynamicQuery object to create restrictions and projections. This method requires an Entity class like User, Organization, Group etc

So I guess you need to use Custom-sql to solve your problem.
thumbnail
Prabhakar Singh, modificado hace 9 años.

RE: Using dynamic query Fetch from two entities

New Member Mensajes: 8 Fecha de incorporación: 2/08/12 Mensajes recientes
Hey sangeeth k ,
i know its too late too reply and you might have already came over this challenge , but thought it still worth replying atleast for those who might land here to seek some help in future. [just like i did recently ;-) ]

i too came across a similar requirement in one of my recent projects and i was able to successfully achieve this ..
Plz check it out here . Maybe this cud be of some help.

Thanks,
Prabhakar Singh