-->
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.  [ 1 post ] 
Author Message
 Post subject: Native SQL update - query not executing??
PostPosted: Thu Apr 21, 2005 5:48 am 
Beginner
Beginner

Joined: Tue Feb 01, 2005 8:38 am
Posts: 38
Hibernate version:
3.0 final.

Hi,

I am experiencing a problem whereby a native SQL exception does not execute. I have establised a java.sql.Connection by calling the Hibernate method, session.connection();. I then create a PreparedStatement from the connection and call executeUpdate() on it. Then the system just hangs indefinitely. I know this isn't really a Hibernate issue but it seems odd as regular JDBC works fine against the database. The only difference here is that I am establising the connection from the Hibernate session.

Has anyone else used this successfully? Perhaps there is something simple that I'm doing wrong.

Details below...


Mapping documents:
N/A

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

Code:
Session session = sessionFactory.openSession();

java.util.Date currentTime = new java.util.Date();

Connection c = session.connection();
PreparedStatement ps = c.prepareStatement("update USER set LAST_LOGIN = ? where USER_ID = ?");

ps.setDate(1, new java.sql.Date(currentTime.getTime()));
           
ps.setInt(iUserId);
log.debug("Executing statement...");
int iRowsUpdated = ps.executeUpdate();
log.debug(iRowsUpdated + " records updated in table USER");
           
session.disconnect();
session.close();



Full stack trace of any exception that occurs:
N/A

Name and version of the database you are using:
Oracle 8i


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

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.