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.