I have two entities working in Mater Detail pattern like i describe in:
Stackoverflow Post: jpa-eclipselink-onetomany-derived-ids-fail
The pattern works as expected with LOCAL RESOURCE, but when i try to move the example to a web environment GlassFish4.1 (JSF) with JTA, i get the following error:
Advertencia: DTX5014: Caught exception in beforeCompletion() callback: java.lang.NullPointerException at entidades.OrderItemPK._persistence_set(OrderItemPK.java)
The source code for persistence class:
import java.util.List;
import javax.persistence.Query;
import javax.persistence.EntityManager;
import java.util.List;
import javax.persistence.Query;
import javax.persistence.EntityManager;
public abstract class AbstractFacade<T> {
private Class<T> entityClass;
protected abstract EntityManager getEntityManager();
public AbstractFacade(Class<T> entityClass) {
this.entityClass = entityClass;
}
public void create(T entity) {
getEntityManager().persist(entity);
}
public T edit(T entity) {
return getEntityManager().merge(entity);
}
public void remove(T entity) {
getEntityManager().remove(getEntityManager().merge(entity));
}
I tried with both methods create and edit. Any idea what I'm doing wrong, suggestions are welcome.