Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Issue with EclipseLink entities(What determines where eclipselink is looking for @Column, @Temporal and @Id annotations?)
Issue with EclipseLink entities [message #1751435] Tue, 10 January 2017 11:06 Go to next message
Ivan Petrov is currently offline Ivan PetrovFriend
Messages: 2
Registered: January 2017
Junior Member
I try to migrate my project from Java 6 + WebLogic 12.1.1 + EclipseLink 2.5.0 to Java 8 + WebLogic 12.1.3 + EclipseLink 2.6.4.

In all my EclipseLink entities I have @Id, @Temporal and @Column annotations for getters and not for fields. But when I deploy my app to the newer WebLogic it fails with errors like this

Quote:
org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity class [class com.example.MyEntity] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass
How can I tell EclipseLink to look for this annotation above getId() method, and not above private id field?


Maybe I should ask admins to tune WebLogic in some way?

an example of entity

@Entity
@ReadOnly
@Table(name="CONTRACT_OPTION", schema="SCH")

public class ContractOption implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long contractOptionId;
    private String contractOptionName;
    private BigDecimal sortOrder;
    private Date date;
    public ContractOption() {}


    @Id
    @Column(name="CONTRACT_OPTION_ID")
    public Long getContractOptionId() {
        return this.contractOptionId;
    }

    public void setContractOptionId(Long contractOptionId) {
        this.contractOptionId = contractOptionId;
    }


    @Column(name="CONTRACT_OPTION_NAME")
    public String getContractOptionName() {
        return this.contractOptionName;
    }

    public void setContractOptionName(String contractOptionName) {
        this.contractOptionName = contractOptionName;
    }


    @Column(name="SORT_ORDER")
    public BigDecimal getSortOrder() {
        return this.sortOrder;
    }

    public void setSortOrder(BigDecimal sortOrder) {
        this.sortOrder = sortOrder;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="DATE")
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return getContractOptionName();
    }
}
Re: Issue with EclipseLink entities [message #1751587 is a reply to message #1751435] Wed, 11 January 2017 17:08 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
Try specifying the @Access(AccessType.PROPERTY) on the entity, though I don't know what would cause the change in behavior unless you have other annotations that might cause it to use field access.
https://www.eclipse.org/eclipselink/api/2.0.2/javax/persistence/AccessType.html
Previous Topic:Eclipse link Groups by on embedded entity rather than on the root entity in Criteria Query
Next Topic:Trouble with getter annotations in entities
Goto Forum:
  


Current Time: Thu Dec 14 08:20:35 GMT 2017

Powered by FUDForum. Page generated in 0.01668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software