From: Max R. A. (JIRA) <no...@at...> - 2006-05-19 11:44:17
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-664?page=comments#action_23132 ] Max Rydahl Andersen commented on HBX-664: ----------------------------------------- thanks - but what does this patch actually fix ? the reverse engineering works fine with everything so I assume it is something seam template specific....maybe you have a testcase? > Patch to allow reverse engineering to work with tables and associations ending with "s" > ---------------------------------------------------------------------------------------- > > Key: HBX-664 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-664 > Project: Hibernate Tools > Type: Patch > Components: reverse-engineer > Versions: 3.1.beta5 > Reporter: Jarkko Lietolahti > > > 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; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |