title: Object Not Found Exception in hibernate
body: <p>I am really stuck at this error</p>
  
  <pre><code>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.my.farmer.vo.crop.CropProfile#genus]
  at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:375)
  at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:145)
  at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:179)
  at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
  at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
  at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
  at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
  at org.hibernate.type.EntityType.resolve(EntityType.java:379)
  at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
  at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
  at org.hibernate.loader.Loader.doQuery(Loader.java:717)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
  at org.hibernate.loader.Loader.loadEntity(Loader.java:1851)
  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
  at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2992)
  at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
  at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
  at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
  at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:179)
  at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
  at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
  at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
  at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
  at org.hibernate.type.EntityType.resolve(EntityType.java:379)
  at org.hibernate.type.ComponentType.resolve(ComponentType.java:584)
  at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:275)
  at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1088)
  at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:553)
  at org.hibernate.loader.Loader.doQuery(Loader.java:689)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
  at org.hibernate.loader.Loader.doList(Loader.java:2211)
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
  at org.hibernate.loader.Loader.list(Loader.java:2090)
  at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
  at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
  at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
  at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
  at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
  at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:920)
  at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1)
  at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:405)
  at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:373)
  at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:911)
  at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:903)
  at com.my.farmer.dao.impl.MarketDAOHibernateImpl.fetchMarket(MarketDAOHibernateImpl.java:46)
  at com.my .farmer.bo.impl.MarketBOImpl.fetchMarket(MarketBOImpl.java:32)
  at com.my.farmer.service.impl.MarketServiceImpl.triggerAdvisory(MarketServiceImpl.java:32)
  at ClientSpringTester.main(ClientSpringTester.java:26)  
  </code></pre>
  
  <p>I have three classes crop, cropprofile and cropspecies.  </p>
  
  <pre><code>class crop{ cropId(PK), Cropprofile profile id (FK), Cropspecies speciesId(FK)  }  
  class cropprofile{ profileid(pk),  genus(unique),  family  }  
  class cropspecies{  speciesid(PK), Croprofile genus(FK) }    
  </code></pre>
  
  <p>To give you the exact source of error, I have   </p>
  
  <pre><code>class Marketfeed  {  
  Crop cropId,  
  Market marketId  }  
  </code></pre>
  
  <p>In market feed cropId and marketId are composite key. So, when I do a 
      .find(from Marketfeed market)<br>
  this error message error is generated. I am not using any search criteria.</p>
  
  <p>Can anybody suggest possible causes of this error?</p>