-->
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.  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Annotations vs XDoclet
PostPosted: Wed Apr 06, 2005 9:26 pm 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
Hi,

I've been dipping my toes in the water with Hibernate for some time, but was put off by the separation of code from metadata. Finally, I determined to give XDoclet a try, but before I've had a chance to do much with XDoclet, now I find that the Annotations project is likely to supersede XDoclet in Hibernate sometime Real Soon Now.

Even a quick browse of the Annotations doco tells me that there is a lot missing that I will want (List and Map semantics, unidirectional one-to-many associations). I picked up on a couple of posts in this forum pointing out that these were coming, but until I get those features, I'm stuck with XDoclet. Which means double the learning curve, plus a bunch of code that I'll have to convert later. Or putting off my project until Annotations are ready for prime time.

I also see that there is no roadmap for Annotations, which is fair enough, given that it's a volunteer project (I might need to get involved). But this leaves me in a bit of a bind. Hence these questions...

Should I go with XDoclet and just forget about Annotations entirely? Or is it likely that Annotations will have the features I need sometime in the next, oh, couple of months?

TIA for any suggestions,
Luke


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 2:04 am 
Regular
Regular

Joined: Thu Feb 19, 2004 4:48 am
Posts: 62
Can't tell you much about the roadmap of the annotations-project, but I'm using annotations for quite a while now (about 4 months), after using xdoclet for some time: I never looked back. The annotations are really just some icing on the cake, and the cake of course is rock-solid (oops, my metapher got a little bit out of hand...): The annotations simply do, what they are supposed to do in a very solid manner. Most of all, this approach gets rid of a lot of overhead that comes with configuring/learning xdoclet and tweaking your build accordingly.

Concerning the features, in my experience they cover about 90% of what I need every day: The rest can be worked around easily until the features finally appear in the annotations, too. The ease of use that you get with the annotations far outweighs the lacking features...

cheers
stf


Top
 Profile  
 
 Post subject: I feel for you
PostPosted: Thu Apr 07, 2005 5:34 am 
Newbie

Joined: Mon Mar 14, 2005 11:50 am
Posts: 4
I'm travelling down that road too...

XDoclet is a nightmare... unmaintained semi-working crap. Annotations is the right(TM) way to go, but as you say - the features aren't there yet.

So, in my current project I'll probably go this way:

1. Develop the domain objects and write clever unit tests to validate the functionality.
2. Define the initial bindings to Hibernate using XDoclet (yuck), thus generating mapping files.
3. Run with this for a while until the model stabilizes.
4. Drop XDoclet and hack the hibernate mapping files by hand.

Step 4 involves some code-cleanup as I prefer to use field-level access for my domain objects (i.e. - remove redunant getters/setter).

Until annotations contains the full Hibernate feature set (I really don't care about EJB3 at this point) this is probably the best strategy IMO.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 6:10 am 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
mugwump wrote:
Can't tell you much about the roadmap of the annotations-project, but I'm using annotations for quite a while now (about 4 months), after using xdoclet for some time: I never looked back. The annotations are really just some icing on the cake, and the cake of course is rock-solid (oops, my metapher got a little bit out of hand...): The annotations simply do, what they are supposed to do in a very solid manner. Most of all, this approach gets rid of a lot of overhead that comes with configuring/learning xdoclet and tweaking your build accordingly.

Concerning the features, in my experience they cover about 90% of what I need every day: The rest can be worked around easily until the features finally appear in the annotations, too. The ease of use that you get with the annotations far outweighs the lacking features...


Wow. You've been using it for four months, but there still isn't support for such basic functionality as ordered collections? I don't know about your 90%, but I doubt it'll cover 70% for me.

What do you do for the other 10% of cases? Configure by hand with XML? I really, really don't want to go there. The whole metadata thing is giving me nightmares before I've even started.

Thanks for responding, BTW.

Luke


Top
 Profile  
 
 Post subject: Re: I feel for you
PostPosted: Thu Apr 07, 2005 6:16 am 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
anders.engstrom wrote:
I'm travelling down that road too...

XDoclet is a nightmare... unmaintained semi-working crap. Annotations is the right(TM) way to go, but as you say - the features aren't there yet.

So, in my current project I'll probably go this way:

1. Develop the domain objects and write clever unit tests to validate the functionality.
2. Define the initial bindings to Hibernate using XDoclet (yuck), thus generating mapping files.
3. Run with this for a while until the model stabilizes.
4. Drop XDoclet and hack the hibernate mapping files by hand.

Step 4 involves some code-cleanup as I prefer to use field-level access for my domain objects (i.e. - remove redunant getters/setter).

Until annotations contains the full Hibernate feature set (I really don't care about EJB3 at this point) this is probably the best strategy IMO.


Like you, I'm not interested in EJB3. Nor in EJB2 or 1 for that matter. OTOH, I'm reluctant to start down the road with XDoclet knowing that it's not going to be my final solution. I'm looking to get working on a long-term project for resale, and if I get it right I will probably be maintaining the thing until I retire. I really don't wat to have to re-engineer the app two years down the track when I have several hundred seats in the field, or at all for that matter. I want to get it right first time out.

Perhaps the answer is to get my hands dirty as a developer on the Annotations project, at least to the extent of getting the features I need for myself. It's probably worth considering.

Thanks for the comments, Anders.

Luke


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 11:02 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
OK guys, the 2 really missing features the annotations have to provide are:
- ordered collections which is straightforward. BTW what users really want is indexed collections and Matthew Ingers is working on it.
- maybe embedded composite id (ie not through a PK class)

I don't think you are missing anything else right now.

But if you do, please go to JIRA and vote for your favorite feature. I've described all the needed annotations to cover the H3 capabilities. I'll prioritize them depending on the demand.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 7:41 pm 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
emmanuel wrote:
OK guys, the 2 really missing features the annotations have to provide are:
- ordered collections which is straightforward. BTW what users really want is indexed collections and Matthew Ingers is working on it.
- maybe embedded composite id (ie not through a PK class)

I don't think you are missing anything else right now.

But if you do, please go to JIRA and vote for your favorite feature. I've described all the needed annotations to cover the H3 capabilities. I'll prioritize them depending on the demand.


I can't see anything on JIRA about unidirectional one-to-many associations, though I'm certain I spotted a post somewhere in the forum saying that it was coming. Cant find it now though.

There's one other feature I'd really like to see. How difficult would it be to implement an addAllAnnotatedClasses() method? As things stand, every time a new persistent class is added, either the configuration file or the session configuration code needs to be modified, which is extra handling, and which could cause bottlenecks in team development environments.

To be honest, the above isn't too serious an issue for me as a single developer, but I can see where it could become a major PITA for medium-to-large teams. You'd have one element which would practically always be checked out every time you went to grab it.

As long as the code was packaged such that only annotated classes are kept in the relevant package, this would be a really nice feature.

Cheers,
Luke


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 3:38 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
lukewebber wrote:
I can't see anything on JIRA about unidirectional one-to-many associations, though I'm certain I spotted a post somewhere in the forum saying that it was coming. Cant find it now though.

Read the doc of the new beta1 lot's of things have changed :-)

There's one other feature I'd really like to see. How difficult would it be to implement an addAllAnnotatedClasses() method? As things stand, every time a new persistent class is added, either the configuration file or the session configuration code needs to be modified, which is extra handling, and which could cause bottlenecks in team development environments.

To be honest, the above isn't too serious an issue for me as a single developer, but I can see where it could become a major PITA for medium-to-large teams. You'd have one element which would practically always be checked out every time you went to grab it.

As long as the code was packaged such that only annotated classes are kept in the relevant package, this would be a really nice feature.[/quote]

Actually it is doable in a container and JBoss EJB 3.0 does that. But from a library perspective (such as Hibernate) this is not really doable. We do not control the classloader.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 4:43 am 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
Quote:
Read the doc of the new beta1 lot's of things have changed :-)

Ah, gotcha. Well done!

Quote:
There's one other feature I'd really like to see. How difficult would it be to implement an addAllAnnotatedClasses() method? As things stand, every time a new persistent class is added, either the configuration file or the session configuration code needs to be modified, which is extra handling, and which could cause bottlenecks in team development environments.

To be honest, the above isn't too serious an issue for me as a single developer, but I can see where it could become a major PITA for medium-to-large teams. You'd have one element which would practically always be checked out every time you went to grab it.

As long as the code was packaged such that only annotated classes are kept in the relevant package, this would be a really nice feature.

(And you wrote...)
Actually it is doable in a container and JBoss EJB 3.0 does that. But from a library perspective (such as Hibernate) this is not really doable. We do not control the classloader.

I think I understand. It's no easy thing, actually, to enumerate the classes in a package. I guess I'll need to build this into my app for myself if it becomes an issue. Possibly as an Ant task that will build a text file to be read in by my configuration code.

Thanks for the insights, Emmanuel.

Luke[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 12:57 am 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
emmanuel wrote:
OK guys, the 2 really missing features the annotations have to provide are:
- ordered collections which is straightforward. BTW what users really want is indexed collections and Matthew Ingers is working on it.
- maybe embedded composite id (ie not through a PK class)

I don't think you are missing anything else right now.

But if you do, please go to JIRA and vote for your favorite feature. I've described all the needed annotations to cover the H3 capabilities. I'll prioritize them depending on the demand.


I see that the JIRA issue is now showing as resolved. Any idea when we can expect a release which includes Lists with at least one example or minimal documentation?

Sorry to be a PITA, but I've fallen in love with Annotations and a List implementation is all I need to make my joy complete. ;^)

Cheers,
Luke


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 4:34 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
lukewebber wrote:
I see that the JIRA issue is now showing as resolved. Any idea when we can expect a release which includes Lists with at least one example or minimal documentation?


Documentation is trivial, have a look at
http://cvs.sourceforge.net/viewcvs.py/hibernate/HibernateExt/metadata/test/org/hibernate/test/annotations/indexcoll/

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 4:56 am 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
emmanuel wrote:

PERFECT! Simple and effective. Now when can I have it? I don't want to sound needy, but I am. ;^)

Luke


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 5:02 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
We don't put a date on our releases. But check the module out of CVS and build it: I only commit stable works.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 11:25 pm 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
emmanuel wrote:
We don't put a date on our releases. But check the module out of CVS and build it: I only commit stable works.

OK, I have it checked out, but it looks as if there's one thing still missing, namely ejb-api/src/javax/persistence/IndexColumn.java . Have you not yet checked that into CVS?

Sorry again to be so bloody annoying.

Luke


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 16, 2005 6:55 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
javax.persistence.IndexColumn does not exist.
org.hibernate.annotations.IndexColumn is what you want.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 18 posts ]  Go to page 1, 2  Next

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.