impetus-opensource/Kundera — Issue #30:  {kundera-discuss} Bidirectional Association OneToMany Relationship : Not working
Author: mevivs
Created: 2012-01-30 07:06:21+00:00
State: open

I am trying to create bidirectional one to many relations ship. Where
i have a person entity and that person can be an employee or a
manager. If Manager then the entity would have relation ship of
oneTomany employees and if employee then manyToOne with the Manager.
but i get this exception.

Is it possible to do this? I can get this to work when the entity's
are different eg Person Address.

Any help appreciated.

java.lang.NullPointerException
at
com.impetus.client.cassandra.pelops.PelopsClient.populateFkey(PelopsClient.java:
448)
at
com.impetus.client.cassandra.pelops.PelopsClient.addRelation(PelopsClient.java:
421)
at
com.impetus.client.cassandra.pelops.PelopsClient.persist(PelopsClient.java:
374)
at
com.impetus.kundera.persistence.PersistenceDelegator.onClientPersist(PersistenceDelegator.java:
925)
at
com.impetus.kundera.persistence.PersistenceDelegator.onClient(PersistenceDelegator.java:
905)
at
com.impetus.kundera.persistence.PersistenceDelegator.saveGraph(PersistenceDelegator.java:
880)
at
com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:
470)
at
com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:
144)
at Test.main(Test.java:46)

Entity Code below

//Imports here
@Entity
@Table(name = "PERSON", schema = "cassandra_pu")
public class Person {
@Id
@Column(name = "PERSON_ID")
private String personId;

@Column(name = "PERSON_NAME")
private String personName;

@Embedded
private PersonalData personalData;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,
mappedBy="person")
private Set Employees;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PERSON_ID")
private Person manager;

//Constructors, Getters, setters here
}