Duplicate
Details
Assignee
UnassignedUnassignedReporter
JarkkoJJarkkoJPatch Reminder (view)
Contributions and patches should be using the GitHub Fork + Pull model
Patch Reminder (edit)
Contributions and patches should be using the GitHub [Fork + Pull model|href="https://help.github.com/articles/using-pull-requests]
Participants
JarkkoJMax Rydahl AndersenComponents
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
JarkkoJ
JarkkoJPatch Reminder (view)
Contributions and patches should be using the GitHub Fork + Pull model
Patch Reminder (edit)
Contributions and patches should be using the GitHub [Fork + Pull model|href="https://help.github.com/articles/using-pull-requests]
Participants
JarkkoJ
Max Rydahl Andersen
Components
Affects versions
Priority
Created May 19, 2006 at 12:42 PM
Updated September 14, 2006 at 7:25 PM
Resolved September 14, 2006 at 7:25 PM
Index: java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
===================================================================
— java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java (revision 9925)
+++ java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java (working copy)
@@ -86,6 +86,10 @@
return StringHelper.unqualify(getMappedClassName());
}
+ public String getShortNamePlural() {
+ return ReverseEngineeringStrategyUtil.simplePluralize(getShortName());
+ }
+
public String getQualifiedDeclarationName() {
String generatedName = getMetaAsString( MetaAttributeConstants.GENERATED_CLASS );
if ( generatedName == null || generatedName.trim().length() == 0 ) {
Index: java/org/hibernate/tool/hbm2x/pojo/POJOClass.java
===================================================================
— java/org/hibernate/tool/hbm2x/pojo/POJOClass.java (revision 9925)
+++ java/org/hibernate/tool/hbm2x/pojo/POJOClass.java (working copy)
@@ -74,7 +74,8 @@
public String getPackageName();
public String getShortName();
-
+ public String getShortNamePlural();
+
public Iterator getToStringPropertiesIterator();
public Iterator getEqualsHashCodePropertiesIterator();
Index: templates/seam/editorbean.java.ftl
===================================================================
— templates/seam/editorbean.java.ftl (revision 9925)
+++ templates/seam/editorbean.java.ftl (working copy)
@@ -1,5 +1,5 @@
${pojo.getPackageDeclaration()}
-// Generated ${date} by Hibernate Tools ${version}
+// Generated ${date} by Hibernate Tools ${version}-jab
<#assign classbody>
<#assign entityEditor = pojo.shortName.toLowerCase() + "Editor"><#assign entityFinder = pojo.shortName.toLowerCase() + "Finder"><#assign entityList = pojo.shortName.toLowerCase() + "List"><#assign entity = pojo.shortName.toLowerCase()><#assign entityClass = pojo.importType(pojo.qualifiedDeclarationName)>
@@ -38,7 +38,7 @@
@${pojo.importType("org.jboss.seam.annotations.In")}(required=false)
private transient ${pojo.shortName}Finder ${entityFinder};
@${pojo.importType("org.jboss.seam.annotations.In")}
+ @${pojo.importType("org.jboss.seam.annotations.In")}(create=true)
private transient ${pojo.importType("java.util.ResourceBundle")} resourceBundle;
@${pojo.importType("org.jboss.seam.annotations.Begin")}(join=true)
@@ -57,7 +57,7 @@
</#if> entityManager.persist(instance);
isNew = false;
<#foreach property in pojo.getAllPropertiesIterator()><#if c2h.isManyToOne(property)><#assign getter = "get" + pojo.getPropertyName(property)> if (instance.${getter}()!=null) {
instance.${getter}().get${pojo.shortName}s().add(instance);
+ instance.${getter}().get${pojo.shortNamePlural}().add(instance);
}
</#if></#foreach> refreshFinder();
return "edit${pojo.shortName}";
@@ -72,7 +72,8 @@
@${pojo.importType("org.jboss.seam.annotations.End")}(ifOutcome="find")
public String delete() {
entityManager.remove(instance);
-<#foreach property in pojo.getAllPropertiesIterator()><#if c2h.isManyToOne(property)><#assign getter = "get" + pojo.getPropertyName(property)> instance.${getter}().get${pojo.shortName}s().remove(instance);
+<#foreach property in pojo.getAllPropertiesIterator()><#if c2h.isManyToOne(property)><#assign getter = "get" + pojo.getPropertyName(property)>
+ instance.${getter}().get${pojo.shortNamePlural}().remove(instance);
</#if></#foreach> refreshFinder();
return doneOutcome;
}