开发者

EclipseLink JPA 2 Type Not Valid For Serialized Mapping [closed]

开发者 https://www.devze.com 2023-02-15 10:09 出处:网络
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.

Closed 8 years ago.

Improve this question

I am getting the following error when my application first runs...

Caused by: Exception [EclipseLink-7155] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.ValidationException Exception Description: The type [class Lap] for the attribute [lapId] on the entity class [class Novartis.OTM.Data.Db.Entities.DtsTmpClass] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface.

Here are the relevant entities.

@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;
    ...
}

As you can see below, type 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 = Casca开发者_开发百科deType.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;
    ...
}

What really odd is that I just shortened the table and column names so Oracle wouldn't barf over the 30 character limit. It was just working.

I'm baffled!

Thanks,

Chris

0

精彩评论

暂无评论...
验证码 换一张
取 消