persistence@glassfish.java.net

Re: Mapping columns in orm.xml

From: Guy Pelletier <guy.pelletier_at_oracle.com>
Date: Tue, 20 Feb 2007 10:51:11 -0500

Andrei you need to add something as follows;

<basic name="fullName">
    <column name="FULL_NAME", length=20, nullable="false"/>
 </basic>

Cheers,
Guy

----- Original Message -----
From: "Andrei Badea" <Andrei.Badea_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Sent: Tuesday, February 20, 2007 10:40 AM
Subject: Mapping columns in orm.xml


>I seem to be missing something obvious, but which element in orm.xml
> corresponds to the @Column annotation? For example, how would the
> fullName property in the following example be mapped with XML?
>
> @Entity
> public class Customer {
>
> @Id
> @Column(name = "ID", nullable = false)
> private Integer id;
>
> @Column(name = "FULL_NAME", length = 20, nullable = false)
> private String fullName;
> }
>
> I would expect something like
>
> <entity-mappings>
> <entity>
> <attributes>
> <id name="id">
> <column name="ID" nullable="false"/>
> </id>
> <!-- map the fullName property here -->
> </attributes>
> </entity>
> </entity-mappings>
>
> but I don't know which element to use to map the FULL_NAME property. The
> spec allows basic, version, embedded, transient and the relationship
> elements. None of these seems to be the right one.
>
> Thanks,
>
> Andrei
>