[JBoss Seam] - EntityQuery (entity-query) General Performance Questions
by jfrankman
Has anyone had experience using the EntityQuery class to query a mid to large sized table (300,000+ records)?
I used seam gen to create a CRUD application for a single table. The main list.xhmtl page uses a generated component that extends from the EntityQuery class. The table I am querying has about 300,000 records. I have set the maxresults=25. But the applicaiton is extremely slow. It takes several seconds to load the list page and at least 3-6 seconds to do a search. The database is DB2 V9. Other application components I have written work well with DB2 and there are not any performance problems. But the generated list page is still very slow. Worse yet, if the class had any EAGER associations with other classes the query never came back with any results.
Is 300,000 records too much for the EntityQuery to handle?
I would not thnk so, but I found that when the page first loads the application exectues a "select all" statment (select * from tablex) It seems that is does not limit the result set on the query, but selects all the records and the filters the results down to 25 after the database has returned the query results. Of course I could be totally wrong on this but I can't see any other problem. It would be helpful if there was some more in depth documentation for the EntityHome and EntityQuery classes.
Anyhow, has anyone used the EntityQuery to do work over a mid to large sized table? If so, did it work "out of the box" or did you have to do some additional configuration and/or coding to get it to work for you?
Here is the class that extends QueryList:
package com.idfbins.nexus.presentation;
|
| import java.util.Arrays;
| import java.util.List;
|
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.framework.EntityQuery;
|
| import com.idfbins.nexus.common.vo.busent.ClientVO;
|
|
|
| @Name("clientList")
| public class ClientListQuery extends EntityQuery {
|
| public ClientListQuery() {
| this.setMaxResults(25);
| this.setOrder("search");
| }
|
| private static final String[] RESTRICTIONS = {
| "lower(clientVO.search) like concat(#{clientList.clientVO.search},'%')",
| "lower(clientVO.memberNumber) like concat(#{clientList.clientVO.memberNumber},'%')",
| };
|
|
| private ClientVO clientVO = new ClientVO();
|
| @Override
| public String getEjbql() {
| return "select clientVO from ClientVO clientVO";
| //return "select clientVO from ClientVO clientVO left join fetch clientVO.entityLocations entityLocation " ;
| }
|
|
| @Override
| public String getOrder() {
| // TODO Auto-generated method stub
| return "search";
| }
|
|
| @Override
| public Integer getMaxResults() {
| return 25;
| }
|
| public ClientVO getClientVO() {
| return clientVO;
| }
|
| @Override
| public List<String> getRestrictions() {
| return Arrays.asList(RESTRICTIONS);
| }
| }
Here is the list page:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
| <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
|
| <h:form id="fbLenderSearch" styleClass="edit">
|
| <rich:simpleTogglePanel label="Lender search parameters" switchType="server">
|
| <s:decorate template="layout/display.xhtml">
| <ui:define name="label">memberno</ui:define>
| <h:inputText id="memberno" value="#{clientList.clientVO.memberNumber}"/>
| </s:decorate>
|
|
|
| <s:decorate template="layout/display.xhtml">
| <ui:define name="label">search</ui:define>
| <h:inputText id="search" value="#{clientList.clientVO.search}"/>
| </s:decorate>
|
|
|
|
| </rich:simpleTogglePanel>
|
| <div class="actionButtons">
| <h:commandButton id="search" value="Search" action="/LenderLookupList.xhtml"/>
| </div>
|
| </h:form>
|
| <rich:panel rendered="#{not empty clientList.clientVO.search}">
| <f:facet name="header">Lender search results</f:facet>
| <div class="results" id="clientList">
|
| <h:outputText value="No Lender exists"
| rendered="#{empty clientList.resultList}"/>
|
| <rich:dataTable id="clientList"
| var="clientVO"
| value="#{clientList.resultList}"
| rendered="#{not empty clientList.resultList}">
| <h:column>
| <f:facet name="header">
| <s:link styleClass="columnHeader"
| value="clientid #{clientList.order=='id asc' ? messages.down : ( fbclientList.order=='id desc' ? messages.up : '' )}">
| <f:param name="order" value="#{clientList.order=='id asc' ? 'id desc' : 'id asc'}"/>
| </s:link>
| </f:facet>
| #{clientVO.id}
| </h:column>
| <h:column>
| <f:facet name="header">
| <s:link styleClass="columnHeader"
| value="memberno #{clientList.order=='memberNumber asc' ? messages.down : ( clientList.order=='memberNumber desc' ? messages.up : '' )}">
| <f:param name="order" value="#{clientList.order=='memberNumber asc' ? 'memberNumber desc' : 'memberNumber asc'}"/>
| </s:link>
| </f:facet>
| #{clientVO.memberNumber}
| </h:column>
| <h:column>
| <f:facet name="header">
| <s:link styleClass="columnHeader"
| value="search #{clientList.order=='search asc' ? messages.down : ( clientList.order=='search desc' ? messages.up : '' )}">
| <f:param name="order" value="#{clientList.order=='search asc' ? 'search desc' : 'search asc'}"/>
| </s:link>
| </f:facet>
| #{clientVO.search}
| </h:column>
| <h:column >
| <f:facet name="header">
| city state
| </f:facet>
| <h:outputText value="#{clientVO.primaryLocation.summary}" rendered="#{clientVO.primaryLocation!=null}"/>
|
| </h:column>
| </rich:dataTable>
|
| </div>
| </rich:panel>
|
| <div class="tableControl">
|
| <s:link view="/LenderLookupList.xhtml"
| rendered="#{clientList.previousExists}"
| value="#{messages.left}#{messages.left} First Page"
| id="firstPage">
| <f:param name="firstResult" value="0"/>
| </s:link>
|
| <s:link view="/LenderLookupList.xhtml"
| rendered="#{clientList.previousExists}"
| value="#{messages.left} Previous Page"
| id="previousPage">
| <f:param name="firstResult"
| value="#{clientList.previousFirstResult}"/>
| </s:link>
|
| <s:link view="/LenderLookupList.xhtml"
| rendered="#{clientList.nextExists}"
| value="Next Page #{messages.right}"
| id="nextPage">
| <f:param name="firstResult"
| value="#{clientList.nextFirstResult}"/>
| </s:link>
|
| <s:link view="/LenderLookupList.xhtml"
| rendered="#{clientList.nextExists}"
| value="Last Page #{messages.right}#{messages.right}"
| id="lastPage">
| <f:param name="firstResult"
| value="#{clientList.lastFirstResult}"/>
| </s:link>
|
| </div>
|
|
| </ui:define>
|
| </ui:composition>
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076479#4076479
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076479
18Â years, 8Â months
[JNDI/Naming/Network] - SessionFactory in java:namespace - not bound?!
by arnieOag
I'm deploying a .har alongside my .war in an .ear. My session factory is using a secured data source (security-domain) as shown below:
| <datasources>
| <!-- connection to appsec -->
| <local-tx-datasource>
| <jndi-name>us/tx/state/oag/dev/ApplicationSecurity</jndi-name>
| <connection-url>jdbc:jtds:sybase://sydev1a:9000/application_security</connection-url>
| <driver-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</driver-class>
| <security-domain>WebAppDomainDevApplicationSecurity</security-domain>
| <min-pool-size>3</min-pool-size>
| <max-pool-size>5</max-pool-size>
| <metadata>
| <type-mapping>Sybase</type-mapping>
| </metadata>
| </local-tx-datasource>
|
|
The .har has the requisite class and hbm.xml files in it, along with the following jboss-service.xml file:
| <mbean code="org.jboss.hibernate.jmx.Hibernate"
| name="jboss.jca:service=HbmSessFacDevApplicationSecurity">
|
| <attribute name="DatasourceName">java:us/tx/state/oag/dev/ApplicationSecurity</attribute>
| <attribute name="Dialect">org.hibernate.dialect.SybaseDialect</attribute>
|
| <attribute name="SessionFactoryName">java:/hibernate/dev/ApplicationSecurity</attribute>
|
| <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
|
| <!-- I added this to get scanning of mapping files in JARs -->
| <attribute name="ScanForMappingsEnabled">true</attribute>
|
| <!-- we need the DataSource deployed before Hibernate deploys -->
| <depends>jboss.jca:name=us/tx/state/oag/dev/ApplicationSecurity,service=DataSourceBinding</depends>
| <depends>jboss.jca:service=RARDeployer</depends>
|
| </mbean>
|
Things are being deployed and setup correctly (I think...)
| 15:09:51,812 INFO [SessionFactoryImpl] building session factory
| 15:09:53,406 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
| 15:09:53,406 INFO [NamingHelper] JNDI InitialContext properties:{}
| 15:09:53,484 INFO [Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/dev/ApplicationSecurity]
|
|
| The session factory is showing up in the JNDI view thusly:
|
|
| | java: Namespace
| |
| | +- SecurityProxyFactory
| | +- us
| | | +- tx
| | | | +- state
| | | | | +- oag
| | | | | | +- dev
| | | | | | | +- Common
| | | | | | | +- ApplicationSecurity
| | | | | | | +- Workflows
| | | | | | | +- EmployeeWarehouse
| | | | | | +- prd
| | | | | | | +- Common
| | | | | | | +- ApplicationSecurity
| | | | | | | +- DpsLicenses
| | +- comp
| | +- jaas
| | | +- WebAppDomainPrdDpsLicenses
| | | +- WebAppDomainDevCommon
| | | +- WebAppDomainDevApplicationSecurity
| | | +- WebAppDomainPrdCommon
| | | +- WebAppDomainDevEmployeeWarehouse
| | | +- WebAppDomainDevWorkflows
| | | +- WebAppDomainPrdApplicationSecurity
| | +- timedCacheFactory
| | Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
| | +- TransactionPropagationContextExporter
| | +- Mail
| | +- TransactionPropagationContextImporter
| | +- TransactionManager
| | +- hibernate
| | | +- dev
| | | | +- ApplicationSecurity
| | | | +- Common
| | | | +- Workflows
| | | | +- EmployeeWarehouse
| | | +- prd
| | | | +- ApplicationSecurity
| | | | +- Common
| | | | +- DpsLicenses
| |
|
| and yet the following code always gets the same error:
|
|
| | ctx = new InitialContext();
| | lo_result = (SessionFactory)ctx.lookup("java:/hibernate/dev/ApplicationSecurity");
| |
|
|
| | 15:15:28,468 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| | 15:15:28,468 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| | 15:15:28,468 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| | 15:15:28,468 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| | 15:15:28,468 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
| | 15:15:28,468 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| | 15:15:28,468 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| | 15:15:28,468 ERROR [STDERR] at us.tx.state.oag.util.jsf.BaseBean.getSessionFactory(BaseBean.java:72)
| | 15:15:28,468 ERROR [STDERR] at us.tx.state.oag.OagPortalRegistration.AuthenticationBean.authenticateUser(AuthenticationBean.java:125)
| | 15:15:28,468 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| | 15:15:28,468 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| | 15:15:28,468 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| | 15:15:28,468 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
| | 15:15:28,468 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:109)
| | 15:15:28,468 ERROR [STDERR] at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
| | 15:15:28,468 ERROR [STDERR] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
| | 15:15:28,468 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| | 15:15:28,468 ERROR [STDERR] at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| | 15:15:28,468 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| | 15:15:28,468 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| | 15:15:28,468 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| | 15:15:28,468 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| | 15:15:28,468 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| | 15:15:28,468 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| | 15:15:28,468 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| | 15:15:28,468 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| | 15:15:28,468 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| | 15:15:28,468 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
| |
|
| I just don't see how this can be happening. Is there some kind of odd security constraint put on things when they are deployed in an .ear?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076476#4076476
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076476
18Â years, 8Â months
[JBoss Portal] - Re: Configuring JBoss Portlets by default
by kpalania
I am editing the default-object.xml file bundled with my portlets. I've verified that this file gets picked up now.
This is how my entry looks in portlet-instances.xml -
<deployment>
| <instance>
| <instance-id>SomePortletInstance</instance-id>
| <portlet-ref>SomePortlet</portlet-ref>
| </instance>
| </deployment>
..and this is how my entry in the default-object.xml looks like:
<security-constraint>
| <policy-permission>
| <action-name>viewrecursive</action-name>
| <role-name>Admin</role-name>
| </policy-permission>
| </security-constraint>
| <page>
| <page-name>default</page-name>
| <window>
| <window-name>AdminPortletWindow</window-name>
| <instance-ref>SomePortletInstance</instance-ref>
| <region>center</region>
| <height>0</height>
| </window>
| </page>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076473#4076473
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076473
18Â years, 8Â months