[Persistence, JBoss/CMP, Hibernate, Database] - setMaxResults(100) NE set rowcount 100
by arnieOag
I have a database with 23,350,000+ records, 842,960 of which are for the city of Austin.
When I issue the following SQL through my IDE:
| set rowcount 100
| select * from state_card_holders where phys_adrs_city = 'AUSTIN'
|
The database responds in less than a second with the top 100 records.
When I run my Hibernate code:
| session = sessFac.openSession();
| searchCriteria = session.createCriteria(StateCardHolders.class)
| .add(Restrictions.eq(fieldName, fieldValue))
| .setMaxResults(100)
| addOrder(Order.asc("nameLast")).addOrder(Order.asc("nameFirst"))
| .list();
|
It takes 3 minutes. Clearly something is amiss and I suspect that the setMaxResults statement isn't resulting in a set rowcount 100 being issued by Hibernate, but rather its scanning the entire result set of 800+ records and discarding all but the first 100.
Which takes 3 minutes.
Is there not a way to make this more efficient? How do I tell Hibernate to tell Sybase to only return the top 100 records?
I could always revert back to using a Stored Procedure, but would rather not.
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118450#4118450
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118450
18 years, 3 months
[JNDI/Naming/Network] - JMS Provider failiure XAConnectionFactory
by rlopezpe
I'm getting this error in my server log and can't figure out what's causing it. I have a mySQL datasource setup which works fine and that's about it but keep getting this error in my log every 5 seconds or so. I've been searching trying to find a solution to this but all unsuccessful.
Here's a copy of mysql-ds.xml file:
<datasources>
| <local-tx-datasource>
| <jndi-name>MySqlDS</jndi-name>
| <connection-url>jdbc:mysql://localhost:3306/formbuilderdb</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>adobe</user-name>
| <password>mypwd</password>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| <!-- sql to call when connection is created
| <new-connection-sql>some arbitrary sql</new-connection-sql>
| -->
| <!-- sql to call on an existing pooled connection when it is obtained from pool
| <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
| -->
|
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
This is my application policy code:
<application-policy name = "MySqlDbRealm">
| <authentication>
| <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
| <module-option name = "principal">adobe</module-option>
| <module-option name = "userName">adobe</module-option>
| <module-option name ="password">mypwd</module-option>
| <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
| </login-module>
| </authentication>
| </application-policy>
I've added the two lines in bold to the standardjbosscmp-jdbc.xml file right under de "defaults" tag:
| <datasource>java:/MySqlDS</datasource>
| <datasource-mapping>mySQL</datasource-mapping>
I am not very familiar with JBOSS but this sounds to me like it should be something simple, any help?
Error Log:
2008-01-09 15:51:50,093 INFO [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Trying to reconnect to JMS provider
| 2008-01-09 15:51:50,093 INFO [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Trying to reconnect to JMS provider
| 2008-01-09 15:51:50,093 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Reconnect failed: JMS provider failure detected:
| javax.naming.NameNotFoundException: XAConnectionFactory
| at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:223)
| at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:134)
| at sun.reflect.GeneratedMethodAccessor350.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:229)
| at $Proxy240.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:151)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245)
| at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:173)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:605)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1471)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-09 15:51:50,093 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Reconnect failed: JMS provider failure detected:
| javax.naming.NameNotFoundException: XAConnectionFactory
| at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:223)
| at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:134)
| at sun.reflect.GeneratedMethodAccessor350.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:229)
| at $Proxy240.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:151)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245)
| at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:173)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:605)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1471)
| at java.lang.Thread.run(Thread.java:595)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118436#4118436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118436
18 years, 3 months