3 Replies Latest reply on Aug 20, 2007 8:06 AM by nynymike

    More newbie GET problems

    nynymike

      I'm completely bamboozled by this.... I had my GET parameters working, but I had to change the primary key of my db from "id" to "uniqueid" After I made the change, five hours later, nothing works. I even tried re-building a completely new project. I'm using Seam 1.2.1 and JBoss 4.0.5

      My components.xml factory/Home looks like this

       <factory name="account" value="#{accountDao.instance}"/>
       <fwk:entity-home name="accountDao" entity-class="us.ziacom.vm.model.Account">
       <fwk:created-message>
       New account #{account.mailbox} created
       </fwk:created-message>
       <fwk:deleted-message>
       Account #{account.mailbox} deleted
       </fwk:deleted-message>
       <fwk:updated-message>
       Account #{account.mailbox} updated
       </fwk:updated-message>
       </fwk:entity-home>
      

      My pages.xml looks like this:
       <page view-id="/viewAccount.xhtml">
       <param name="id" value="#{accountDao.uniqueid}"
       converterId="javax.faces.Long"/>
       </page>
       <page view-id="/confirmDelete.xhtml">
       <param name="id" value="#{accountDao.uniqueid}"
       converterId="javax.faces.Long"/>
       <navigation>
       <rule if-outcome="removed">
       <redirect view-id="/home.xhtml"/>
       </rule>
       </navigation>
       </page>
       <page view-id="/accountForm.xhtml">
       converterId="javax.faces.Long"/>
       <navigation>
       <rule if-outcome="updated">
       <redirect view-id="/viewAccount.xhtml"/>
       </rule>
       <rule if-outcome="persisted">
       <redirect view-id="/viewAccount.xhtml"/>
       </rule>
       </navigation>
       </page>
      


      The entity bean looks like this:
      @Entity
      @Table(name = "account", catalog = "asterisk")
      public class Account implements java.io.Serializable {
      
       private long uniqueid;
      [...]
       @Id
       @Column(name = "uniqueid", unique = true, nullable = false)
       @NotNull
       public long getUniqueid() {
       return this.uniqueid;
       }
       public void setUniqueid(long uniqueid) {
       this.uniqueid = uniqueid;
       }
      [...]
      



      This appears to be just a problem with SEAM finding the uniqueid parameter in pages.xml. This code generates the link perfectly, using the same entity home object. When you click on this link, you get the error:
       <s:link view="/viewAccount.xhtml" value="#{acct.mailbox}">
       <f:param name="id" value="#{acct.uniqueid}"/>
       </s:link>
      

      Here is the SQL for the table
      CREATE TABLE `account` (
       `uniqueid` bigint(20) NOT NULL auto_increment,
       `customer_id` varchar(11) NOT NULL default '0',
       `context` varchar(50) NOT NULL default 'consumer',
       `mailbox` varchar(32) NOT NULL default '0',
       `password` varchar(4) NOT NULL default '0',
       `fullname` varchar(50) NOT NULL default '',
       `email` varchar(50) NOT NULL default '',
       `pager` varchar(50) NOT NULL default '',
       `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
       `attach` varchar(4) NOT NULL default 'yes',
       `deletevoicemail` varchar(4) NOT NULL default 'yes',
       `maxgreet` varchar(6) NOT NULL default '60',
       `maxmessage` varchar(6) NOT NULL default '180',
       `userpassword` varchar(128) NOT NULL default 'password',
       `callerid` varchar(32) default NULL,
       `announcemode` varchar(4) NOT NULL default 'no',
       `status` varchar(12) NOT NULL default 'inactive' COMMENT 'active | inactive | suspended | pending',
       PRIMARY KEY (`uniqueid`),
       KEY `mailbox_context` (`mailbox`,`context`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
      

      The error I am getting is
      Exception during request processing: javax.faces.el.PropertyNotFoundException: Bean: org.jboss.seam.framework.EntityHome_$$_javassist_3, property: uniqueid
      
      org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:483)
      org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:454)
      org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:385)
      org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:173)
      org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:275)
      org.jboss.seam.core.Expressions$1.setValue(Expressions.java:93)
      org.jboss.seam.core.Pages.applyViewRootValues(Pages.java:665)
      org.jboss.seam.core.Pages.applyRequestParameterValues(Pages.java:646)
      org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRestoreView(AbstractSeamPhaseListener.java:73)
      org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:95)
      org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
      org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:181)
      org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
      org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      java.lang.Thread.run(Thread.java:619)
      


      Please help before I need to get committed somewhere !

      - Mike


        • 1. Re: More newbie GET problems
          christian.bauer

           


          <f:param name="id" value="#{acct.uniqueid}"/>


          Don't do that. The EntityHome framwork manages identifier properties through the 'id' getter and setter. This should work transparently, no matter what the identifier property of your entity is.


          • 2. Re: More newbie GET problems
            nynymike

            I messed up the copy for pages.xml, there should be a

             <page view-id="/accountForm.xhtml">
             <param name="id" value="#{accountDao.uniqueid}"
             converterId="javax.faces.Long"/>
             <navigation>
             <rule if-outcome="updated">
             <redirect view-id="/viewAccount.xhtml"/>
             </rule>
             <rule if-outcome="persisted">
             <redirect view-id="/viewAccount.xhtml"/>
             </rule>
             </navigation>
             </page>
            
            
            


            • 3. Re: More newbie GET problems
              nynymike

              I solved the problem by cheating... I reverted to a backup copy of my application, and instead of messing with the pages.xml, which I obviously FUBAR-d, I just changed the mapping on the Entity getId method to "uniqueid", and left everything else the same.... now it works again. :-)

              - Mike