Hibernate Books

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Meta Attribute Missing for Property in Embeddable ID
PostPosted: Mon Nov 21, 2011 6:39 pm 

Joined: Mon Nov 21, 2011 6:21 pm
Posts: 3
I am using reverse engineering and I have a table:

this_thing (
other_thing_id INT PK,
this_thing_type ENUM('ASDF','QWER') PK,
... other fields)

In my hibernate.reveng.xml I have the following stanza:

<table name="this_thing">
<column name="this_thing_type" type="com.asdf.qwer.ThisThingType">
<meta attribute="annotations">@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)</meta>

I have altered the PojoPropertyAccessors.ftl to emit "annotations":

<#if pojo.hasMetaAttribute(property, "annotations")>
${c2j.getMetaAsString(property, "annotations")}

The Enumerated annotation is placed on the getId() method of the ThisThing Entity instead of on the getThisThingType() method of the ThisThingId Embeddable class.

I have been using this approach successfully for other enum properties, but this is the first time the property has been part of the primary key.

a.) Is this a bug in the handling of meta attributes when the property is part of the key?
b.) Is there a workaround?
c.) Is there a better way to generate the Enumerated attribute for String-based enum values?

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.