-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Annotation - only way?
PostPosted: Thu Apr 10, 2008 9:10 am 
Regular
Regular

Joined: Fri Jul 30, 2004 4:02 pm
Posts: 50
Reading through the spec, it looks like the only way to take advantage of JSR-303 implementations is presently documented as annotations. There is a section 7.1 that mentions deployment descriptors, but it is not populated and I am concerned that this will be a second-class citizen and/or implementors ignore this piece due to the perception of second-class citizen.

* Clean code models that may have varying validations could be implemented as deployment descriptor files instead of multiple coded models to support different annotation methods.

* Tool support that will focus on the deployment descriptor files without having to modify the code.

* Allow compiled applications to change their behavior by modifying deployment descriptors instead of having to recompile (assuming you have the source code -- someone could deploy a pre-built JEE application, but still allow deployment/installation customizations without a coder).

I view validations as both data integrity tools as well as business rules -- I would like to strongly support that XML deployment descriptors are still given equal support instead of being a second-class citizen behind annotations.

p.s. Most good solutions to problems should have common ground and can be solved in multiple languages. A strongly supported XML deployment descriptor format allow for a validation-framework to be implemented in Java, Ruby, .NET, PHP, etc.


Top
 Profile  
 
 Post subject: Re: Annotation - only way?
PostPosted: Wed Apr 23, 2008 7:40 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
dhartford wrote:
Reading through the spec, it looks like the only way to take advantage of JSR-303 implementations is presently documented as annotations. There is a section 7.1 that mentions deployment descriptors, but it is not populated and I am concerned that this will be a second-class citizen and/or implementors ignore this piece due to the perception of second-class citizen.


Hi
The reason why XML has not been populated is because that's a moving target. When annotations and the meta model will be settled, creating the XML DD will be just a matter of transposition. No need to do the job several times. There should be pretty much a one-to-one equivalence between the annotations model and the XML model.
There is no particular agenda besides the initial specification proposal.

That being said, I am quite in favor of annotations and the need for XML DD is, I, think quite marginal and for the fun of it I will ague that with you :)

Quote:
* Clean code models that may have varying validations could be implemented as deployment descriptor files instead of multiple coded models to support different annotation methods.


You can use http://in.relation.to/Bloggers/BeanValidationSneakPeekPartIIIGroupsAndPartialValidation to apply different validations to the same model. That being said, constraints should generally be mutualized and annotations are great for that.

Quote:
* Tool support that will focus on the deployment descriptor files without having to modify the code.

Tooling support these days spend a lot of energy keeping XML DD and Java Code in sync. Using annotations makes things easier, not harder for them.

Quote:
* Allow compiled applications to change their behavior by modifying deployment descriptors instead of having to recompile (assuming you have the source code -- someone could deploy a pre-built JEE application, but still allow deployment/installation customizations without a coder).

I don't think this is a compelling feature. I have yet to find interesting use cases where you can change constraints on the fly without unit testing your application except when using rule engines. If you test it, compiling it is the least of your issue.
A rule engine externalizes the constraint logic from the constraint rules. But the actual constraint declaration stays in place.

Quote:
I view validations as both data integrity tools as well as business rules -- I would like to strongly support that XML deployment descriptors are still given equal support instead of being a second-class citizen behind annotations.


The spec will treat annotations and XML DD in an equal foot. People will then make their mind from here.

Quote:
p.s. Most good solutions to problems should have common ground and can be solved in multiple languages. A strongly supported XML deployment descriptor format allow for a validation-framework to be implemented in Java, Ruby, .NET, PHP, etc.

Many of the language you describe indeed have some sort of metadata support in the language itself. Bean Validation can be applied easily in ruby and .Net, not sure about PHP but ahem ;)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 4:26 am 
Regular
Regular

Joined: Tue Apr 01, 2008 11:10 am
Posts: 69
What do you think about using compile-time annotation processing to generate the XML descriptor?

http://java.sun.com/j2se/1.5.0/docs/gui ... arted.html

Shouldn't that provide a faster/more efficient runtime installation?

_________________
--
Stéphane Épardaud


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 10:36 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No actually back when I tested Hibernate Annotations, I found that annotations parsing was faster than XML parsing.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.