Multiple Join Conditions in Hibernate
I'm trying to do this:
select * from A, B where A.id1=B.id1 and A.id2=B.id2
Assu开发者_开发百科me relationship between A and B is 1-to-many
.
I'm using Hibernate mapping XML:
<set name="mapAnalysisResults" table="ANALYSIS_RESULTS" inverse="true" cascade="all">
<key column="MAP_ID"/>
<key column="ANALYSIS_OPER"/>
<one-to-many class="com.st.wma.datalayer.hibernate.model.AnalysisResults"/>
</set>
Having multiple <key>
tags inside <set>
generates runtime error.
Is it possible to have multiple join conditions in Hibernate?
Yes, it is possible to have multiple join conditions. I suggest replacing the comma in between A nad B with 'join':
...from A a join a.B b on ...
If this doesn't work please send the error that you are getting.
精彩评论