我在映射此枚举时出现问题:
public enum KOBEnum {
Kost,
Baat
}
它映射在类'KostOfBaat'中,如下所示:
@Column(name ="KostOfBaatEnum")
private KOBEnum kobEnum;
它有一个吸气剂和二传手。数据库中的相应列是'KostOfBaatEnum',因此它不是拼写错误,并且数据作为序数放入数据库中。
我已经尝试过几乎所有东西,但是我仍然会在映射此类时出错。这是运行示例JPQL查询后的输出:
Exception [EclipseLink-59] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance variable [KostOfBaatEnum] is not defined in the domain class [persistence.KostOfBaat], or it is not accessible.
Internal Exception: java.lang.NoSuchFieldException: KostOfBaatEnum
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[KostOfBaatEnum-->kostofbaat.KostOfBaatEnum]
Descriptor: RelationalDescriptor(persistence.KostOfBaat --> [DatabaseTable(kostofbaat)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: A non-read-only mapping must be defined for the sequence number field.
Descriptor: RelationalDescriptor(persistence.Analyse --> [DatabaseTable(analyse)])
Exception [EclipseLink-41] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: A non-read-only mapping must be defined for the sequence number field.
Descriptor: RelationalDescriptor(persistence.KostOfBaat --> [DatabaseTable(kostofbaat)]).