DataNucleus - Products
  History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JAVAFIVEPLUGIN-64
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Dirk Hermanns
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JPOX Java5

JDO2 : Support @Embedded use of Fields

Created: 29/May/07 02:10 PM   Updated: 04/Jul/07 01:52 PM
Component/s: JDO
Affects Version/s: 1.2.0-beta-2
Fix Version/s: 1.2.0-beta-3

Forum Thread URL: http://www.jpox.org/servlet/forum/viewthread?thread=4368


 Description  « Hide
Right now it is not possible to define embeddings of field information using the Java5 Annotations and JDO. For details, see the attached thread.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson - 07/Jun/07 03:18 PM
@Field annotation now has "columns" field of type Column[]. JPOX CVS now supports @Embedded with "fields" being set, and with @Field having "columns"

Andy Jefferson - 07/Jun/07 07:12 PM
In CVS HEAD. An example

@PersistenceCapable
public class Computer
{
    @Field
    @Column(name="ID")
    @PrimaryKey
    private long id; // Used by application identity

    @Field
    @Column(name="OPERATING_SYSTEM")
    private String operatingSystem;

    @Field
    @Embedded(nullIndicatorColumn="GRAPHICS_MANUFACTURER", ownerField="computer",
        fields={
            @Field(embeddedFieldName="manufacturer", columns={@Column(name="GRAPHICS_MANUFACTURER")}),
            @Field(embeddedFieldName="type", columns={@Column(name="GRAPHICS_TYPE")})
        })
    private ComputerCard graphicsCard;

    @Field
    @Embedded(nullIndicatorColumn="SOUND_MANUFACTURER", ownerField="computer",
        fields={
            @Field(embeddedFieldName="manufacturer", columns={@Column(name="SOUND_MANUFACTURER")}),
            @Field(embeddedFieldName="type", columns={@Column(name="SOUND_TYPE")})
        })
    private ComputerCard soundCard;

    ...
}

@PersistenceCapable
public class ComputerCard
{
    public static final int ISA_CARD = 0;
    public static final int PCI_CARD = 1;
    public static final int AGP_CARD = 2;

    @Field
    private String manufacturer;

    @Field
    private int type;

    @Field
    private Computer computer;

    ...
}