-->
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: Mixed Column in a @OneToOne Reference
PostPosted: Mon Oct 06, 2008 4:49 am 
Newbie

Joined: Mon Oct 06, 2008 4:30 am
Posts: 4
Hi.
We are experiencing a strange behavior.


In my entity I have an embedded ID:
Code:
@EmbeddedId
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "APP_ID", nullable = false))})
private Key key;


As you can see I am using @AttributeOverride since the Key is being used by other entities as well.

In my class I also have a reference to another entity:
Code:
@OneToOne(targetEntity = Association.class)
    @JoinColumns
            ({
            @JoinColumn(name = "APP_ID", referencedColumnName = "ADMIN_ID", insertable = false, updatable = false),
            @JoinColumn(name = "CUSTOMER_ID", referencedColumnName = "CUSTOMER_ID", insertable = false, updatable = false)})
    @AccessType(value = "property")
   


(there is no reference from the 'Association' class back)

When we try to retrieve the entity from the database (using Criteria), the left outer join being generated in order to fetch the 'Association' entity is wrong and mixed, the APP_ID is being compared to the CUSTOMER_ID and the CUSTOMER_ID to the ADMIN_ID:

Code:
on this_.CUSTOMER_ID=association2_.ADMIN_ID and this_.APP_ID=association2_.CUSTOMER_ID


should have been:
Code:
on this_.CUSTOMER_ID=association2_.CUSTOMER_ID and this_.APP_ID=association2_.ADMIN_ID



Does someone experience something similar? Is it because Hibernate does not support the mix of @AttributeOverride with @JoinColumn?

Thanks in advance,
Alon.


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.