hbm2java annotations for 1:1 FK creates duplicate generator names
-----------------------------------------------------------------
Key: HBX-1197
URL:
https://hibernate.onjira.com/browse/HBX-1197
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.2LATER
Environment: hibernate-tools 3.5.0.Beta, hibernate 4.0.0.Final
Reporter: Bob Fields
Running hbm2java against schema with multiple 1:1 table relationships results in the
annotation on every 1:1 referenced Entity getIdentifierId():
@GenericGenerator(name="generator", strategy="foreign",
parameters=@Parameter(name="property",
value="UncapitalizedEntityName"))
@Id @GeneratedValue(generator="generator")
Generator name must be unique for proper validation. I would suggest adding the EntityName
to make this something globally unique like:
@GenericGenerator(name="EntityNameGenerator", strategy="foreign",
parameters=@Parameter(name="property",
value="UncapitalizedEntityName"))
@Id @GeneratedValue(generator="EntityNameGenerator")
Unfortunately, this code is not contained within a freemarker template file that can be
overridden. PojpPropertyAccessors.ftl -> GetPropertyAnnotation.ftl ->
Ejb3PropertyGetAnnotation.ftl -> ${pojo.generateAnnIdGenerator()}
This means the java code created by hbm2java must be manually modified every time is it
generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira