• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error: no session or session was closed

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<logic:iterate name="personList" id="person">

<logic:iterate name="person" property="events" id="ev">
name = <bean:write name="person" property="firstname"/>
<bean:write name="ev" property="title" />
</logic:iterate>

</logic:iterate>
<logic:iterate name="personList" id="person">

<logic:iterate name="person" property="events" id="ev">
name = <bean:write name="person" property="firstname"/>
<bean:write name="ev" property="title" />
</logic:iterate>

</logic:iterate>



This is what I am getting when I run my jsp with above code.

failed to lazily initialize a collection of role: com.hibernate.Personpersistence.Person.events, no session or session was closed
[1/7/09 8:46:27:859 EST] 00000039 LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.

I have lazy="false" in my hibernate mapping and I still get the above error

here is my mapping file

<hibernate-mapping>
<class name="com.hibernate.Personpersistence.Person" table="Person">
<id name="person_id" column="person_id">
<generator class="increment"/>
</id>

<property name="age"/>
<property name="lastname"/>
<property name="firstname"/>

<set name="events" table="PERSON_EVENTs" lazy="false">
<key column="PERSON_ID"/>
<many-to-many column="EVENT_ID" class="com.hibernate.eventpersistence.Event"/>
</set>


</class>
</hibernate-mapping>

 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you please post the code you use to obtain the Persion bean ?

a possible cause would be that you are using session.load() this will cause to load the proxy try using session.get()

let me know if it works

(peace)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic