Hej everybody
Thank you very much for your responses. I have got a lot of reading stuff from
you all (including Hibernate chapter 20 to do, and maybe I should buy a book
on Hibernate).
I solved the problem by setting lazy="false" like Enrique (see below if you
are a beginner like me).
OpenSessionInViewFilter did not work, but probably I made a mistake in the
url-pattern although I changed it to *.faces (and use the hibernate3
package). The challenge is that I have mixed code in my current project,
where some of the data is fetched using JDBC and the newest tiny part with
Hibernate. If a jsf-page is hit, which does not need data from Hibernate,
then the filter casts an exception due to a missing Hibernate session. But
this is just a configuration issue in web.xml ;-)
Regards ... Rick
<hibernate-mapping>
<class
name="dk.trafikstyrelsen.data.transfer.dto.railsecurity.danafile.ScanJourLink"
table="DANAFILE.SCANJOUR_LINK"
lazy="false">
<id name="id" type="long" column="ROW_ID">
<meta attribute="scope-set">protected</meta>
<generator class="sequence">
<param name="sequence">DANAFILE.SEQNUMBER</param>
</generator>
</id>
<version column="REVISION" name="revision" />
<property name="objId" type="string" not-null="true"/>
...
</class>
</hibernate-mapping>
Onsdag 31 august 2005 15:13 skrev Werner Punz:
> The opensessioninview filter comes with spring, somebody posted already
> a semi correct configuration (that one was for struts, you have to
> adjust the filter patterns for jsf)
>
> it is probably the easiest way you can get, to deal with lazy binding,
> it at least has solved many problems regarding the lazy flag in my
> current struts project and works perfectly.
>
> werner
>
> Rick Gruber-Riemer wrote:
> > You are right, I access the variable just in the same table in the next
> > column.
> > It seems to me, that I just have to get rid of all this lazy-stuff. Right
> > now I do not care whether this gives me some resourceproblems.
> >
> > How and where can I specify, that I want a session per database request?