We were having the same problem.  We are using the 4.2.0 release, which 
includes Hibernate 3.2.1-GA.  We started looking at some of the unit tests for 
hibernate annotations and found that something has changed between 3.2.1 and 
3.3 releases.  Looking at the org.hibernate.test.annotations.onotoone package, 
there are two classes, Party and PartyAffiliate.

The datamodel for this is such that Party has a unique partyId column, and 
PartyAffiliate uses the partyId for its PK as well, creating a 
PrimaryKeyJoinColumn reference.

In 3.2.1:
Party.java

  | @Entity
  | public class Party {
  |     @Id
  |     String partyId;
  | 
  |     @OneToOne(mappedBy = "party")
  |     PartyAffiliate partyAffiliate;
  | }
  | 
PartyAffliate.java

  | @Entity
  | public class PartyAffiliate {
  |     @Id
  |     String partyId;
  | 
  |     @OneToOne
  |     @PrimaryKeyJoinColumn
  |     Party party;
  | 
  |     String affiliateName;
  | }
  | 

However, in 3.3, we have:
Party.java
@Entity
  | public class Party {
  |     @Id
  |     String partyId;
  | 
  |     @OneToOne
  |     @PrimaryKeyJoinColumn
  |     PartyAffiliate partyAffiliate;
  | }
  | 
PartyAfiliate.java
@Entity
  | public class PartyAffiliate {
  |     @Id
  |     String partyId;
  | 
  |     @OneToOne(mappedBy="partyAffiliate")
  |     Party party;
  | 
  |     String affiliateName;
  | }
  | 


As you can see, the roles have changed.  My question is, which is really right 
according to the spec?


We have a book here that implements their examples the way 3.2.1 did.
We have also used IntelliJ-IDEA to auto-gen the entity beans from the model, 
and it did so the way 3.2.1 did.
Jboss 4.2.0 contains hibernate annoations 3.2.1-ga, but it fails when running 
in the style of 3.2.1.  If we flip like the 3.3 example does, it works


Either way we have it working, but, based on the fact that both a book and a 
third party have implemented it the way that the 3.2.1 examples have it, it 
seems that there might be a but in hibernate related to this.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064572#4064572

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4064572
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to