Hibernate with GWT 1.4 RC

1 view
Skip to first unread message

Paulo

unread,
Jun 25, 2007, 10:14:28 AM6/25/07
to Google Web Toolkit
Hello!

I'm figthing a few days with hibernate and Pojos for integrate in GWT
client by RPC...
I generate the traditional pojos with Hibernate tools in Eclipse 3.2,
i parametrize the Set attributes, i make a junit test do see if
hibernate get the information to the pojo, everything ok.
When i try to integrate in the client, using the RPC, the subPojos
don't have any information...

ex:
public class POJOTest implements IsSerializable {
private long idDocente; //this have information
private String nome; //this have information
/**
*@gwt.typeArgs <java.util.Collection>
*/
private Set lectFichaUcs; //this don't have information

//getters and setters methods
...
}

So, can someone show me an example how to integrate direct Hibernate
with GWT 1.4RC, or say somethin how to fix that problem.

thanks

j3t

unread,
Jun 25, 2007, 10:45:55 AM6/25/07
to Google Web Toolkit
hi,

please post the error message!

have you define the model on the client side?

On 25 Jun., 16:14, Paulo <alves.paulohe...@gmail.com> wrote:
> Hello!
>
> I'm figthing a few days with hibernate and Pojos for integrate in GWT
> client by RPC...
> I generate the traditional pojos with Hibernate tools in Eclipse 3.2,
> i parametrize the Set attributes, i make a junit test do see if
> hibernate get the information to the pojo, everything ok.
> When i try to integrate in the client, using the RPC, the subPojos
> don't have any information...
>
> ex:
> public class POJOTest implements IsSerializable {
> private long idDocente; //this have information
> private String nome; //this have information
> /**

> *...@gwt.typeArgs <java.util.Collection>

Paulo

unread,
Jun 25, 2007, 11:11:47 AM6/25/07
to Google Web Toolkit
hi,
thanks for the interess.

The error is something like: "This application is out of date..."

regards

jdwyah

unread,
Jun 27, 2007, 8:05:37 AM6/27/07
to Google Web Toolkit
/**
*...@gwt.typeArgs <java.util.Collection>
*/

You have a Set of Collection objects? That seems a bit odd. You sure
you don't mean:

/**
*...@gwt.typeArgs <org.foo.MyObject>
*/


If you really have a set of sets of objects, you'd still need to
specify the inside type like:

/**
* @gwt.typeArgs <java.util.Set <org.foo.MyObject>>
*/

Not sure about that error message though..


fyi, for Hibernate you're still going to have to sort out changing
PersistentSet to HashSet & deal with CGLib proxies.

-jeff

Paulo

unread,
Jun 27, 2007, 9:22:13 AM6/27/07
to Google Web Toolkit
Ok, i fix, but now the pojo returns null, :(

Could you show me some Hibernate example with GWT client side?


amonbaz

unread,
Jun 28, 2007, 5:22:08 AM6/28/07
to Google Web Toolkit
I'm not sure I fully understood the problem. However, if you say it
works on the server side but arrives as null to the client, it might
be Hibernate's LAZY approach, which means that it actually retrieves
lists and sets only when needed (using a proxy). Make sure that the
object on the server side is filled with the set by marking this class
as not-lazy, or you can just try to do it using the debugger (when you
examine the set through the debugger it will retrieve it from the DB)
and see if it gets to the client side.
HTH.

rp16

unread,
Jun 28, 2007, 10:34:56 PM6/28/07
to Google Web Toolkit
Hi, I would like to know if it's mandatory to have the Hibernate pojo
in the same package as the GWT application?

Thanks

> > Could you show me some Hibernate example with GWT client side?- Hide quoted text -
>
> - Show quoted text -

Brill

unread,
Jun 29, 2007, 12:25:05 AM6/29/07
to Google Web Toolkit
You can't simple pass Hibernate pojo's via RPC because what the Pojo
seems to be and what it is are actually two very different things.
For the best solution for doing it, try http://hibernate4gwt.sourceforge.net/
it works, but there are still some problems (date/time types for one).

You are likely going to have to have two sets of objects, one for
client side and one for server side and copy them back and forth...
yes... it is a pain.

- Brill Pappin

On Jun 25, 10:14 am, Paulo <alves.paulohe...@gmail.com> wrote:
> Hello!
>
> I'm figthing a few days with hibernate and Pojos for integrate in GWT
> client by RPC...
> I generate the traditional pojos with Hibernate tools in Eclipse 3.2,
> i parametrize the Set attributes, i make a junit test do see if
> hibernate get the information to the pojo, everything ok.
> When i try to integrate in the client, using the RPC, the subPojos
> don't have any information...
>
> ex:
> public class POJOTest implements IsSerializable {
> private long idDocente; //this have information
> private String nome; //this have information
> /**

> *...@gwt.typeArgs <java.util.Collection>

Rob Jellinghaus

unread,
Jun 29, 2007, 12:42:42 AM6/29/07
to Google Web Toolkit
The Hibernate pojo has to be part of the GWT application SOMEHOW. I
have tried making a separate module to contain the objects I send via
GWT RPC. This works fairly well; the pojos can be in their own
package, and then both my GWT code and my server code include them.

However, these objects are data transfer objects (DTOs), not actual
Hibernate objects; my Hibernate objects are EJB3 objects (with lots of
Java 1.5 annotations) and hence GWT can't (yet) handle them.

http://unrealities.com/seamgwt has the example code I'm talking about.

Cheers!
Rob
--> http://robjsoftware.org

noon

unread,
Jun 29, 2007, 9:14:30 AM6/29/07
to Google Web Toolkit
Paulo, do you use the hibernate4gwt library ? If so, the collection is
set to null if it contains only lazy but not loaded elements. To solve
this, you have to explicitly fetch your collection in your Hibernate
query.
Furthermore, to share Hibernate POJO between server and client side,
you will have to declare the pojo package as a source folder in the
GWT xml configuration file.

About Hibernate and GWT integration issues, I wrote an article (not a
propaganda one, I also talk about DTO and Dozer ;-) ) at
http://hibernate4gwt.sourceforge.net/hibernate_gwt_problem.html

At last, concerning the Timestamp issue, I disagree with the GWT team
that classed the relevant RFE as low priority (http://code.google.com/
p/google-web-toolkit/issues/detail?id=87&can=2&q=) since it has no
workaround.
So I am working on porting this class by myself into the emulated JRE,
but it as a long and undocumented way...

Bruno

On 29 juin, 06:42, Rob Jellinghaus <rjellingh...@gmail.com> wrote:
> TheHibernatepojo has to be part of the GWT application SOMEHOW. I


> have tried making a separate module to contain the objects I send via
> GWT RPC. This works fairly well; the pojos can be in their own
> package, and then both my GWT code and my server code include them.
>

> However, these objects are data transfer objects (DTOs), not actualHibernateobjects; myHibernateobjects are EJB3 objects (with lots of


> Java 1.5 annotations) and hence GWT can't (yet) handle them.
>

> http://unrealities.com/seamgwthas the example code I'm talking about.


>
> Cheers!
> Rob
> -->http://robjsoftware.org
>
> On Jun 28, 7:34 pm, rp16 <pellerin.rich...@gmail.com> wrote:
>
> > Hi, I would like to know if it's mandatory to have theHibernatepojo
> > in the same package as the GWT application?
>
> > Thanks
>
> > On Jun 28, 5:22 am, amonbaz <amon...@gmail.com> wrote:
>
> > > I'm not sure I fully understood the problem. However, if you say it
> > > works on the server side but arrives as null to the client, it might

> > > beHibernate'sLAZY approach, which means that it actually retrieves


> > > lists and sets only when needed (using a proxy). Make sure that the
> > > object on the server side is filled with the set by marking this class
> > > as not-lazy, or you can just try to do it using the debugger (when you
> > > examine the set through the debugger it will retrieve it from the DB)
> > > and see if it gets to the client side.
> > > HTH.
>
> > > On Jun 27, 4:22 pm, Paulo <alves.paulohe...@gmail.com> wrote:
>
> > > > Ok, i fix, but now the pojo returns null, :(
>

> > > > Could you show me someHibernateexample with GWT client side?- Hide quoted text -

Reply all
Reply to author
Forward
0 new messages