-->
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: Error mappedBy reference an unknown target entity
PostPosted: Tue Jan 19, 2010 1:29 pm 
Newbie

Joined: Mon Jan 11, 2010 11:05 am
Posts: 8
Hi,

i have 2 class (one To Many):

Classe Vehicules
Quote:

...
private Person person;
...
private Set<Vehicules> vehicules = new HashSet<Vehicules>(0);
...

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PERS_ID", nullable = false)
public Person getPerson() {
return this.Person;
}

public void setPerson(Person person) {
this.person = person;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "Vehicules")
public Set<Vehicules> getVehicules() {
return this.Vehicules;
}

public void setVehicules(Set<Vehicules> vehicules) {
this.vehicules = vehicules;
}


and class Person

Quote:

...
private Set<Vehicules> vehicules = new HashSet<Vehicules>(0);

@OneToMany(fetch = FetchType.LAZY, mappedBy = "Person")
public Set<Vehicules> getVehicules() {
return this.vehicules;
}

public void setVehicules(Set<Vehicules> vehicules) {
this.vehicules = vehicules;
}

and with a junit test case (with getPerson for example), i always have this error :

nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target
entity property: package.domain.Vehicules.Person in package.domain.Person.Vehicules

for me, all is mapped correctly, if you have any idea...

Thanks


Top
 Profile  
 
 Post subject: Re: Error mappedBy reference an unknown target entity
PostPosted: Wed Jan 20, 2010 8:51 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
It should probably be
Code:
mappedBy = "person"
. A method name of getPerson() translates to a property name of "person".


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.