我正在运行 WebSphere v8,并在 Java EE 6 环境中使用 JPA 持久性。
当我尝试运行处理特定实体的代码时,我遇到了这个异常:
javax.ejb.EJBTransactionRolledbackException:嵌套异常是:javax.ejb.EJBTransactionRolledbackException:嵌套异常是:javax.ejb.EJBException:见嵌套异常;嵌套异常是:org.apache.openjpa.persistence.ArgumentException:“class au.com.combined.domain.changeroutine.ChangeRoutineConsumedPK”类型尚未增强。
但是,这篇文章说我的类应该已经在运行时得到了增强。ChangeRoutineConsumedPK 是一个可嵌入类。有人可以看看我的课并告诉我我做错了什么吗?谢谢你。
ChangeRoutineConsumed:
@Entity
@Table(name = ChangeRoutineConsumed.TABLE_NAME)
public class ChangeRoutineConsumed extends BaseBusinessObject {
public static final String TABLE_NAME = "COCHANGEROUTINECONSUMED";
@EmbeddedId
private ChangeRoutineConsumedPK id;
protected ChangeRoutineConsumed() {
super();
}
public ChangeRoutineConsumed(@Min(1) long changeRoutineId, @NotNull String consumedBy){
this(new ChangeRoutineConsumedPK(changeRoutineId, consumedBy));
}
public ChangeRoutineConsumed(@NotNull ChangeRoutineConsumedPK id){
super();
setId(id);
}
...
public int hashCode(){...};
public boolean equals(Object obj){...}
}
ChangeRoutineConsumedPK:
@Embeddable
public class ChangeRoutineConsumedPK {
@Column
private long changeRoutineId;
@Column
private String consumedBy;
public ChangeRoutineConsumedPK(){}
public ChangeRoutineConsumedPK(long changeRoutineId, String consumedBy) {
setChangeRoutineId(changeRoutineId);
setConsumedBy(consumedBy);
}
...
public int hashCode() {...}
public boolean equals(Object obj) {...}
}