Mihail Stoynov's blog!
Surrender your ego
Friday, July 18, 2008
@CollectionOfElements, JPA, the documentation and the problems it raises
In a project that I mention a lot there's an persistent model using JPA as an interface to Hibernate.
There was case where I wanted to put extra columns in a
@ManyToMany
relationship. JPA cannot do that.
So I had to use the Hibernate's
@CollectionOfElements
.
It works like that: if there are the objects Class and Student, the extra columns go to the wrapper class EnhancedStudent. The EnhancedStudent has a property of type Student.
Now I have a few bugs related to it:
Causes the
@Version
of the containing object (Class) to increment on
EntityManager.html#find(java.lang.Class, java.lang.Object)
The creation of an ExtraStudent cannot propagate (cascade) the inner Student - no matter what.
The funniest thing is that the documentation of the
@CollectionOfElements
is a single line:
Annotation used to mark a collection as a collection of elements or a collection of embedded objects
http://www.hibernate.org/hib_docs/annotations/api/org/hibernate/annotations/CollectionOfElements.html
:(
Comments [0]
|
Trackback
OpenID
Please login with either your
OpenID
above, or your details below.
Name
E-mail
(will show your
gravatar
icon)
Home page
Remember Me
Comment (Some html is allowed:
a@href@title, blockquote@cite, strike
) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.
Enter the code shown (prevents robots):
Live Comment Preview
dasBlog theme by
Mads Kristensen
RSS feed
Search
Archives
April, 2010 (1)
March, 2010 (1)
November, 2009 (13)
October, 2009 (12)
September, 2009 (5)
August, 2009 (3)
July, 2009 (6)
June, 2009 (13)
May, 2009 (8)
April, 2009 (1)
March, 2009 (7)
February, 2009 (2)
January, 2009 (1)
December, 2008 (2)
November, 2008 (15)
October, 2008 (16)
September, 2008 (30)
August, 2008 (15)
July, 2008 (14)
June, 2008 (26)
May, 2008 (6)
April, 2008 (21)
March, 2008 (14)
February, 2008 (28)
November, 2007 (5)
October, 2007 (7)
September, 2007 (1)
August, 2007 (7)
July, 2007 (3)
June, 2007 (1)
Blog Stats
Total Posts: 283
This Year: 2
This Month: 0
This Week: 0
Comments: 215
Categories
Android
Apple
BSD
Did you know
Java
OpenWrt
rulez
Sucks
The USA trip
TODO
БГ
Blogroll
Michael Moore (no rss)
Links
BG-JUG
Copyright policy
No rights reserved.
(You are going to
copy stuff anyway :)
If you mention my
name, thank you.
2010, Mihail Stoynov