Wednesday 15 April 2015

java - Hibernate mapping Object for Inner join query -



java - Hibernate mapping Object for Inner join query -

i'm trying execute query has multiple inner joins , different columns these tables.

for ex:

table-1 col1, col2........col10 table-2 col1....col5 table-3 col1...............col20

inner join

select tb1.col1, tb1.col2, tb1.col3, tb2.col1, tb3.col1, tb.col2 inner bring together tb1 inner bring together tb2 inner bring together tb3 cond1 &cond2

the query executes fine using hibernate want resultset mapped java pojo object..how can build mapping object, there tool can utilize generate mapping object query...

i can manually there 40 columns in output...

suppose 3 tables correspond 3 objects in model. can think of way these 3 objects associated each other , 1 of these objects natural owner of relationships. if think of object having collection of object b has collection of object c can object owns relationship.

then want query homecoming list of object a.

so can write:

"select a bring together a.bs b bring together b.cs c a.attr = val , b.attr2 = val2"

since collection of have access b , c should satisfy need.

java mysql hibernate join

No comments:

Post a Comment