5 Replies Latest reply on Jun 1, 2006 1:50 AM by Max Rydahl Andersen

    jbossIDE1.6GA and seam CRUD

    jaejong kim Newbie

      I want to create reversed seam app by CRUD tool, but I got following exception.

      I have tryed this jbossIDE1.5 with several nightly build and I got same exception.

      Expression field.value.typeName is undefined on line 35, column 6 in seam/find.jsp.ftl.
      The problematic instruction:
      ----------
      ==> if-else [on line 35, column 1 in seam/find.jsp.ftl]
      ----------

      Java backtrace for programmers:
      ----------
      freemarker.core.InvalidReferenceException: Expression field.value.typeName is undefined on line 35, column 6 in seam/find.jsp.ftl.
      at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
      at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:121)
      at freemarker.core.IfBlock.accept(IfBlock.java:80)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
      at freemarker.core.Environment.visit(Environment.java:351)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.process(Environment.java:176)
      at freemarker.template.Template.process(Template.java:231)
      at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:243)
      at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
      at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
      at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
      at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:112)
      at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:101)
      at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:84)
      at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:69)
      at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:93)
      at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:59)
      at org.hibernate.tool.hbm2x.seam.SeamExporter.doStart(SeamExporter.java:65)
      at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:93)
      at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$1.execute(CodeGenerationLaunchDelegate.java:250)
      at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
      at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
      at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:221)
      at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:108)
      at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:590)
      at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:515)
      at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:733)
      at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:931)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)

        • 1. Re: jbossIDE1.6GA and seam CRUD
          Fady Matar Novice

          Unable to reproduce, can you elaborate more?

          • 2. Re: jbossIDE1.6GA and seam CRUD
            jaejong kim Newbie

            I execute hibernate tool from jbossIDE 1.6 plugined hibernate_3.1.0.beta5 to generate jboss seam skeleton app depeneon database table. and I got the Exception.

            • 3. Re: jbossIDE1.6GA and seam CRUD
              Max Rydahl Andersen Master

              most likely compositeid's which is not supported in the seam generation (yet)

              • 4. Re: jbossIDE1.6GA and seam CRUD
                Deyan Bontchev Newbie

                There are issues with the composite keys and two of the templates.

                1. In find.jsp.ftl you should check if typeName is not null. Here is the updated <#foreach> section:

                <#foreach field in pojo.getAllPropertiesIterator()><#if !c2h.isCollection(field) && !c2h.isManyToOne(field)> <h:outputLabel value="${'#'}{msg.${pojo.shortName}_${field.name}}" for="${field.name}">

                <#if field.value.typeName?exists>

                <#if field.value.typeName == "date"> <h:inputText value="${'#'}{${entityFinder}.example.${field.name}}" id="${field.name}">

                <f:convertDateTime type="date" dateStyle="short"/>

                </h:inputText>

                <#elseif field.value.typeName == "time"> <h:inputText value="${'#'}{${entityFinder}.example.${field.name}}" id="${field.name}">

                <f:convertDateTime type="time"/>

                </h:inputText>

                <#elseif field.value.typeName == "timestamp"> <h:inputText value="${'#'}{${entityFinder}.example.${field.name}}" id="${field.name}">

                <f:convertDateTime type="both" dateStyle="short"/>

                </h:inputText>

                <#elseif field.value.typeName == "boolean"> <h:selectBooleanCheckbox value="${'#'}{${entityFinder}.example.${field.name}}" id="${field.name}"/>
                <#else> <h:inputText value="${'#'}{${entityFinder}.example.${field.name}}" id="${field.name}"/>

                </#if>

                <#else> <h:inputText value="${'#'}{${entityFinder}.example.${field.name}}" id="${field.name}"/>

                </#if> </h:outputLabel>

                </#if></#foreach> <h:outputLabel value="${'#'}{msg.PageSize}" for="pageSize">



                2. In editorbean.java.ftl you should check if identifierProperty is not null. Here is the updated <#if> /line 47/:

                <#if pojo.identifierProperty?exists && pojo.identifierProperty.value.identifierGeneratorStrategy == "assigned"> if ( entityManager.find(${entityClass}.class, instance.${pojo.getGetterSignature(pojo.identifierProperty)}())!=null )


                Good luck!

                • 5. Re: jbossIDE1.6GA and seam CRUD
                  Max Rydahl Andersen Master

                  *please* put these in hibernate tools jira as patches! thank you!