« Return to Thread: Object: null is not a known entity type

Object: null is not a known entity type

by Richard Sherman :: Rate this Message:

Reply to Author | View in Thread

When trying to do a remove of an entity (Product detailed below) and its children I am getting the error.


java.lang.IllegalArgumentException: Object: null is not a known entity type.
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.remove(EntityManagerImpl.java:263)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:194)
    at $Proxy31.remove(Unknown Source)
    at uk.co.blueskyts.bizservices.product.product.ProductServiceBSImpl.deleteProduct(ProductServiceBSImpl.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy32.deleteProduct(Unknown Source)
    at BSImplTest.testDeleteProduct(BSImplTest.java:172)

@Entity
public class Product implements Serializable{
  @Id
  @Column(nullable = false)
  private String id;
 
  @OneToMany(mappedBy = "product", fetch = FetchType.EAGER, cascade={CascadeType.ALL})
  private List<ProductName> productNameList;

  @OneToMany(mappedBy = "product", fetch = FetchType.EAGER, cascade={CascadeType.ALL})
  private List<ProductData> productDataList;
}

@Entity
@IdClass(ProductDataPK.class)
public class ProductData implements Serializable{
  @Id
  @Column(nullable = false)
  private String id;

  @Id
  @Column(name="PR_ID", nullable = false, insertable = false, updatable = false)
  private String prId;
 
  @ManyToOne
  @JoinColumn(name = "PR_ID", referencedColumnName = "ID")
  private Product product;
}


@Entity
@IdClass(ProductNamePK.class)
public class ProductName implements Serializable{
  @Id
  @Column(name="DISTBN_TECHNOLOGY_NO", nullable = false)
  private Integer distbnTechnologyNo;
       
  @Id
  @Column(name="LOCALE_NO", nullable = false)
  private Integer localeNo;
       
  @Column(nullable = false)
  private String name;
       
  @Id
  @Column(name="PR_ID", nullable = false, insertable = false, updatable = false)
  private String prId;
       
  @ManyToOne
  @JoinColumn(name = "PR_ID", referencedColumnName = "ID")
  private Product product;
}

 « Return to Thread: Object: null is not a known entity type