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

----- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top