-->
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: using hibernate-only (non javax.persistence.*) annot's?
PostPosted: Mon Oct 31, 2005 4:58 pm 
Beginner
Beginner

Joined: Sat Sep 17, 2005 10:41 am
Posts: 49
There's alot of overlap between the EJB3 and hibernate-extension annotations. For example, @Entity...

However, there doesn't seem to be a way to just use the hibernate extension annotations. (For example, if I want an @Entity with access = FIELD and mutable = true.) I think the majority of users will have to fall back on the Hibernate extensions, and it's much easier for a developer to keep track of one set of persistence annotation APIs rather than two...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 5:14 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
We discussed this recently at our dev meeting and the conclusion was:

No, its a lot easier for developers to use only the standard extensions and when they have to, use an additional @org.hibernate.annotation.* (not globally imported). This keeps code maintainable and easily portable. You can immediately get an overview of what Hibernate-specific annotations you use by simply searching the source code for org.hibernate.annotations. The result of that search includes all code snippets. It also makes writing and reading examples a lot easier.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 12:08 am 
Beginner
Beginner

Joined: Sat Sep 17, 2005 10:41 am
Posts: 49
With all due respect, I don't buy the portability argument. EJB3 persistence as defined by the standards bodies will always be behind the curve as a complete solution, so all developers will have to fall back to Hibernate extensions (or some other ORM provider's extensions). So H3/Annotations will become the de facto standard as Hibernate 2.x is now. Maybe I'm short-sighted, but I don't see anyone else coming up with a free, reliable and widely used ORM solution.

I also don't see a case where a group starts developing with Hibernate, then decides to go with another ORM solution. It's hard to compete with free, stable and widely-used. Even in the unlikely scenario of an API switch, I doubt that coding to strict EJB3 persistence standards then using additional Hibernate annotations will help anyone make the switch. So instead of editing the @Entity annotation, you wind up deleting the @org.hibernate.annotations.Entity annotation and replacing it with a different one.

I guess my main objection is the lack of integrated EJB3+Hibernate Extensions documentation. Right now, one would basically have to read the (incomplete) JSR EJB3 doc, then the Hibernate EJB3 reference documentation, and then look at the API docs for both to figure out which function or feature can be called from where...

Then again, maybe this will all be moot when HiA 2 comes out :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 6:28 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Those who have written applications with annotations will be able to tell you if its possible or not to use only EJB3 annotations. I don't think it is possible, from my experience, to write a real-world application without vendor annotations. However, I had to use them much less frequently than I thought I would have, and I can certainly imagine to replace them with annotations from another vendor. If you have worked with annotations for a while you'll realize that its not about one being older or less up-to-date than the other. EJB3 really defines the basic mapping features, which, for Hibernate at least, haven't changed at all in 4 years and are unlikely to be ever replaced with completely different annotations. The org.hibernate.annotations are actually real extensions, quite a few only relevant for performance optimization.

Yes, HiA SE will show all XML and annotation mappings side-by-side. All you need, by the way, is the excellent Hibernate Annotations reference documentation (thanks to Emmanuel) in addition to the Hibernate reference.


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.