-->
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.  [ 3 posts ] 
Author Message
 Post subject: @ManyToOne mappedBy not defined in javax.persistence
PostPosted: Thu Jan 12, 2006 6:04 am 
Newbie

Joined: Thu Jan 12, 2006 5:57 am
Posts: 2
The @ManyTOne (javax.persistence.ManyToOne) annotation that comes with ejb3-persistence.jar does not contain a declaration for mappedBy attribute.

Using: Hibernate Annotations 3.1beta7 and Entity Manager 3.1beta5

Where do I get a correct Version? Can I safely use other ejb3 Jars (where to find)?

Thanks,
Frank


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 2:14 pm 
Beginner
Beginner

Joined: Thu Mar 18, 2004 8:11 am
Posts: 38
Location: Italy
Well, probably I'm wrong, but no mappedBy attribute is provisioned for @ManyToOne in the ejb3 spec.

The mappedBy attribute is available with the @ManyToOne's counterpart: @OneToMany.

You probably want to specify the mapped column in the class by an @JoinColumn(name = "asdads").

_________________
Giampaolo Tomassoni
Italy


Top
 Profile  
 
 Post subject: @ManyToOne and mappedBy
PostPosted: Thu Jan 12, 2006 3:47 pm 
Newbie

Joined: Thu Jan 12, 2006 5:57 am
Posts: 2
Yes, after browsing the EJB3 Spec I did not find it. I was a bit mislead by the example in Hibernate Annotations reference (Chapter 2.2.5.3.3. Many-to-many) where:

@Entity
public class Employee implements Serializable {
@ManyToMany(
cascade={CascadeType.CREATE, CascadeType.MERGE},
mappedBy="employees"
targetEntity=Employer.class
)
public Collection getEmployers() {
return employers;
}
}

was published as bidirectional ManyToMany.


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