MetaData : XML .v. Annotation precedence - primary-key
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache JDO Project > MetaData : XML .v. Annotation precedence - primary-key




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    MetaData : XML .v. Annotation precedence - primary-key  
Andy Jefferson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-10-07 12:11 PM

I came across a particular situation that impacts on the wording for the te=
xt=20
to go in the spec for precedence of XML and Annotation metadata.

I have :-

@PersistenceCapable
public class MyClass
{
@PrimaryKey
long id;

@Persistent
String name;

..
}

Question : Should we allow users to override the setting of "primary-key" i=
n=20
XML when it is defined in the annotations ? or should the setting in the=20
annotations for which field(s) are PK be fixed ?

The problem comes in how to merge the value in annotations and value in XML=
=2E=20
With XML, due to the DTD/XSD, there will always be a value for "primary-key=
".=20
With annotations it will have a value only if the user provided one.

If we allow overrides via XML, then we must just take any value from XML=20
(since there is always a value when read in). This impacts on what a user h=
as=20
to specify when overriding any information in XML. For example, if the user=
=20
wanted to override some info about the above class they would have to speci=
fy=20
the "primary-key" values correctly to make sure that they were respected (i=
f=20
they didn't specify the "primary-key" element then they get the DTD default=
=20
of "false"!) hence duplicate definition.


My conclusion is that we should prohibit the override of "primary-key" when=
=20
the annotations have explicitly set the value. If annotations haven't set t=
he=20
value then the value in XML should be respected.=20
Anyone disagree ?


=2D-=20
Andy =C2=A0(Java Persistent Objects - http://www.jpox.org)






[ Post a follow-up to this message ]



    Re: MetaData : XML .v. Annotation precedence - primary-key  
cbeams


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-10-07 06:11 PM

+1

On Aug 10, 2007, at 12:55 AM, Andy Jefferson wrote:

> My conclusion is that we should prohibit the override of "primary-
> key" when
> the annotations have explicitly set the value. If annotations
> haven't set the
> value then the value in XML should be respected.







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:42 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register