persistence@glassfish.java.net

Mapping columns in orm.xml

From: Andrei Badea <Andrei.Badea_at_Sun.COM>
Date: Tue, 20 Feb 2007 16:40:10 +0100

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