-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with Session.Load
PostPosted: Thu Mar 02, 2006 1:45 pm 
Newbie

Joined: Thu Mar 02, 2006 11:54 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

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

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Hi guys,

Hi Iam Working in the Hibernate .Please help me out in this problem.

i am trying to update a record through hibernate by using session.load() method .i am passing my instance of the my Object. please see the below the code

public Object getObject(String sessionHandle,Object baseVO) throws MOESDBException{

Session session = (Session)sessionCache.get(sessionHandle);
if(session == null)
throw new DBException(ErrorConstants.DB_NO_SESSION_FND_ERROR);

return session.load(baseVO.getClass(),baseVO.getGroupID());

}

Here baseVO.getGroupID() is the primary Key
but my getObject Method is not able to return persisestence Object it returns null;

I am gettting ObjectNotFound Exception.Please Help Me out in this problems


regards
rajasekhar


Top
 Profile  
 
 Post subject: no record
PostPosted: Thu Mar 02, 2006 3:42 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
It is exactly what H tells you: there is no record with the given ID in the corresponding table.

/**
* Return the persistent instance of the given entity class with the given identifier,
* assuming that the instance exists.
* <br><br>
* You should not use this method to determine if an instance exists (use <tt>get()</tt>
* instead). Use this only to retrieve an instance that you assume exists, where non-existence
* would be an actual error.
*
* @param theClass a persistent class
* @param id a valid identifier of an existing persistent instance of the class
* @return the persistent instance or proxy
* @throws HibernateException
*/

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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