Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Customizing the column names of embeddables

You need to get the descriptor for LengthType, so need the Session to do
this.  Perhaps use a SessionCustomizer instead of a DescriptorCustomizer.



Frank Schwarz wrote:
> 
> Hi,
> 
> I am trying to customize the column names of embeddables with the help of
> a class customizer, but I am somehow stuck.
> 
> Let's say you have a class "Parcel" with attributes height, length, width
> - all of them are of the same type "LengthType". "LengthType" is an
> embeddable consisting of value and unit. So If you what to map this, you
> have the use @AttributeOverride-annotations - otherwise you will end with
> three columns named "value" and three ones named "unit".
> 
> So to get rid of the @AttributeOverrides, I wrote a class customizer and
> annotated the "Parcel"-class. Within the customize-method, I called
> classDescriptor.getMappingForAttributeName("height"),... to manipulate the
> fieldnames on that mapping. However at this place, I am not able to get
> information about the "LengthType"-class and its fields:
> classDescriptor.getMappingForAttributeName("height").getReferenceDescriptor()
> is returning null. On the other hand, getReferenceClass() is returning
> "LengthType" as expexted. But I need some sort of Session to lookup the
> class descriptor by type - with I do not have at this place.
> 
> How do I get to the class descriptor of the referenced class (i.e.
> "LengthType")?
> 
> Thank you,
> Frank
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/Customizing-the-column-names-of-embeddables-tp28276405p28287885.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top