-->
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.  [ 2 posts ] 
Author Message
 Post subject: JOIN TABLE usage scenarios (one is failing... bug?)
PostPosted: Sat Apr 12, 2008 7:05 am 
Newbie

Joined: Wed May 09, 2007 2:25 pm
Posts: 7
Folks,

I am using the following hibernate release(s)

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.0.0.ga</version>
</dependency>

Now ths bidirectional mapping usage of annotations worked in 3.2.5

Facility.JAVA
@OneToOne(cascade = CascadeType.REFRESH)
@HardOneToOne(identity = Identity.OWNER)
@JoinTable(name = "join_table_Facility_Mgr", joinColumns = @JoinColumn(name = "manager_fk", insertable = true, updatable = true, nullable = true), inverseJoinColumns =
{ @JoinColumn(name = "facility_fk", insertable = true, updatable = true, nullable = true) })
public Mgr getMgr()
{
return mgr;
}

Mgr.JAVA
@OneToOne(mappedBy = "mgr")
@HardOneToOne(identity = Identity.ASSOCIATION)
@JoinTable(name = "join_table_Facility_Mgr", joinColumns = @JoinColumn(name = "facility_fk", insertable = true, updatable = true, nullable = true), inverseJoinColumns =
{ @JoinColumn(name = "mgr_fk", insertable = true, updatable = true, nullable = true) })
public Facility getFacility()
{
return facility;
}

But in 3.2.6, it fails and the join table never gets populated properly.

The workaround might be to release the owning class from using a join table. And just populate the join table with the association side foreign key.

Anyone have any ideas why this is failing now on 3.2.6 ?

Thanks in advance

_________________
best regards
Ken


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 12, 2008 7:07 am 
Newbie

Joined: Wed May 09, 2007 2:25 pm
Posts: 7
BTW: The @HardOneToOne custom-annotation is merely for identification purposes and deals with meta data under the hood... for identification... since hibernate has no such identification attributes in it's annotations.

_________________
best regards
Ken


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

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.