I am creating this join from one table to another
with the followin query:
Code:
select sale.storeName
from sale sale, storelocation sc
where sale.store_id = sc.store_id
and sale.storeLocId = sc.storeLocId
Code:
<many-to-one name="sale" class="com.dao.hibernate.sale" not-null="true">
<column name="store_id" />
<column name="storeLocId" />
</many-to-one>
in my store mapping i have the following:
Code:
<composite-id>
<key-property name="store_id" column="store_id" type="integer" />
<key-property name="storeLocId" column="storeLocId" type="string"/>
</composite-id>
I am creating this join from one table to another
with the followin query:
select sale.storeName
from sale sale, storelocation sc
where sale.store_id = sc.store_id
and sale.storeLocId = sc.storeLocId
<many-to-one name="sale" class="com.dao.hibernate.sale" not-null="true">
<column name="store_id" />
<column name="storeLocId" />
</many-to-one>
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.dao.Store#com.dao.Store@121cc66]
org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:128)
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:857)
org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
org.hibernate.type.EntityType.resolve(EntityType.java:303)
org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
org.hibernate.loader.Loader.doQuery(Loader.java:717)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
org.hibernate.loader.Loader.doList(Loader.java:2150)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
org.hibernate.loader.Loader.list(Loader.java:2024)
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298)
org.hibernate.impl.CriteriaImpl$Subcriteria.list(CriteriaImpl.java:143)