users@glassfish.java.net

Re: Java EE + JPA questions

From: <glassfish_at_javadesktop.org>
Date: Tue, 03 Aug 2010 06:17:10 PDT

> What's the difference between
>
> @ManyToOne(optional=?) and
> @Column(nullable=?)

The first describes a relationship. The second describes attributes about a simple, basic mapping.

So you'll notice that @ManyToOne has no attributes in it about column names or anything like that.

@ManyToOne almost always goes with a @JoinColumn. @Column goes with @Basic (which is the default if not specified explicitly).

The JPA specification is here: http://jcp.org/aboutJava/communityprocess/final/jsr317/index.html

Hope that helps,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=479214