Re: Hibernate basic question



.... like this?

session.createQuery("select new your.package.YourAppClass(a.x, b.x, b.y) from AEntity a, BEntity b where a.id = b.id and b.x in ( select x
from c ) ....");

where YourAppClass is like

class YourAppClass {
private String _ax;
private String _bx;
private String _by;

public YourAppClass (String ax, String bx, String by) {
_ax = ax;
_bx = bx;
_by = by
}

// getters and setters
...
}

hope this helps,

Markus


vk02720 schrieb:
Hi,

Using Hibernate, I want to get the output of a complex query and map
the resulting columns my application class. How can I do that ?

For example
select a.x, b.x, b.y from a, b where a.id = b.id and b.x in ( select x
from c ) ....

I just need to map the three elements from the query result to my app
class.

Appreciate any help.

TIA

.