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
|