-->
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.  [ 7 posts ] 
Author Message
 Post subject: Association table on single ended association - supported ?
PostPosted: Mon Jan 09, 2006 3:09 pm 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Using JSR-220 annotations (3.1B7) and hibernate (3.1), is it possible to map a bidirectional many-to-one association with a Join table?

I've gotten this to work with traditional hibernate and I've got a bidirectional many-to-many association working with annotations, both using a join table. But when I try a bidirectional many-to-one association with a join table using annotations, during deployment I get
NotYetImplementedException: association table on a single ended association is not yet supported

I know it is strange to employ a join table when doing a many-to-one association, but I'm trying to map onto a legacy database.

Is this simply a limitation of the current implementation or am I doing something wrong?
--keenan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 2:56 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This is a limitation

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 10:34 am 
Newbie

Joined: Thu May 18, 2006 9:47 am
Posts: 4
Is there currently any way to use annotations to map map a bidirectional many-to-one association with a Join table?

I have not even been able to get the @ManyToOne with @JoinTable to work following the Hibernate 3.2.0CR1 Documentation without throwing:

org.hibernate.cfg.NotYetImplementedException: association table on a single ended association is not yet supported.

Should this be working now?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 6:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I do have a junit test case for that, what is your failing mapping. Be sure to use 3.2.0.CR1

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 2:09 pm 
Newbie

Joined: Thu May 18, 2006 9:47 am
Posts: 4
I am not sure what I am doing wrong, when I attempt to use either @OneToOne or @ManyToOne with @Jointable as shown in the Hibernate 3.2.0 CR1 documentation I recieve the same error:

Code:
org.hibernate.cfg.NotYetImplementedException: association table on a single ended association is not yet supported


Here is the code for my OneToOne:
Code:
@Entity
@Table(name = "certcandidate")
public class Certcandidate implements java.io.Serializable {

   private String internalid;
   private String status;
   private String lastchangeuserid;
   private Date lastchangetimestamp;
   
   private Person person;
   ...
   @OneToOne(cascade=CascadeType.ALL)
   @JoinTable(name="certcanper",
       joinColumns={@JoinColumn(name="certificationcandidateid")},
         inverseJoinColumns={@JoinColumn(name="personid")})
   public Person getPerson() {
      return person;
   }
   ...
}

@Entity
@Table(name = "person")
public class Person implements java.io.Serializable {

   private String internalid;
   private String status;
   private String prefix;
   private String firstname;
   private String middlename;
   private String lastname;
   private String suffix;
   private String typeinternalid;
   private String lastchangeuserid;
   private Date lastchangetimestamp;

   private Certcandidate certcandidate;

   @OneToOne(mappedBy="person")
   public Certcandidate getCertcandidate() {
      return certcandidate;
   }
   ...
}


And the association table "certcanper" contains the stated fks.

I believe I am using 3.2.0.CR1, my application is running using JBossSeam in JBossAS 4.0.4CR2 and during start-up the following is displayed:

Code:
13:31:41,208 INFO  [Environment] Hibernate 3.2 cr1


Thank you very much for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 4:18 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No you're not using Hibernate Annotation 3.2.0.CR1.
You'll have to use JBoss SEAM CVS HEAD to make it so

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Thank you
PostPosted: Fri May 19, 2006 6:20 pm 
Newbie

Joined: Thu May 18, 2006 9:47 am
Posts: 4
Thank you. The @OneToOne is working fine, and I am no longer getting the association error.

I am still having trouble with the @ManyToOne and @JoinTable. Just to make sure, is bi-directional @ManyToOne supported using an association table? This is not documented so I just want to check before moving foward, if it does work where can I find your test cases to use as an example?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.