-
1. Re: Foreign Keys and changing Seam Gen templates
damianharvey Feb 10, 2007 8:55 AM (in response to damianharvey)I totally misunderstood what Hibernate was trying to do there. I get it now.
What I was really after was the <si:selectItems> and for those looking it's all detailed here: http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamSelectItemsNewDesign
The only problem I'm now facing is that the si:selectItems doesn't seem to want to play nice with the EntityHome that Seam Gen uses on all Create/Edit pages. This is covered in this thread: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008752#4008752
Also for anyone interested I made a change to the edit.xhtml.ftl template to include si:selectItems for ManyToOne fields:<#elseif c2h.isManyToOne(property)> <#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))> <#assign parentPageName = parentPojo.shortName> <#assign parentName = util.lower(parentPojo.shortName)> <tr class="prop"> <td class="name">${property.name}</td> <td class="value"> <s:decorate> <h:selectOneMenu value="${'#'}{${homeName}.instance.${property.name}}"> <si:selectItems value="${'#'}{${parentName}SelectList.resultList}" var="${parentName}" label="${'#'}{${parentName}.${parentPojo.identifierProperty.name}}"/> </h:selectOneMenu> </s:decorate> </td> </tr>
This goes between the last 2 </#if> which are before the first </#foreach>. I also deleted the association stuff after the actionButtons.
You still have to configure the project to handle si:selectItems and configure the components.xml to have the relevant queries; eg:<framework:entity-query name="countryCodeSelectList" ejbql="select c from CountryCode c" />
Hope this helps someone.
Cheers,
Damian. -
2. Re: Foreign Keys and changing Seam Gen templates
awhitford Feb 10, 2007 1:25 PM (in response to damianharvey)I think I have the same problem as you, and Gavin suggested getting the latest seam-gen from CVS... See my post:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=101221