Hello
I have 2 classes, Equipment and EquipmentType:
Code:
...
public class Equipment implements java.io.Serializable {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
@Column(name="oid", nullable=false, insertable=true, updatable=true, length=8)
private Long oid;
@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH},optional=false)
@JoinColumn(name="Equ_oid", referencedColumnName="oid", nullable=false)
private EquipmentType type;
...
EquipmentType is very simple and has no association with Equipment.
I'm getting this exception:
Quote:
Exception in thread "main" javax.ejb.EJBException: org.hibernate.PropertyValueException: not-null property references a null or transient value: xxx.commons.datamodel.model.Equipment.type
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
...
Why does it happen? I know the NonUniqueObjectException issue with saveOrUpdate() but I don't know why does this happen. It works with merge().