HIBERNATE AND GWT

1 view
Skip to first unread message

yopein24

unread,
Mar 12, 2007, 4:30:16 AM3/12/07
to Google Web Toolkit
hi people!
I am trying to read from a database using hibernate and gwt and I
have some problems.
When I call the DAO to make the query, it works, and I can see the
results and print them, but when I return the result set to the
client, it says that there was an error (exception, to be precise).
The exception code is this:

[WARN] Exception thrown into JavaScript
java.lang.RuntimeException: Checked exception thrown into JavaScript
(web mode behavior may differ)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:
396)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.java:
283)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
127)
at
grid_package.client.DatabaseRS_TypeSerializer.deserialize(transient
source for grid_package.client.DatabaseRS_TypeSerializer:137)
at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:
85)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:
59)
at grid_package.client.DatabaseRS_Proxy$2.onCompletionImpl(transient
source for grid_package.client.DatabaseRS_Proxy:125)
at grid_package.client.DatabaseRS_Proxy
$2.onCompletionAndCatch(transient source for
grid_package.client.DatabaseRS_Proxy:114)
at grid_package.client.DatabaseRS_Proxy$2.onCompletion(transient
source for grid_package.client.DatabaseRS_Proxy:108)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
91)
Caused by: com.google.gwt.user.client.rpc.SerializationException:
grid_package.model.Tcuestionario/2507228039
at
grid_package.client.DatabaseRS_TypeSerializer.raiseSerializationException(transient
source for grid_package.client.DatabaseRS_TypeSerializer:134)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
91)
at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:
117)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
245)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:
155)
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:
117)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:
64)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:
493)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:
417)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:
365)

I dont know what is wrong, maybe the LONG type is not serializable?
Can u help me?

dominik_steiner

unread,
Mar 12, 2007, 4:49:15 AM3/12/07
to Google Web Toolkit
Hi yopein,

if your trying to send the Hibernate data object to the client, it
won't work, as it doesn't implement isSerializable. (and due to other
problems, eg GWT doesn't support Hibernate's PersitentList etc)

There are a lot of posts on this forum that discuss hibernate + GWT
integration. Eg this one

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/7d17db5977087c53/fc20fffbe40516e8?lnk=gst&q=hibernate&rnum=6#fc20fffbe40516e8

What I do here is mapping the hibernate data objects to client side
DTOs with the help of the framework dozer.

Have a look at the forums post regarding hibernate and if you still
are confused don't hesitate to write back here. :)

HTH

Dominik

Thiago Jamir

unread,
Mar 13, 2007, 1:45:59 PM3/13/07
to Google Web Toolkit
Dear yopein24,

I had a problem like yours.
In my case the problem happened because I had a class wich had a
Collection as an attribute. The GWT supports only java.lang and
java.util packages (correct me if I am wrong) and the Hibernate was
using a class that was not in those packages. So I set the Collection
class java.util.Vector and everything run fine.
Btw, I am also a beginner so I can't help you further.


Thiago

On 12 mar, 05:49, "dominik_steiner" <Dominik.Stei...@partner.bmw-


motorsport.com> wrote:
> Hi yopein,
>
> if your trying to send the Hibernate data object to the client, it
> won't work, as it doesn't implement isSerializable. (and due to other
> problems, eg GWT doesn't support Hibernate's PersitentList etc)
>
> There are a lot of posts on this forum that discuss hibernate + GWT
> integration. Eg this one
>

> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...


>
> What I do here is mapping the hibernate data objects to client side
> DTOs with the help of the framework dozer.
>
> Have a look at the forums post regarding hibernate and if you still
> are confused don't hesitate to write back here. :)
>
> HTH
>
> Dominik
>
> On 12 Mrz., 09:30, "yopein24" <yopei...@hotmail.com> wrote:
>
>
>
> > hi people!
> > I am trying to read from a database using hibernate and gwt and I
> > have some problems.
> > When I call the DAO to make the query, it works, and I can see the
> > results and print them, but when I return the result set to the
> > client, it says that there was an error (exception, to be precise).
> > The exception code is this:
>
> > [WARN] Exception thrown into JavaScript
> > java.lang.RuntimeException: Checked exception thrown into JavaScript
> > (web mode behavior may differ)
> > at
> > com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java­:
> > 396)
> > at

> > com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.­java:
> > 283)
> > at
> > com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.jav­a:


> > 127)
> > at
> > grid_package.client.DatabaseRS_TypeSerializer.deserialize(transient
> > source for grid_package.client.DatabaseRS_TypeSerializer:137)
> > at

> > com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deseria­lize(ClientSerializationStreamReader.java:
> > 85)
> > at
> > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readO­bject(AbstractSerializationStreamReader.java:


> > 59)
> > at grid_package.client.DatabaseRS_Proxy$2.onCompletionImpl(transient
> > source for grid_package.client.DatabaseRS_Proxy:125)
> > at grid_package.client.DatabaseRS_Proxy
> > $2.onCompletionAndCatch(transient source for
> > grid_package.client.DatabaseRS_Proxy:114)
> > at grid_package.client.DatabaseRS_Proxy$2.onCompletion(transient
> > source for grid_package.client.DatabaseRS_Proxy:108)
> > at
> > com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
> > 91)
> > Caused by: com.google.gwt.user.client.rpc.SerializationException:
> > grid_package.model.Tcuestionario/2507228039
> > at

> > grid_package.client.DatabaseRS_TypeSerializer.raiseSerializationException(t­ransient

> > Can u help me?- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -

Reply all
Reply to author
Forward
0 new messages