-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Join two tables with 2 keys
PostPosted: Thu Oct 06, 2011 8:14 am 
Newbie

Joined: Mon Jul 04, 2011 7:57 am
Posts: 2
Hi all,


I'm facing following problem: There is table A with two fields (not primary composite) and the same structure in table B - two non primary fields.

Is it possible to join these tables some how with annotation.

By using something like following
Code:
    @JoinColumns({
            @JoinColumn(name = "PRP_PERSON_CODE", referencedColumnName = "USR_PERSON_CODE"),
            @JoinColumn(name = "PRP_PERSON_SSN", referencedColumnName = "USR_PERSON_SSN")
    })


because generated SQL code is looks like following:

Code:
inner join ED_PERSON_PRIVILEGES privileges2_
    on user1_.USR_PERSON_CODE = privileges2_.PRP_PERSON_CODE
   AND user1_.USR_PERSON_SSN = privileges2_.PRP_PERSON_SSN


For me must be
Code:
inner join ED_PERSON_PRIVILEGES privileges2_
    on user1_.USR_PERSON_CODE = privileges2_.PRP_PERSON_CODE
   OR user1_.USR_PERSON_SSN = privileges2_.PRP_PERSON_SSN


OR between join fields not AND.


Is it possible with hibernate and annotation?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.