我的应用程序第一次运行时出现以下错误...
引起:异常[EclipseLink-7155](Eclipse Persistence Services - 2.0.1.v20100213-r6600):org.eclipse.persistence.exceptions.ValidationException 异常描述:实体类[class Novartis.OTM.Data.Db.Entities.DtsTmpClass]上属性[lapId]的类型[类Lap]不是序列化映射的有效类型。属性类型必须实现Serializable接口。
以下是相关实体。
@SequenceGenerator(name="SEQ_DTS_TMP_CLASS", sequenceName="SEQ_DTS_TMP_CLASS", allocationSize=1)
@Entity
@Table(name = "DTS_TMP_CLASS")
@NamedQueries({
@NamedQuery(name = "DtsTmpClass.findAll", query = "SELECT d FROM DtsTmpClass d"),
@NamedQuery(name = "DtsTmpClass.findByDtsTmpClassId", query = "SELECT d FROM DtsTmpClass d WHERE d.dtsTmpClassId = :dtsTmpClassId")})
public class DtsTmpClass implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "DTS_TMP_CLASS_ID")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_DTS_TMP_CLASS")
private Integer dtsTmpClassId;
@JoinColumn(name = "LAP_ID", referencedColumnName = "LAP_ID")
@ManyToOne(optional = false, fetch=FetchType.EAGER)
private Lap lapId;
...
}
如下所示,输入Lap implements Serializable!
@SequenceGenerator(name="SEQ_LAP", sequenceName="SEQ_LAP", allocationSize=1)
@Entity
@Table(name = "LAP")
@NamedQueries({
@NamedQuery(name = "Lap.findAll", query = "SELECT l FROM Lap l"),
@NamedQuery(name = "Lap.findByLapId", query = "SELECT l FROM Lap l WHERE l.lapId = :lapId"),
@NamedQuery(name = "Lap.findByDeprecate", query = "SELECT l FROM Lap l WHERE l.deprecate = :deprecate")})
public class Lap implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "LAP_ID")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_LAP")
private Integer lapId;
@Column(name = "DEPRECATE")
private Character deprecate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "lapId")
private Collection<LapAnal> lapAnalCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "lapId")
private Collection<LapDomain> lapDomainCollection;
@JoinColumn(name = "ASSAY_PLATFORM_ID", referencedColumnName = "LOOKUP_ID")
@ManyToOne(optional = false, fetch=FetchType.EAGER)
private Lookup assayPlatformId;
@JoinColumn(name = "LABORATORY_ID", referencedColumnName = "LOOKUP_ID")
@ManyToOne(optional = false, fetch=FetchType.EAGER)
private Lookup laboratoryId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "lapId")
private Collection<DtsTmpClass> dtsTmpClassCollection;
...
}
奇怪的是,我只是缩短了表名和列名,因此Oracle不会超过30个字符的限制。它只是工作。
我很困惑!
谢谢,
克里斯