This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 82581 - Entity project verification fails
Summary: Entity project verification fails
Status: RESOLVED INVALID
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 5.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Nitya Doraisamy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-13 10:40 UTC by pinus
Modified: 2006-08-29 23:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pinus 2006-08-13 10:40:52 UTC
I created an Enterprise Project and added some persistent entities and used the
verification target to check. Using NB5.5beta2 AppServer bundle.

Is there an issue with field vs. property access?

Verify failed with:

Test validity of EJB 3.0 persistence unit. This test tests validity using a
portable persistence provider.
For [ EnterpriseApplication1-ejb#EnterpriseApplication1-ejbPU ]

Exception Description: Entity class [class haug.persistent.Node] has no primary
key specified. It should define either an @Id, @EmbeddedId or an @IdClass.


The class is:
@Entity
public class Node implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @ManyToOne
    private Node parent;
    
    @OneToMany(mappedBy = "parent")
    private List<Node> children;
    
    private String value;
    
    
    
    public int hashCode() {
        int hash = 0;
        hash += (this.getId() != null ? this.getId().hashCode() : 0);
        return hash;
    }

    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are
not set
        if (!(object instanceof Node)) {
            return false;
        }
        Node other = (Node)object;
        if (this.getId() != other.getId() && (this.getId() == null ||
!this.getId().equals(other.getId()))) return false;
        return true;
    }

    public String toString() {
        return "haug.persistent.Node[id=" + getId() + "]";
    }


    
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }

    public Node getParent() {
        return parent;
    }
    public void setParent(Node parent) {
        this.parent = parent;
    }

    public List<Node> getChildren() {
        return children;
    }
    public void setChildren(List<Node> children) {
        this.children = children;
    }

    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    
}
Comment 1 Pavel Buzek 2006-08-29 00:03:02 UTC
I do not see an issue with field/property access - as long as all annotations
are either on fields or all are on methods everything should be OK. In any case,
the message is not very helpful.
Comment 2 _ ludo 2006-08-29 23:47:04 UTC
Sahho said:
"
Sounds like a bug in TopLink Essential. "

So I am moving the issue on GlassFish.
Comment 3 _ ludo 2006-08-29 23:51:16 UTC
Filed GlassFish P3 bug 
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1037
so keep watching the new issue.

Closing this one, as the NetBeans plugin is not involved there.