4 Replies Latest reply on Feb 14, 2007 4:36 AM by Carsten Hoehne

    pagination control (10.3) missing transaction

    Carsten Hoehne Master

      As gavin suggested. moved to herehttp://jira.jboss.com/jira/browse/JBSEAM-803
      (Could it be, that the @transactional has no effect in my environment:
      Hibernate running in microcontainer on tomcat
      Using the configuration from the Docu chapter 19.5)
      I do have implemented the pagination control (Chapter 10.3 from the docu.
      This piece of code does not function:
      <s:link view="/listUser.xhtml" rendered="#{myUserList.nextExists}" value=" last ">
      <f:param name="firstResult" value="#{myUserList.lastFirstResult}"/>
      </s:link>
      When rendering the page an exception is thrown:
      2:13:28,734 DEBUG org.jboss.seam.core.Events: Processing event:org.jboss.seam.postSetVariable.myUserList
      12:13:28,750 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.parentTraceEnabled=true
      12:13:28,750 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.nestedTraceEnabled=false
      12:13:28,750 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.detectDuplicateNesting=true
      12:13:28,750 ERROR org.hibernate.util.JDBCExceptionReporter: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171019559906/10, BranchQual=null:1171019559906, localId=0:10]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171019559906/10, BranchQual=null:1171019559906, localId=0:10])
      09.02.2007 12:13:28 com.sun.facelets.FaceletViewHandler handleRenderException
      SCHWERWIEGEND: Error Rendering View[/listUser.xhtml]
      javax.faces.el.EvaluationException: /listUser.xhtml @67,73 value="#{myUserList.lastFirstResult}": Exception getting value of property lastFirstResult of base of type : org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$9d3287a
      at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
      at javax.faces.component.UIParameter.getValue(UIParameter.java:68)
      at org.jboss.seam.ui.HtmlLink.getParameterString(HtmlLink.java:208)
      at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:115)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)

      After removing this piece of code the pagination works for first,last and next.
      I have debugged the app.
      getLastFirstResult is called which calls getResultCount form HibernateEntityQuery
      The query gets generated
      but Integer) query.uniqueResult();
      raises the excepton about the missing transaction.

      Any ideas what went wrong?
      Ciao,
      Carsten

        • 1. Re: pagination control (10.3) missing transaction
          Gavin King Master

          You need to give *way* more information than that.

          • 2. Re: pagination control (10.3) missing transaction
            Carsten Hoehne Master

            Hope this will be enough. If not please ask again. My runtime environment is configured as described in chapter 19.5
            configuration:

            <core:hibernate-session-factory name="hibernateSessionFactory"/>
            
             <core:managed-hibernate-session name="bazDatabase"
             session-factory-jndi-name="java:/bazDatabaseFactory"
             auto-create="true"/>
            
             <core:microcontainer installed="true"/>
            
             <security:identity authenticate-method="#{authorizationBean.authenticate}"/>
             <drools:rule-base name="securityRules">
             <drools:rule-files><value>security-rules.drl</value></drools:rule-files>
             </drools:rule-base>
            
             <!-- Setup application components -->
             <factory name="myUser" value="#{myUserHome.instance}"/>
             <framework:hibernate-entity-home name="myUserHome"
             entity-class="de.bafz.lims.model.User"
             session="#{bazDatabase}"/>
            
             <framework:hibernate-entity-query name="myUserList"
             ejbql="from User"
             max-results="5"
             order="login"
             session="#{bazDatabase}" />
            
            

            xhtml page :
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:t="http://myfaces.apache.org/tomahawk"
             xmlns:jdt="http://www.jenia.org/jsf/dataTools"
             xmlns:s="http://jboss.com/products/seam/taglib">
            
            <f:loadBundle basename="lims" var="bundle" />
            <body>
            <ui:composition template="/includes/LimsPage.xhtml">
             <ui:define name="title">
             <h:outputText value="list user" />
             </ui:define>
             <ui:define name="body">
             <h:form>
            
             <h:outputText value="No person exists"
             rendered="#{empty myUserList.resultList}" />
             <h:dataTable id="myUserList" var="myUser"
             value="#{myUserList.resultList}" border="1"
             rendered="#{not empty myUserList.resultList}">
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{bundle['User.login']}" />
             </f:facet>
             <s:link id="person" value="#{myUser.login}"
             view="/managePages/addUser.xhtml">
             <f:param name="myUserId" value="#{myUser.login}" />
             </s:link>
             </h:column>
            
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{bundle['User.firstName']}" />
             </f:facet>
             #{myUser.firstName}
             </h:column>
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{bundle['User.lastName']}" />
             </f:facet>
             #{myUser.lastName}
             </h:column>
             <h:column>
             <f:facet name="header">
             <h:outputText value="#{bundle['User.institute']}" />
             </f:facet>
             #{myUser.institute}
             </h:column>
            
             </h:dataTable>
            <s:link view="/listUser.xhtml" rendered="#{myUserList.previousExists}" value=" first ">
             <f:param name="firstResult" value="0"/>
            </s:link>
            
            <s:link view="/listUser.xhtml" rendered="#{myUserList.previousExists}" value=" prev ">
             <f:param name="firstResult" value="#{myUserList.previousFirstResult}"/>
            </s:link>
            
            <s:link view="/listUser.xhtml" rendered="#{myUserList.nextExists}" value=" next ">
             <f:param name="firstResult" value="#{myUserList.nextFirstResult}"/>
            </s:link>
            <s:link view="/listUser.xhtml" rendered="#{myUserList.nextExists}" value=" last ">
             <f:param name="firstResult" value="#{myUserList.lastFirstResult}"/>
            </s:link>
            
             <div class="actionButtons">
             <s:button id="newuser" value="#{bundle.NewUser}" view="/managePages/addUser.xhtml" />
             <s:button id="done" value="#{bundle.cancel}" view="/pages/main.xhtml" />
             </div>
            
             </h:form>
             </ui:define>
            </ui:composition>
            </body>
            </html>
            

            This is the stacktrace:
            15:44:37,406 DEBUG org.jboss.seam.core.Events: Processing event:org.jboss.seam.postSetVariable.myUserList
            15:44:37,421 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.parentTraceEnabled=true
            15:44:37,421 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.nestedTraceEnabled=false
            15:44:37,421 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.detectDuplicateNesting=true
            15:44:37,421 ERROR org.hibernate.util.JDBCExceptionReporter: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171291443484/10, BranchQual=null:1171291443484, localId=0:10]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171291443484/10, BranchQual=null:1171291443484, localId=0:10])
            12.02.2007 15:44:37 com.sun.facelets.FaceletViewHandler handleRenderException
            SCHWERWIEGEND: Error Rendering View[/listUser.xhtml]
            javax.faces.el.EvaluationException: /listUser.xhtml @66,72 value="#{myUserList.lastFirstResult}": Exception getting value of property lastFirstResult of base of type : org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$b1c71f88
             at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
             at javax.faces.component.UIParameter.getValue(UIParameter.java:68)
             at org.jboss.seam.ui.HtmlLink.getParameterString(HtmlLink.java:208)
             at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:115)
             at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
             at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
             at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
             at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
             at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:43)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:29)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
             at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
             at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
             at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
             at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
             at java.lang.Thread.run(Unknown Source)
            Caused by: javax.faces.el.EvaluationException: Bean: org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$b1c71f88, property: lastFirstResult
             at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
             at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
             at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
             at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
             at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
             at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
             at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
             ... 32 more
            Caused by: java.lang.reflect.InvocationTargetException
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
             ... 38 more
            Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
             at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
             at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
             at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
             at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
             at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
             at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
             at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
             at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
             at org.hibernate.loader.Loader.doQuery(Loader.java:661)
             at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
             at org.hibernate.loader.Loader.doList(Loader.java:2145)
             at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
             at org.hibernate.loader.Loader.list(Loader.java:2024)
             at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
             at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
             at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
             at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
             at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
             at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:756)
             at org.jboss.seam.framework.HibernateEntityQuery.getResultCount(HibernateEntityQuery.java:67)
             at org.jboss.seam.framework.Query.getLastFirstResult(Query.java:110)
             at org.jboss.seam.framework.Query$$FastClassByCGLIB$$6805c8c9.invoke(<generated>)
             at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
             at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
             at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
             at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
             at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
             at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:29)
             at sun.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
             at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
             at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
             at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
             at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
             at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:28)
             at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
             at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:23)
             at sun.reflect.GeneratedMethodAccessor151.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
             at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
             at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
             at sun.reflect.GeneratedMethodAccessor146.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
             at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
             at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
             at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
             at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
             at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
             at org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$b1c71f88.getLastFirstResult(<generated>)
             ... 43 more
            Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171291443484/10, BranchQual=null:1171291443484, localId=0:10]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171291443484/10, BranchQual=null:1171291443484, localId=0:10])
             at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
             at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
             at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
             ... 106 more
            Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1171291443484/10, BranchQual=null:1171291443484, localId=0:10]
             at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:290)
             at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:392)
             at org.jboss.resource.adapter.jdbc.local.LocalTxDataSource$ConnectionManagerDelegate.allocateConnection(LocalTxDataSource.java:78)
             at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
             ... 108 more
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam.core
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: entry
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: entry
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: entry
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: entry
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam.core
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: entry
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam
            15:44:37,437 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam.core
            15:44:37,453 DEBUG org.jboss.seam.Component: seam component not found: org
            15:44:37,453 DEBUG org.jboss.seam.Component: seam component not found: org.jboss
            15:44:37,453 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam
            15:44:37,453 DEBUG org.jboss.seam.Component: seam component not found: org.jboss.seam.core
            15:44:37,453 DEBUG org.jboss.seam.Component: seam component not found: bazExperiment
            15:44:37,468 DEBUG org.jboss.seam.intercept.RootInterceptor: intercepted: myUserList.getResultList
            


            • 3. Re: pagination control (10.3) missing transaction
              Carsten Hoehne Master

              Hello,
              i have taken the hibernate2 example from seam 1.1.6
              I added this page to the view: listHotel.xhtml

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:s="http://jboss.com/products/seam/taglib">
              
              
              <body>
              <ui:composition template="template.xhtml">
              
               <ui:define name="content">
               <div class="section"><h:form>
               <h:outputText value="No Hotel exists" rendered="#{empty myHotels.resultList}" />
               <h:dataTable id="myHotels" var="myHotel"
               value="#{myHotels.resultList}" border="1"
               rendered="#{not empty myHotels.resultList}">
               <h:column>
               <f:facet name="header">
               <h:outputText value="Name" />
               </f:facet>
               <s:link id="person" value="#{myHotel.name}" view="/viewHotel.xhtml">
               <f:param name="myHotelId" value="#{myHotel.name}" />
               </s:link>
               </h:column>
              
               <h:column>
               <f:facet name="header">
               <h:outputText value="Adress" />
               </f:facet>
               #{myHotel.address}
               </h:column>
               <h:column>
               <f:facet name="header">
               <h:outputText value="City, State" />
               </f:facet>
               #{myHotel.city},#{myHotel.state},#{myHotel.country}
               </h:column>
               <h:column>
               <f:facet name="header">
               <h:outputText value="Zip" />
               </f:facet>
               #{myHotel.zip}
               </h:column>
              
               </h:dataTable>
               <s:link view="/listHotel.xhtml"
               rendered="#{myHotels.previousExists}" value=" first ">
               <f:param name="firstResult" value="0" />
               </s:link>
              
               <s:link view="/listHotel.xhtml"
               rendered="#{myHotels.previousExists}" value=" prev ">
               <f:param name="firstResult" value="#{myHotels.previousFirstResult}" />
               </s:link>
              
               <s:link view="/listHotel.xhtml" rendered="#{myHotels.nextExists}"
               value=" next ">
               <f:param name="firstResult" value="#{myHotels.nextFirstResult}" />
               </s:link>
               <s:link view="/listHotel.xhtml" rendered="#{myHotels.nextExists}"
               value=" next ">
               <f:param name="firstResult" value="#{myHotels.lastFirstResult}" />
               </s:link>
              
              
               </h:form></div>
               </ui:define>
              </ui:composition>
              </body>
              </html>
              


              In gages.xml this definition is added:
              <page view-id="/listHotel.xhtml">
               <param name="firstResult" value="#{myHotels.firstResult}" />
               </page>
              

              Finally the modification of components.xml
              <?xml version="1.0" encoding="UTF-8"?>
              <components xmlns="http://jboss.com/products/seam/components"
               xmlns:core="http://jboss.com/products/seam/core"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:framework="http://jboss.com/products/seam/framework"
               xsi:schemaLocation=
               "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd
               http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-1.1.xsd
               http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd">
              
               <core:init debug="true"/>
              
               <core:manager conversation-timeout="120000"
               concurrent-request-timeout="500"
               conversation-id-parameter="cid"
               conversation-is-long-running-parameter="clr"/>
              
               <core:hibernate-session-factory name="hibernateSessionFactory"/>
              
               <core:managed-hibernate-session name="bookingDatabase"
               auto-create="true"/>
              
               <core:microcontainer installed="true"/>
               <!-- Setup application components -->
               <factory name="myHotel" value="#{myHotelHome.instance}"/>
               <framework:hibernate-entity-home name="myHotelHome"
               entity-class="org.jboss.seam.example.hibernate.Hotel"
               session="#{bookingDatabase}"/>
              
               <framework:hibernate-entity-query name="myHotels"
               ejbql="from Hotel"
               max-results="5"
               order="name"
               session="#{bookingDatabase}" />
              
              </components>
              

              After deploying and starting the app
              pointng the browser at http://localhost:8080/jboss-seam-hibernate/listHotel.seam
              results in an error screen. (/listHotel.xhtml @63,71 value="#{myHotels.lastFirstResult}": Exception getting value of property lastFirstResult of base of type : org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$66f3ddb3)

              Stacktrace:
              INFO: Server startup in 14875 ms
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/ajax4jsf.jar!/META-INF/a4j.taglib.xml
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/seam-ui.taglib.xml
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
              14.02.2007 08:29:59 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/E:/IDE/Tomcat5.5/webapps/jboss-seam-hibernate/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
              14.02.2007 08:30:01 com.sun.facelets.FaceletViewHandler handleRenderException
              SCHWERWIEGEND: Error Rendering View[/listHotel.xhtml]
              javax.faces.el.EvaluationException: /listHotel.xhtml @63,71 value="#{myHotels.lastFirstResult}": Exception getting value of property lastFirstResult of base of type : org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$66f3ddb3
               at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
               at javax.faces.component.UIParameter.getValue(UIParameter.java:68)
               at org.jboss.seam.ui.HtmlLink.getParameterString(HtmlLink.java:208)
               at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:115)
               at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
               at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
               at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
               at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
               at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
               at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:222)
               at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:43)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:29)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
               at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
               at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
               at java.lang.Thread.run(Unknown Source)
              Caused by: javax.faces.el.EvaluationException: Bean: org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$66f3ddb3, property: lastFirstResult
               at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
               at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
               at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
               at com.sun.el.parser.AstValue.getValue(AstValue.java:117)
               at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
               at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
               at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
               ... 35 more
              Caused by: java.lang.reflect.InvocationTargetException
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
               ... 41 more
              Caused by: java.lang.ClassCastException: java.lang.Long
               at org.jboss.seam.framework.HibernateEntityQuery.getResultCount(HibernateEntityQuery.java:67)
               at org.jboss.seam.framework.Query.getLastFirstResult(Query.java:110)
               at org.jboss.seam.framework.Query$$FastClassByCGLIB$$6805c8c9.invoke(<generated>)
               at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
               at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
               at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
               at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
               at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:29)
               at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
               at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
               at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
               at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
               at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
               at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:28)
               at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
               at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:23)
               at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
               at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
               at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
               at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
               at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
               at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:148)
               at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
               at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
               at org.jboss.seam.framework.HibernateEntityQuery$$EnhancerByCGLIB$$66f3ddb3.getLastFirstResult(<generated>)
               ... 46 more
              14.02.2007 08:30:13 org.apache.coyote.http11.Http11BaseProtocol pause
              INFO: Pausing Coyote HTTP/1.1 on http-8080
              14.02.2007 08:30:14 org.apache.catalina.core.StandardService stop
              INFO: Stopping service Catalina
              14.02.2007 08:30:15 org.apache.coyote.http11.Http11BaseProtocol destroy
              INFO: Stopping Coyote HTTP/1.1 on http-8080
              14.02.2007 08:30:15 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
              INFO: Failed shutdown of Apache Portable Runtime
              


              This time there seems to be a transaction but a new error occured. Class Cast.
              Nevertheless the pagination control from the docu won't run with hibernate. Any ideas what could went wrong?


              • 4. Re: pagination control (10.3) missing transaction
                Carsten Hoehne Master

                Finally i have found the reason:

                @Transactional
                @Override
                public Long getResultCount()
                {
                if (resultCount==null || isAnyParameterDirty())
                {
                org.hibernate.Query query = createCountQuery();
                resultCount = query==null ?
                null : (Integer) query.uniqueResult();
                }
                return resultCount.longValue();
                }

                query.uniqueResult returns a Long value. If resultcount is changed to Long (instead of Integer) all is well.

                For this i used the cvs version from yesterday. I had to disable page security for my tests. ( tag in pages.xml) Because of an, for me, unknown reason all access to my pages are forbidden.
                So i cant't use this seam library for my app.:-( Waiting for a new release fixing my problem.
                Ciao,
                Carsten
                BTW: i have reopened the corresponding JIRA issue