-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate sess.update() not working properly...
PostPosted: Tue Jul 21, 2009 3:47 am 
Newbie

Joined: Tue Jul 21, 2009 3:29 am
Posts: 4
Hi, I'm getting prob. while working with Hibernate's update query...

Contact c = (Contact) session.get(Contact.class, new Long(2));
c.setId(44444);
c.setFirstName("Ram");
c.setLastName("Sri");
c.setEmail("vsrinivas8@gmail.com");
session.update(c);

I'm getting the following Exception for the above code:

org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at UpdateQuery_Hib.main(UpdateQuery_Hib.java:32)
Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:539)
at java.sql.DriverManager.getConnection(DriverManager.java:158)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 5 more


Top
 Profile  
 
 Post subject: Re: Hibernate sess.update() not working properly...
PostPosted: Tue Jul 21, 2009 11:10 am 
Newbie

Joined: Tue Jul 21, 2009 10:27 am
Posts: 4
Use saveorUpdate instead update


Top
 Profile  
 
 Post subject: Re: Hibernate sess.update() not working properly...
PostPosted: Wed Jul 22, 2009 3:21 am 
Newbie

Joined: Tue Jul 21, 2009 10:27 am
Posts: 4
First resolve your connection problem and use saveorUpdate


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