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.  [ 1 post ] 
Author Message
 Post subject: No row with the given identifier exists exception
PostPosted: Mon Mar 03, 2008 1:07 pm 
Newbie

Joined: Sat Feb 16, 2008 10:17 am
Posts: 1
I'm getting strange exception:

Quote:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [server.hb.Wlasnosc#server.hb.Wlasnosc@995153a]


when i try to list criteria:
Quote:
Criteria crit = ses.createCriteria(grInh ,"g")
Criteria.LEFT_JOIN)
.createAlias("g.rightsTo", "grights", Criteria.LEFT_JOIN)
.createAlias("g.grupyNadrz", "gnadrz", Criteria.INNER_JOIN)
.createAlias("gnadrz.rightsTo", "gnadrzRights", Criteria.LEFT_JOIN);

if (grId != null)
crit.add(Expression.idEq(grId));

if (grNadrzId != null) {
crit.add(Expression.eq("gnadrz.grId", grNadrzId))
.add(Expression.not(Expression.eq("g.grId", new Long(1))));
}

crit.add(Expression.disjunction()
.add(Expression.eq("gnadrzRights.wlasnosc", 'T'))
.add(Expression.eq("gnadrzRights.udostepnione", 'T')))
.add(Expression.disjunction()
.add(Expression.eq("gnadrzRights.grupaHasRight", userHasRight))
.add(Expression.in("gnadrzRights.grupaHasRight", userHasRight.getGrupyNadrz())))
.add(Expression.disjunction() //grupa jest elemntarna lub nie
.add(Expression.conjunction()
.add(Expression.eq("g.elementarny", 'T'))
.add(addPerm(upr, Expression.disjunction(), "gnadrzRights")

.add(Expression.conjunction()
.add(addPerm(upr, Expression.disjunction(), "grights"))
.add(Expression.disjunction()
.add(Expression.eq("grights.grupaHasRight", userHasRight))
.add(Expression.in("grights.grupaHasRight", userHasRight.getGrupyNadrz()))))))
.add(Expression.conjunction()
.add(Expression.eq("g.elementarny", 'F'))
.add(Expression.eq("grights.udostepnione", 'T'))));
crit.list();


userHasRight is object evicted from session (after eager fetch grupyNadrz collection).

my hibernate mappings:
Grupa.hbm.xml

Quote:
<hibernate-mapping>
<class name="server.hb.Grupa" table="Grupa" >
<id
name="grId"
column="grupa_id"
type="long">

<generator class="native" />
</id>

<property name="nazwaGr"
column="nazwa_grupy"
type="string"/>

<property name="typGrId"
column="typ_grupy_id"
type="long" />

<property name="dataOstMod"
column="data_ost_modyf"
type="date" />

<property name="ostModUser"
column="ost_modyf"
type="long" />

<property name="elementarny"
type="char" />

<property name="dataUtworz"
column="data_utworzenia"
type="date" />

<property name="isMovable"
column="is_movable"
type="char"
/>

<set name="akcje" table="Akcja_user">
<key column="grupa_id" />
<many-to-many column="akcja_id" class="server.hb.Akcja" />
</set>

<set name="grupyNadrz" table="Grupa_w_grupie">
<key column="grupa_id" />
<many-to-many column="grupa_nadrz" class="server.hb.Grupa" />
</set>

<set name="grupyPotomne" table="Grupa_w_grupie" >
<key column="grupa_nadrz" />
<many-to-many column="grupa_id" class="server.hb.Grupa" />
</set>

<set name="rights" table="Wlasnosc" >
<key column="grHasPerm" />
<one-to-many class="server.hb.Wlasnosc" />
</set>

<set name="rightsTo" table="Wlasnosc" >
<key column="grupa_id" />
<one-to-many class="server.hb.Wlasnosc"/>
</set>



</class>
</hibernate-mapping>


Wlasnosc.hbm.xml:
Quote:
<hibernate-mapping>
<class name="server.hb.Wlasnosc" table="Wlasnosc" >
<composite-id>
<key-many-to-one name="grupa"
column="grupa_id"
class="server.hb.Grupa" />
<key-many-to-one name="grupaHasRight"
column="grHasPerm"
class="server.hb.Grupa"/>
</composite-id>

<property name="udostepnione" type="char" />
<property name="odczyt" type="char" />
<property name="zapis" type="char" />
<property name="wykonanie" type="char" />
<property name="wlasnosc" type="char" />
<property name="wygasa" type="date" />

</class>
</hibernate-mapping>

when I list this criteria hibernate generate sql (which is expected) :
Quote:
...................................
from
Grupa this_
left outer join
Users this_1_
on this_.grupa_id=this_1_.user_id
inner join
Grupa_w_grupie grupynadrz5_
on this_.grupa_id=grupynadrz5_.grupa_id
inner join
Grupa gnadrz2_
on grupynadrz5_.grupa_nadrz=gnadrz2_.grupa_id
left outer join
Users gnadrz2_1_
on gnadrz2_.grupa_id=gnadrz2_1_.user_id
left outer join
Wlasnosc gnadrzrigh3_
on gnadrz2_.grupa_id=gnadrzrigh3_.grupa_id
left outer join
Wlasnosc grights1_
on this_.grupa_id=grights1_.grupa_id
where
gnadrz2_.grupa_id=?
and not (this_.grupa_id=?)
and (
gnadrzrigh3_.wlasnosc=?
or gnadrzrigh3_.udostepnione=?
)
and (
gnadrzrigh3_.grHasPerm=?
or gnadrzrigh3_.grHasPerm in (
?
)
)
and (
(
this_.elementarny=?
and (
gnadrzrigh3_.odczyt=?
or gnadrzrigh3_.wykonanie=?
or (
(
grights1_.odczyt=?
or grights1_.wykonanie=?
)
and (
grights1_.grHasPerm=?
or grights1_.grHasPerm in (
?
)
)
)
)
)
or (
this_.elementarny=?
and grights1_.udostepnione=?
)
)

and unexpected one:
Quote:
select
wlasnosc0_.grupa_id as grupa1_5_0_,
wlasnosc0_.grHasPerm as grHasPerm5_0_,
wlasnosc0_.udostepnione as udostepn3_5_0_,
wlasnosc0_.odczyt as odczyt5_0_,
wlasnosc0_.zapis as zapis5_0_,
wlasnosc0_.wykonanie as wykonanie5_0_,
wlasnosc0_.wlasnosc as wlasnosc5_0_,
wlasnosc0_.wygasa as wygasa5_0_
from
Wlasnosc wlasnosc0_
where
wlasnosc0_.grupa_id=?
and wlasnosc0_.grHasPerm=?


Can anyone give me help/hint about this problem i tried almost anything.
Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.