>From the output above, seems like you're missing @Transactional (or
XML configuration if thats what you're using) on one of your methods
that access database.

However, I would recommend you cheking out MyBatis data mapper (if
that's an option for you), I started using it recently instead of
Hibernate and found it much simpler. You do need to write some SQL
though... With MyBatis you don't have to use Gilead at all since it
returns plain POJOs that can be serialized, unlike Hibernate that
wraps POJOs.

Goran

On Mar 25, 1:23 pm, marky8264 <ti...@gmx.at> wrote:
> However, this is a lot of work or?
> You must create one DTO for one entity. If you have a lot of entites,
> it will be a lot of work.
> Is there another possibility to solve this serialization problem?
>
> On 25 Mrz., 10:46, Paul Robinson <ukcue...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I use DTOs rather than Gilead...I guess the gilead forums may be able to 
> > help.
>
> > On 24/03/11 17:51, marky8264 wrote:
>
> > > thanks for your answer.
> > > However, if i use a eager loading for the list, i will get this:
> > > Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
> > > 'org.hibernate.collection.PersistentBag' was not included in the set
> > > of types which can be serialized by this SerializationPolicy or its
> > > Class object could not be loaded. For security purposes, this type
> > > will not be serialized.: instance = []
> > >    at
> > > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
> > > 614)
> > >    at
> > > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
> > > 126)
> > >    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
> > > $ValueWriter$8.write(ServerSerializationStreamWriter.java:152)
> > >    at
> > > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:
> > > 534)
> > >    at
> > > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:
> > > 704)
> > >    at
> > > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
> > > 734)
> > >    at
> > > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
> > > 616)
> > >    at
> > > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
> > > 126)
> > >    at
> > > com.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(Map_CustomFieldSerializerBase.java:
> > > 52)
> > >    at
> > > com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serialize(HashMap_CustomFieldSerializer.java:
> > > 38)
> > >    ... 76 more
>
> > > Although i use Gilead, i get this exception. I thought that Gilead
> > > will clone the entity object and replace the hibernate collections
> > > with normal collections.
> > > Why do i get this exception?
>
> > > Is it possible that this is the reason:
> > > [...]
> > > 24 M�r 2011 16:43:38,695 DEBUG PersistentBeanManager: Not persistent
> > > object, merge is not needed : 1
> > > 24 M�r 2011 16:43:38,696 DEBUG GileadRPCHelper: Merge took 92 ms.
> > > 24 M�r 2011 16:43:38,979 TRACE HibernateUtil  : Exception during
> > > getCurrentSession
> > > org.hibernate.HibernateException: No Hibernate Session bound to
> > > thread, and configuration does not allow creation of non-transactional
> > > one here
> > >    at
> > > org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:
> > > 63)
> > >    at
> > > org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:
> > > 700)
> > >    at
> > > net.sf.gilead.core.hibernate.HibernateUtil.getCurrentSession(HibernateUtil.java:
> > > 1829)
> > >    at
> > > net.sf.gilead.core.hibernate.HibernateUtil.flushIfNeeded(HibernateUtil.java:
> > > 975)
> > >    at
> > > net.sf.gilead.core.PersistentBeanManager.clone(PersistentBeanManager.java:
> > > 227)
> > >    at
> > > net.sf.gilead.gwt.GileadRPCHelper.parseReturnValue(GileadRPCHelper.java:
> > > 157)
> > > [...]
>
> > > Here my gilead config:
> > >         <bean id="proxySerializer"
> > >            class="net.sf.gilead.core.serialization.GwtProxySerialization" 
> > > />
>
> > >    <bean id="proxyStore"
> > > class="net.sf.gilead.core.store.stateless.StatelessProxyStore">
> > >            <property name="proxySerializer" ref="proxySerializer" />
> > >    </bean>
>
> > >    <bean id="persistenceUtil"
> > > class="net.sf.gilead.core.hibernate.jpa.HibernateJpaUtil">
> > >            <property name="entityManagerFactory" 
> > > ref="entityManagerFactory" /
> > >    </bean>
>
> > >    <bean id="persistentBeanManager"
> > > class="net.sf.gilead.core.PersistentBeanManager">
> > >            <property name="proxyStore" ref="proxyStore" />
> > >            <property name="persistenceUtil" ref="persistenceUtil" />
> > >    </bean>
>
> > > On 24 Mrz., 18:31, Paul Robinson<ukcue...@gmail.com>  wrote:
> > >> Your collection is mapped as lazy, which means hibernate will load data 
> > >> on demand rather than up-front. However, you then try and access the 
> > >> collection outside a hibernate session, so it cannot do the load.
>
> > >> You should either load what you need inside the hibernate session, or 
> > >> make your collection be non-lazy.
>
> > >> On 24/03/11 14:50, marky8264 wrote:
>
> > >>> hey,
> > >>> I'm a newbie with these frameworks. Firstly i want to write a small
> > >>> web app with gwt for the frontend, spring for backend and jpa for the
> > >>> persistence operations. I use Hibernate as JPA implementation.
> > >>> I started with a simple construction (2 simply entities, 2 DAO,1
> > >>> remote service). I have no problems with this example. After i had
> > >>> extended the entities with lists, i got some problems with the lazy
> > >>> loading and serialization. Therefore i searched for solution and found
> > >>> the Gilead Framework.
> > >>> Now i have following problem:
> > >>> org.hibernate.LazyInitializationException: failed to lazily initialize
> > >>> a collection of role:<list attribute of my class>, no session or
> > >>> session was closed
> > >>>     at
> > >>> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:
> > >>> 383)
> > >>>     at
> > >>> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:
> > >>> 375)
> > >>> I don't understand the problem, because i marked the service method
> > >>> with @Transactional(propagation=Propagation.NESTED, readOnly=true).
> > >>> What is the cause of my problem?
> > >>> thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to