[jboss-user] [JBoss Seam] - Re: Foreign Keys and changing Seam Gen templates
damianharvey
do-not-reply at jboss.com
Sat Feb 10 08:55:42 EST 2007
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4014137#4014137
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4014137
More information about the jboss-user
mailing list