db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Jefferson (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-403) JDO2 Annotations
Date Sun, 24 Jun 2007 17:08:26 GMT

    [ https://issues.apache.org/jira/browse/JDO-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507700
] 

Andy Jefferson commented on JDO-403:
------------------------------------

Why does <field> accept multiple <column> elements ? because it is possible to
map one field to multiple columns in the datastore (ok if you play with Strings, doubles etc
then you dont care about this, but lots of people do). Taking the same capability with annotations
we can specify a field with @Columns and define multiple columns for it to be persisted into.
All I did with the "columns" property of @Field is apply the same idea for embedded fields.

An example, using java.awt.Point :-
@EmbeddedOnly
class MyLine
{
    Point pt1;
    Point pt2;
}

@PersistenceCapable
@Table(name="DRAWINGS")
class MyDrawing
{
    @Field
    @Embedded(fields={
            @Field(embeddedFieldName="pt1",
                           columns={@Column(name="PT_1_X"),@Column(name="PT_1_Y")}),
            @Field(embeddedFieldName="pt2",
                           columns={@Column(name="PT_2_X"),@Column(name="PT_2_Y")})
        })
    MyLine line;
}

So I have 2 fields in the embedded class, and each of those has 2 columns in the table of
MyDrawing.
CREATE TABLE DRAWINGS
{
    ...
    PT_X_1 INT NULL,
    PT_Y_1 INT NULL,
    PT_X_2 INT NULL,
    PT_Y_2 INT NULL,
    ...
)

Suppose we could apply the same where the embedded PC has a relation to another PC and that
PC uses a composite PK - hence there are more than 1 column forming the FK across to it, so
we need to be able to specify multiple columns in the embedded definition

> JDO2 Annotations
> ----------------
>
>                 Key: JDO-403
>                 URL: https://issues.apache.org/jira/browse/JDO-403
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2
>    Affects Versions: JDO 2 final
>            Reporter: Andy Jefferson
>            Assignee: Michelle Caisse
>             Fix For: JDO 2 maintenance release 1
>
>         Attachments: embedded.patch, jdo_2_1_annotations.jar
>
>
> It would be desirable for JDO2 to have its own set of annotations. We have developed
a set within JPOX that would likely serve as a starting point for such a set. In my opinion
they should be
> 1. Split into javax.jdo.annotations.jdo and javax.jdo.annotations.orm
> 2. Move ORM attributes from some of the JDO annotations and have a ORM annotation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message