[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7205) org.hibernate.ObjectNotFoundException while using Get
Sapan Bharucha (JIRA)
noreply at atlassian.com
Wed Mar 28 17:01:48 EDT 2012
org.hibernate.ObjectNotFoundException while using Get
-----------------------------------------------------
Key: HHH-7205
URL: https://hibernate.onjira.com/browse/HHH-7205
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Environment: Hibernate 3.5.1 and on Oracle 11
Reporter: Sapan Bharucha
Priority: Blocker
Get method in hibernate returns null if no row is found for given ID.
My understanding is that ObjectNotFoundException is thrown by hibernate while proxy returned by load is accessed and there is no row found for given ID. But i am getting this exception while using get(). Please let me know if any one you have faced this issue.
org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException: No row with the given identifier exists: [com.data.PersonDO#com.data.PersonId at 348515a3]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.data.PersonDO#com.data.PersonId at 348515a3]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:663)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:512)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:506)
.....................................
Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.data.PersonDO#com.data.PersonId at 348515a3]
at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:447)
at org.hibernate.event.def.DefaultLoadEventListener.returnNarrowedProxy(DefaultLoadEventListener.java:320)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:277)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:997)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:990)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:519)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
... 185 more
In my product we are using hibernate-core 3.5.1 and Spring 3.0.2.jar .
We are calling get method of Spring hibernate template .
We are calling hibernates session.get() method by using org.springframework.orm.hibernate3.HibernateTemplate.get(Class<Object>, Serializable)
public Object findObject(Class class, Serializable id) throws HibernateException {
return (Object) getHibernateTemplate().get(class, id);
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list