-->
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.  [ 1 post ] 
Author Message
 Post subject: Avoiding repetitive use of @org.hibernate.annotations?
PostPosted: Thu Sep 20, 2007 8:19 am 
Newbie

Joined: Mon Sep 18, 2006 9:23 am
Posts: 4
Location: Durham, UK
Hi,

I've been using Hibernate 3 and the annotations API for a while. While I wish that JPA provided all the functionality that I require, I've ended up making us of a lot of the Hibernate extension annotations, e.g.

@OneToMany(mappedBy="_paper") //< Just JPA
@org.hibernate.annotations.Fetch(value=org.hibernate.annotations.FetchMode.SUBSELECT)
@org.hibernate.annotations.Cascade(value={
org.hibernate.annotations.CascadeType.ALL,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
@org.hibernate.annotations.Sort(type=org.hibernate.annotations.SortType.NATURAL)
@org.hibernate.annotations.BatchSize(size=5)
private SortedSet<Dataset> _datasets = new TreeSet<Dataset>();

While this is great, it is very bulky, and made worse by the constant repetition of the "org.hibernate.annotations" prefix. I'd love to be able to use "import org.hibernate.annotations.*", as well as "import javax.persistence.*" in my class headers, but since the Hibernate extensions clash with JPA names in several cases this doesn't really make anything simpler.

Is there some way that I can use JPA and the Hibernate extensions without having to fully qualify the extension annotation names?

(This is mainly just whining about code aesthetics, but I think that's not totally irrelevant - all this bulkiness makes it harder to see what's going on, and detracts from the otherwise elegant nature of the annotations.)

Thanks,
Andy


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

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.