http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html

On Mon, May 18, 2009 at 12:51 PM, Mauricio Ferreyra <maur...@gmail.com>wrote:

> You are the man !! Matt! You are the man!!!
>
> Thank you very much!!
>
> But, What exactly thing do it?
>
>
>
>
> On Mon, May 18, 2009 at 3:36 PM, Matt Raible <m...@raibledesigns.com>wrote:
>
>> Have you tried uncommenting the LazyLoading filter in web.xml?
>>
>>
>> On Mon, May 18, 2009 at 12:20 PM, Mauricio Ferreyra <maur...@gmail.com>wrote:
>>
>>> Hi all,
>>>
>>> I've a problem when I'm mapping a List in a Object, Here's my mapping
>>>
>>> @Entity
>>> @Table(name = "articulos")
>>> public class Articulo implements Serializable {
>>>    @Id
>>>    @GeneratedValue(strategy = GenerationType.SEQUENCE)
>>>    @Column(name = "art_id")
>>>    private Long id;
>>>
>>>   @org.hibernate.annotations.CollectionOfElements(targetElement =
>>> FotoArticuloWeb.class,*fetch=**FetchType.EAGER)*
>>>    @JoinColumn(name = "art_id")
>>>    private List<Foto> fotos;
>>>
>>> /* Setters and Getters */
>>>
>>> }
>>>
>>> @Entity
>>> @Table(name = "fotos")
>>> public class FotoArticuloWeb implements Serializable {
>>>
>>>    @Id
>>>    @GeneratedValue(strategy = GenerationType.AUTO)
>>>    @Column(name = "fot_id")
>>>    private String fawCodigo;
>>>
>>>    /* Setters and Getters */
>>>
>>> }
>>>
>>>
>>> I think the problem is *FetchType.EAGER *but when I put   *FetchType.LAZY
>>> *and I want to use to Collection the follow exception is throw: *
>>> *
>>> ERROR [btpool0-1] LazyInitializationException.<init>(19) | *failed to
>>> lazily initialize a collection of role:
>>> com.allegra.micrositios.model.ArticuloWeb.fotos, no session or session was
>>> closed*
>>> org.hibernate.LazyInitializationException: failed to lazily initialize a
>>> collection of role: com.allegra.micrositios.model.ArticuloWeb.fotos, no
>>> session or session was closed
>>>     at
>>> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
>>>     at
>>> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
>>>     at
>>> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
>>>     at
>>> org.hibernate.collection.PersistentBag.size(PersistentBag.java:225)*
>>>
>>> *Some idea?*
>>>
>>> *Thanks in advance!
>>>
>>> Mauri.*
>>> *
>>
>>
>>
>

Reply via email to