1

I'm trying to do this:

select * from A, B where A.id1=B.id1 and A.id2=B.id2

Assume 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?

Will Sumekar
  • 1,249
  • 5
  • 16
  • 25
  • You mean a composite key? http://stackoverflow.com/questions/2301259/hibernate-composite-key – Ziul May 07 '13 at 16:29

1 Answers1

0

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.

Dave
  • 321
  • 5
  • 7