You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Heather Sterling <hs...@us.ibm.com> on 2009/02/18 01:13:05 UTC

drawbacks of using XML over annotations


Hello,

I am trying to determine whether it makes sense for us to define our
metadata with annotations or XML.  We have a lot of persistent classes,
many of which don't have business logic, so we were looking for a way to
have a single point of management for the schema.  We also wanted to make
it very easy to update or add a class so that the entire process could be
automated.  Based on our use cases, I was wondering if XML was the better
solution.  I also had some questions on the limitations of the entity XML,
specifically:

1) Do you still get the optimizations that come from enhancing persistent
classes containing annotations?
2) In reading the manual, it looked like there is a set of advanced
features that are only supported via annotations, and not XML.  Is this
correct?  Are there plans to provide XML equivalents in the future?
3) Is there any way to generate the java classes with annotations based on
entity XML?  I am able to do it from the database schema.

Thanks

Heather Sterling
Systems Management Development
Phone:  919-254-7163 T/L: 444-7163
Cell: 919-423-3143
Email: hsterl@us.ibm.com

Re: drawbacks of using XML over annotations

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
> 1) Do you still get the optimizations that come from enhancing persistent
> classes containing annotations?
Enhancement as a build-time, post-compilation process works with both source
code annotations and XML descriptors. And, by all means, this build-time
enhancement is the preferred/recommended approach for any
production/staging-level deployment. At runtime, there may be a slight
difference at start up (when metadata for persistent classes are being
scanned/sourced) between annotation and XML descriptors -- but for practical
purpose that is negligible. 

> 2) In reading the manual, it looked like there is a set of advanced
> features that are only supported via annotations, and not XML.  Is this
> correct?  
Yes.

> Are there plans to provide XML equivalents in the future?
A design for supporting OpenJPA-specific annotations in XML descriptors was
laid out [1]. But this project is not currently active. One uncertainty
surrounding this issue is JPA specification defined XML Schema (orm.xsd)
curently does not allow vendor specific extension elements. The decision
regarding this aspect i.e. whether JPA XML Schema allow vendor-specific
extension at all and if it does, what form that will take is still pending. 

3) Is there any way to generate the java classes with annotations based on
entity XML?

Not that I am aware of. That will be a nice to have facility especially when
the domain classes carry no business logic.


Heather Sterling wrote:
> 
> 
> 
> Hello,
> 
> I am trying to determine whether it makes sense for us to define our
> metadata with annotations or XML.  We have a lot of persistent classes,
> many of which don't have business logic, so we were looking for a way to
> have a single point of management for the schema.  We also wanted to make
> it very easy to update or add a class so that the entire process could be
> automated.  Based on our use cases, I was wondering if XML was the better
> solution.  I also had some questions on the limitations of the entity XML,
> specifically:
> 
> 1) Do you still get the optimizations that come from enhancing persistent
> classes containing annotations?
> 2) In reading the manual, it looked like there is a set of advanced
> features that are only supported via annotations, and not XML.  Is this
> correct?  Are there plans to provide XML equivalents in the future?
> 3) Is there any way to generate the java classes with annotations based on
> entity XML?  I am able to do it from the database schema.
> 
> Thanks
> 
> Heather Sterling
> Systems Management Development
> Phone:  919-254-7163 T/L: 444-7163
> Cell: 919-423-3143
> Email: hsterl@us.ibm.com
> 

-- 
View this message in context: http://n2.nabble.com/drawbacks-of-using-XML-over-annotations-tp2344051p2344571.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.