-->
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.  [ 8 posts ] 
Author Message
 Post subject: No ResultSet set was produced.
PostPosted: Wed Feb 25, 2004 2:43 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Exception in saving object.
Code:
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]No ResultSet set was produced.


Hibernate debug log:
Code:
2004-02-25 14:42:47,757(2140) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - about to open: 0 open PreparedStatements, 0 open ResultSets

2004-02-25 14:42:47,757(2140) [main] DEBUG net.sf.hibernate.SQL  - insert into de_purchase_order (PO_NO, INVOICE_NO, ORDER_DATE, CUSTORMS_DECLARATION_NO) values (?, ?, ?, ?) select SCOPE_IDENTITY()

Hibernate: insert into de_purchase_order (PO_NO, INVOICE_NO, ORDER_DATE, CUSTORMS_DECLARATION_NO) values (?, ?, ?, ?) select SCOPE_IDENTITY()

2004-02-25 14:42:47,789(2172) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - preparing statement

2004-02-25 14:42:47,882(2265) [main] DEBUG net.sf.hibernate.persister.EntityPersister  - Dehydrating entity: [com.dealeasy.ems.monitor.table.DePurchaseOrderModel#<null>]

2004-02-25 14:42:47,882(2265) [main] DEBUG net.sf.hibernate.type.StringType  - binding '111' to parameter: 1

2004-02-25 14:42:47,929(2312) [main] DEBUG net.sf.hibernate.type.StringType  - binding '222' to parameter: 2

2004-02-25 14:42:47,929(2312) [main] DEBUG net.sf.hibernate.type.TimestampType  - binding null to parameter: 3

2004-02-25 14:42:47,929(2312) [main] DEBUG net.sf.hibernate.type.StringType  - binding null to parameter: 4

2004-02-25 14:42:47,929(2312) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - done closing: 0 open PreparedStatements, 0 open ResultSets

2004-02-25 14:42:47,945(2328) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - closing statement

2004-02-25 14:42:47,945(2328) [main] DEBUG net.sf.hibernate.util.JDBCExceptionReporter  - SQL Exception

java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]No ResultSet set was produced.

   at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

   at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

   at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)

   at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)

   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508)

   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)

   at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)

   at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)

   at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)

   at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:757)

   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)

   at com.dealeasy.ems.monitor.dao.DePurchaseOrderDAO.add(DePurchaseOrderDAO.java:35)

   at com.dealeasy.ems.monitor.business.PurchaseOrder.addPO(PurchaseOrder.java:77)

   at com.dealeasy.ems.monitor.business.TestPurchaseOrder.testAddPO(TestPurchaseOrder.java:62)

   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:324)

   at junit.framework.TestCase.runTest(TestCase.java:154)


What is the problem? Exception occur when call session.save. Database is MSSQL 2000


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 3:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yeah, it looks like there is a problem with this stuff with MS driver. Try either

(1) enabling hibernate.jdbc.use_get_generated_keys
(2) overriding SQLServerDialect.appendIdentitySelectToInsert() to return null


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 3:33 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Quote:
(1) enabling hibernate.jdbc.use_get_generated_keys

Do you mean config "hibernate.jdbc.use_get_generated_keys true"?
In my version h2.1rc1, hibernate.properties doesn't include it. I find it in hibernate.properties of h2.1.2. How to do in h2.1rc1? Or must I update to h2.1.2?
Quote:
(2) overriding SQLServerDialect.appendIdentitySelectToInsert() to return null

I don't understand your meaning. Do you mean I should write a class extends SQLServerDialect and overwrite this method?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 5:39 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
It doesn't work when I set "hibernate.jdbc.use_get_generated_keys true" in hibernate.properties.
I download a new MSSQL jdbc driver from microsoft: http://www.microsoft.com/downloads/details.aspx?FamilyID=9f1874b6-f8e1-4bd6-947c-0fc5bf05bf71&DisplayLang=en
And update SQL Server to sp3a.
Exception:
Code:
java.lang.AbstractMethodError: com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;

   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:324)

   at net.sf.hibernate.util.GetGeneratedKeysHelper.prepareStatement(GetGeneratedKeysHelper.java:39)

   at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:246)

   at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)

   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:524)

   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)

   at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)

   at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)

   at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)

   at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:757)

   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)

   at com.dealeasy.ems.monitor.dao.DePurchaseOrderDAO.add(DePurchaseOrderDAO.java:35)

   at com.dealeasy.ems.monitor.business.PurchaseOrder.addPO(PurchaseOrder.java:77)


If I set "#hibernate.jdbc.use_get_generated_keys true" , Exception:
Code:
2004-02-25 17:38:50,804(2219) [main] DEBUG net.sf.hibernate.SQL  - insert into de_purchase_order (PO_NO, INVOICE_NO, ORDER_DATE, CUSTORMS_DECLARATION_NO) values (?, ?, ?, ?) select SCOPE_IDENTITY()

2004-02-25 17:38:50,804(2219) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - preparing statement

2004-02-25 17:38:51,054(2469) [main] DEBUG net.sf.hibernate.persister.EntityPersister  - Dehydrating entity: [com.dealeasy.ems.monitor.table.DePurchaseOrderModel#<null>]

2004-02-25 17:38:51,054(2469) [main] DEBUG net.sf.hibernate.type.StringType  - binding '111' to parameter: 1

2004-02-25 17:38:51,101(2516) [main] DEBUG net.sf.hibernate.type.StringType  - binding '222' to parameter: 2

2004-02-25 17:38:51,101(2516) [main] DEBUG net.sf.hibernate.type.TimestampType  - binding null to parameter: 3

2004-02-25 17:38:51,101(2516) [main] DEBUG net.sf.hibernate.type.StringType  - binding null to parameter: 4

2004-02-25 17:38:51,476(2891) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - done closing: 0 open PreparedStatements, 0 open ResultSets

2004-02-25 17:38:51,476(2891) [main] DEBUG net.sf.hibernate.impl.BatcherImpl  - closing statement

2004-02-25 17:38:51,492(2907) [main] DEBUG net.sf.hibernate.util.JDBCExceptionReporter  - SQL Exception

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'id', table 'ems_monitor.dbo.de_purchase_order'; column does not allow nulls. INSERT fails.

   at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

   at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

   at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)

   at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)

   at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)

   at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)

   at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)

   at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)


Same code is right in Oracle.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 5:55 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Is "hibernate.jdbc.use_get_generated_keys true" need JDBC 3 support?
I don't think the sql server jdbc driver support JDBC 3.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 1:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Are you using 2.1.2? This might be the same problem as described here: http://forum.hibernate.org/viewtopic.php?t=928086


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 11:48 pm 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Yes, I use version 2.1.2. I am not use JDTS(even I don't know what it is).
Code:
hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
hibernate.connection.url jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ems_monitor
hibernate.connection.username sa
hibernate.connection.password sa

I download the newest MSSQL jdbc driver (11/6/2003) provided by Microsoft and update Sql server 2000 to sp3a. I found the patch is for "SQL Server 2000 via JTDS ". Are you sure it would be effiect for me?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 4:36 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
I use the patch, but it has still Exception.
Code:
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Can't start a cloned connection while in manual transaction mode.


I tried two ways to store data.
One is I config cascade="none", And I store child object by myself.
obj is an instance of parent table.
Code:
      Session s = super.currentSession();
      s.save(obj);
      s.flush();
      Set children = ((DePurchaseOrderModel)obj).getPoLines();
      Iterator iter = children.iterator();
      while (iter.hasNext()){
         DePurchaseOrderLineModel lineModel = (DePurchaseOrderLineModel)iter.next();
         s.save(lineModel);
         s.flush();
      }


It throws Exception in storing the second child.

The other way is cascade="save-update", .
obj is an instance of parent table.
Code:
      Session s = super.currentSession();
      s.save(obj);
      s.flush();


It throws Same Exception on executing s.save(obj);.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.