These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: I just upgraded to 3.1 rc2, and now have problems
PostPosted: Mon Oct 17, 2005 9:29 pm 
Newbie

Joined: Mon Oct 17, 2005 9:14 pm
Posts: 4
Hey Guys,

I have just upgrade from version 3.0.5 to 3.1 rc2, and now get a horrible stacktrace when I try to access the database through Hibernate.

Any ideas as to what would have changed to cause this?

The strange thing is that when I copy and paste the SQL from the stacktrace and try to run it through traditional JDBC, it runs perfectly. So that to me says that there is nothing wrong with the SQL being generated. But I can't explain this exception.

Hibernate version: Hibernate 3.1 rc2

Mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
   
<hibernate-mapping>

    <class name="com.cookgroup.common.valueobject.EWOVO" table="EWO" node="ewo" lazy="false">
        <id name="enumber" unsaved-value="undefined" node="@enumber">
            <column name="EWO" not-null="true" />
        </id>                  
        <property name="alphaCode" node="@alpha-code">
            <column name="ALPHA_CODE" />
        </property>
        <property name="createdBy" node="@created-by">
            <column name="CREATED_BY" />
        </property>
        <property name="createdDate" node="@created-date">
            <column name="CREATED_DATE" />
        </property>
        <property name="creationDate" node="@creation_date">
            <column name="CREATION_DATE" />
        </property>               
        <property name="creationTime" node="@creation_time">
            <column name="CREATION_TIME" />
        </property>               
        <property name="currency" node="@currency">
            <column name="CURRENCY" />
        </property>               
        <property name="custName" node="@cust-name">
            <column name="CUST_NAME" />
        </property>               
        <property name="custNumber" node="@cust-number">
            <column name="CUST_NUMBER" />
        </property>                 
        <property name="deviceType" node="@device-type">
            <column name="DEVICE_TYPE" />
        </property>             
        <property name="doctor" node="@doctor">
            <column name="DOCTOR" />
        </property>             
        <property name="instPlanned" node="@inst-planned">
            <column name="INST_PLANNED" />
        </property>                                                                             
        <property name="modificationDate" node="@modification-date">
            <column name="MODIFICATION_DATE" />
        </property>                                                                             
        <property name="modificationTime" node="@modification-time">
            <column name="MODIFICATION_TIME" />
        </property>                                                                             
        <property name="modifiedBy" node="@modified-by">
            <column name="MODIFIED_BY" />
        </property>                                                                             
        <property name="caseDate" node="@case-date">
            <column name="OP_DATE" />
        </property>                                                                             
        <property name="orderType" node="@order-type">
            <column name="ORDER_TYPE" />
        </property>                                                                             
        <property name="patient" node="@patient">
            <column name="PATIENT" />
        </property>
        <property name="patientDOB" node="@patient-dob">
            <column name="PATIENT_DOB" />
        </property>                                                                                                                       
        <property name="PONumber" node="@po-number">
            <column name="PO_IDE" />
        </property>                                                                             
        <property name="set" node="@set">
            <column name="SET_" />
        </property>                                                                             
        <property name="shipDate" node="@ship-date">
            <column name="SHIP_DATE" />
        </property>           
        <property name="status" node="@status">
            <column name="STATUS" />
        </property>           
        <property name="completionDate" node="@completion-date">
            <column name="COMPLETION_DATE" />
        </property>           
        <property name="version" node="@version">
            <column name="VERSION" />
        </property>
      <bag name="ewoComponents" lazy="false" >
         <key column="_PARENT"/>
         <one-to-many class="com.cookgroup.common.valueobject.EWOComponentVO"/>
      </bag>       
      <bag name="ewoInvoices" lazy="false" >
         <key column="_PARENT"/>
         <one-to-many class="com.cookgroup.common.valueobject.EWOInvoiceVO"/>
      </bag>                
    </class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

I am using Spring:

Code:
        HibernateTemplate hibernateTemplate = this.getHibernateTemplate();
        EWOVO item = null;
        item = (EWOVO) hibernateTemplate
                .execute(new HibernateCallback() {
                    public Object doInHibernate(Session session) {
                        Criteria criteria = session.createCriteria(EWOVO.class);
                        criteria.add(Expression.eq("enumber", enumber).ignoreCase());
                        return (EWOVO)criteria.uniqueResult();
                    }
                });

Full stack trace of any exception that occurs:
Code:
11:06:51,656 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
11:06:51,656 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
11:06:51,656 DEBUG [org.hibernate.SQL]
11:06:51,656 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement
11:06:51,703 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [/* criteria query */ select this_.CUST_NUMBER as CUST1_10_0_, this_.CUST_NAME as CUST2_10_0_, this_.CURRENCY as CURRENCY10_0_, this_.REG_DEVICES as REG4_10_0_, this_.BILL_ADDRESS_1 as BILL5_10_0_, this_.BILL_ADDRESS_2 as BILL6_10_0_, this_.BILL_SUBURB as BILL7_10_0_, this_.BILL_CITY as BILL8_10_0_, this_.BILL_STATE as BILL9_10_0_, this_.BILL_COUNTRY as BILL10_10_0_, this_.BILL_PCODE as BILL11_10_0_, this_.SHIP_ADDRESS_1 as SHIP12_10_0_, this_.SHIP_ADDRESS_2 as SHIP13_10_0_, this_.SHIP_ADDRESS_3 as SHIP14_10_0_, this_.SHIP_SUBURB as SHIP15_10_0_, this_.SHIP_CITY as SHIP16_10_0_, this_.SHIP_STATE as SHIP17_10_0_, this_.SHIP_COUNTRY as SHIP18_10_0_, this_.SHIP_PCODE as SHIP19_10_0_, this_.ACTIVITY_CODE as ACTIVITY20_10_0_ from CM this_ where this_.CUST_NUMBER=?]
java.sql.SQLException: [J0014] Return code is -1,202. No SQL text.
   at com.attunity.jdbc.NvSQLWarning.createSQLException(Unknown Source)
   at com.attunity.comm.Server.checkCallRetOld(Unknown Source)
   at com.attunity.navapi.QSpec.setQuery(Unknown Source)
   at com.attunity.navapi.QSpec.setQuery(Unknown Source)
   at com.attunity.jdbc.NvPreparedStatementBase.initPreparedStatement(Unknown Source)
   at com.attunity.jdbc.NvPreparedStatement.<init>(Unknown Source)
   at com.attunity.jdbc.NvConnectionBase.prepareStatement(Unknown Source)
   at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:312)
   at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:172)
   at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:431)
   at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:366)
   at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
   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:223)
   at org.hibernate.loader.Loader.doList(Loader.java:2147)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
   at org.hibernate.loader.Loader.list(Loader.java:2021)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1452)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298)
   at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:431)
   at com.cookgroup.common.dao.hibernate.CustomerHibernateDAO$1.doInHibernate(CustomerHibernateDAO.java:53)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:358)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:331)
   at com.cookgroup.common.dao.hibernate.CustomerHibernateDAO.findByCustNumber(CustomerHibernateDAO.java:48)
   at com.cookgroup.common.validator.CustomerValidator.validate(CustomerValidator.java:40)
   at com.cookgroup.enumber.web.serverjs.ENumberJS.validateCustomer(ENumberJS.java:394)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.metaparadigm.jsonrpc.JSONRPCBridge.call(Unknown Source)
   at com.metaparadigm.jsonrpc.JSONRPCServlet.service(Unknown Source)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
   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.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
   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:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:595)
11:06:51,703 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 14, SQLState:
11:06:51,703 ERROR [org.hibernate.util.JDBCExceptionReporter] [J0014] Return code is -1,202. No SQL text.
11:06:51,703 DEBUG [org.hibernate.jdbc.JDBCContext] after autocommit
11:06:51,703 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion
11:06:51,703 DEBUG [org.hibernate.impl.SessionImpl] closing session
11:06:51,703 DEBUG [org.hibernate.jdbc.ConnectionManager] closing JDBC connection [ (open PreparedStatements: 1, globally: 1) (open ResultSets: 0, globally: 0)]
11:06:51,703 DEBUG [org.hibernate.jdbc.JDBCContext] after transaction completion
11:06:51,703 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion
11:07:35,515 DEBUG [org.hibernate.jdbc.ConnectionManager] running Session.finalize()


Name and version of the database you are using: JBase 4.1 through Attunity 2.4

The generated SQL (show_sql=true): Yes

Debug level Hibernate log excerpt: Yes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:03 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try in simple hibernate environment (with HibernateUtil or like utility)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 7:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Good lord. Is there perhaps a way to setup "my favorite forum answers" (actually more like least favorite)?

I'll give you a hint. I know that you use an Interceptor. Oddly enough you do not mention an Interceptor. How did I know?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 8:22 am 
Newbie

Joined: Mon Oct 17, 2005 9:14 pm
Posts: 4
Hi Steve,

You are completely right about the Interceptor. Sorry that I didn't mention it.

I am at home at the moment, and my code is at work.

First thing tomorrow (when I get to work) I will start by taking the Interceptor out. See what I come up with. From there I will try to work out where the problem is by introducing the interceptor with limited functionality, until it breaks again.

Thanks for the hint, and I will let you know how I get on.

Damian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 8:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I can tell you where the problem is. You ported your Interceptor forward and just let your IDE choose an "appropriate" impl for the new onPrepareStatement() method. Your IDE, like any other IDE, simply chose to return null here. That is the source of the "no sql text".

Save yourself some trouble and have your Interceptor extend the EmptyInterceptor and just override the methods you are interested in.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 8:40 am 
Newbie

Joined: Mon Oct 17, 2005 9:14 pm
Posts: 4
Thanks mate,

That makes perfect sense. Again sorry about not mentioning the Interceptor, as they may have made it easier for to help me.

The way that you described how I ported my Interceptor forward, you were really on the money.

Thanks for your help.

Damian


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.