-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: programmatic injection of @GenericGenerator
PostPosted: Thu Mar 31, 2011 12:55 am 
Newbie

Joined: Sat Feb 18, 2006 1:44 am
Posts: 15
Hi,

I have been trying to make my JPA application annotation free by making use of only orm.xml.
This has been working. I however had some trouble when I tried eliminating this annotation.

Code:
@GenericGenerator(name = "fkgenerator", strategy = "foreign", parameters = @Parameter(name = "property", value = "task"))

As such this is a very useful annotation but it extends JPA and is non-standard.

While most of my hibernate JPA entites are very annotation-free this requirement is forcing me to dirty my entity with this annotation. And this is not the only such annotation.

In my orm.xml I have
Code:
<entity  metadata-complete="false" class="TaskRecurrence">
   <table name="TasksRecurrence" />
   <attributes>
   <id name="id"><column name="id" unique="true" nullable="false"/>
   <generated-value generator="fkgenerator"/>
   </id>
   <basic name="unit" optional="false"></basic>
   <basic name="period" optional="false"></basic>
   <one-to-one fetch="LAZY"  name="task"><primary-key-join-column /></one-to-one>
   <transient name="new"/>
   
   </attributes>
   </entity>


It looks to me like all we seem to be doing is injecting a fkgenerator of type GenericGenerator by means of the annotation for the id property.

Can we do this progrmmatically somehow? Do this programatically for now and workout some additional xml for same later.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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.