tak to bohuzel netusim, nemam s timhle praktickou ani teoretickou zkusenost :(

Ivan Polák wrote:
interceptor je namapovany takto:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
       <property name="interceptors">
           <list>
               <ref bean="openSessionInViewInterceptor"/>
           </list>
       </property>
      <property name="mappings">
....
      </property>
</bean>

Tomas Vojtech  wrote / napísal(a):
napada me zkusit nastavit singleSession na true

jinak by chtelo upresnit kdy se tento interceptor pouziva, je naveseny na metody servisnich trid? v pripade ze je naveseny na volani servisni metody a na kolekci sahate az mimo tu metodu tak bude session nejspis zavrena

Ivan Polák wrote:
toto pouzivam:

<beans>
<bean name="openSessionInViewInterceptor" class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
       <property name="sessionFactory">
           <ref bean="sessionFactory"/>
       </property>
       <property name="singleSession">
           <value>false</value>
       </property>
   </bean>
</beans>


Tomas Vojtech  wrote / napísal(a):
V dobe kdy se pokousite ziskat data z kolekce je jiz session uzavrena a proto to skonci vyjimkou, v pripade webove aplikace by to melo vyresit pouziti filtru, ktery na zacatku requestu otevre session a uzavre ji az na konci zpracovani, takze pak je session otevrena celou dobu zpracovani a nemelo by to padat, v pripade pouziti springu je mozne pouzit OpenSessionInViewFilter ktery toto dela

Ivan Polák wrote:
zdravim,

pouzivam hibernate a v objekte A mam List objektov typu B:

@OneToMany(mappedBy = "objektB", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
   @JoinColumn(name = "fk_b_id")
   private List<B> objektyB;

ako vidiet hore pouzivam Lazy loading, ked nacitam objekt A:

A objektA = objektAManager.getA(id-cko);

natahujem objekt pomocou funkcie:

getHibernateTemplate().get

teda je jasne ze List objektov premenna objektyB nie je nacitany.

ako dosiahnem nacitanie "dotiahnutie" aj premennych typu List (pripadne inych collections) v objekte A.

vypisuje to nasledovnu chybu:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.freightservice.model.Shipper.shipperLicenceCertificateParameters, no session or session was closed


dakujem

Ivan



__________ Information from ESET Smart Security, version of virus signature database 2886 (20080219) __________

The message was checked by ESET Smart Security.

http://www.eset.com








__________ Information from ESET Smart Security, version of virus signature database 2886 (20080219) __________

The message was checked by ESET Smart Security.

http://www.eset.com








__________ Information from ESET Smart Security, version of virus signature database 2886 (20080219) __________

The message was checked by ESET Smart Security.

http://www.eset.com




Odpovedet emailem