0

I'm writing code that looks like Google Latitude (locate a user). I'm under tomcat 6.0.33, using jpa/hibernate, and easybeans 1.1

They work independently, but when I try to link them it fails:

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: entity] Unable to build EntityManagerFactory
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

Here is the code:

public class Personne{
 @ManyToOne(fetch=FetchType.EAGER, cascade={ CascadeType.PERSIST,CascadeType.MERGE })
 public Personne getOwner() {
   return owner;
  }
}

public class MaPosition{
 @OneToMany
 public List<Personne> getFriends() {
   return friends;
  }
}

Thanks for your help ;)

mercator
  • 28,290
  • 8
  • 63
  • 72

2 Answers2

0

JPA/Hibernate OneToMany & ManyToOne annotations for class person and person address. So one person can have many addresses..... and I used this It worked...

One to many....

public class Person{
@OneToMany(mappedBy="person", targetEntity=Address.class, cascade=CascadeType.MERGE)
private Set<Address> addressList = HashSet<Address>();
//Getters and Setters.....
}

Many to one....

public class Address{
@ManyToOne
@JoinColumn(name="PERSON_ID")
private Person person;
//Getters and Setters.....
}
Ujwal Daware
  • 373
  • 5
  • 18
0

does it work if you add a mappedBy to your OneToMany?

public class MaPosition{
    @OneToMany(mappedBy="owner")
    public List<Personne> getFriends() {
        return friends;
    }
}
digitaljoel
  • 26,265
  • 15
  • 89
  • 115
  • Thanks for your answer. No it doesn't work. The same error again :( – isildur37 Oct 06 '11 at 17:01
  • alright, then based on the error message, what about this answer? http://stackoverflow.com/questions/2669724/hibernate-unable-to-instantiate-default-tuplizer-cannot-find-getter – digitaljoel Oct 06 '11 at 17:09
  • I'm tired... This methods aren't in relation each other... I go sleeping, maybe i'll find the answer tomorrow... – isildur37 Oct 06 '11 at 20:49