Hello Hibernate users.
I need to do a search across several tables, lets call them A, B and C.
heres a pseudo database structure:
Code:
Table A:
ID1,
ATTRIBUTE1
Table B:
ID1,
ID2,
ATTRIBUTE2,
ATTRIBUTE3
Table C:
ID3,
ATTRIBUTE4 (=ID1),
ATTRIBUTE5
in jdbc sql I might write something like
Code:
select distinct A.ID1, A.ATTRIBUTE1 from A, B, C
where A.ID1 = B.ID1
AND A.ID1 = C.ATTRIBUTE4
AND B.ATTIBUTE2 = 'some value'
AND C.ATTRIBUTE5 = 'some other value'
AND A.ATTIBUTE1 = 'something interesting'
Obviously I'd parse my result set and create my objects for A.
Now I'd like to do the same thing in Hibernate, but I don't know where to start.
If necessary I can create some tables, hbm.xml files, etc - but at this stage it would just complicate this post.
I'm sure this must be possible, I really just need a pointer or two.
Thanks
Martin