EAR application with war (GWT) and JPA

305 views
Skip to first unread message

Kris

unread,
Feb 21, 2013, 7:33:20 PM2/21/13
to google-we...@googlegroups.com
I have a maven project consisting of a parent project with 3 modules. 

1. Modul is a GWT webapp. 
2. Modul is a jar module using session beans and Hibernate. called server module
3. Modules is module that builds the ear file ( maven-ear-plugin ) 

In the webapp I created a GWT gui than can create records in the database. 
It does that with an injected session bean from the server module. 

Second I can search for records in the database. 
This is also done vie the session bean. 
And here is the problem. 

I have a hibernate entity bean in the server module. Product
When searching the session bean returns a list of product beans to the GWT server implementation. 

The webapp knows about the product bean cause maven dependencies. 

I would like this list of products to be listed in the gui. 

But when compiling : 
No source code is available for type com.xx.yy.server.model.Product

Sure enough, the product bean in a maven dependency. 

I can of cause create a new product DTO in the webapp an convert the product bean to this product DTO... but that sounds stupid. 

Anyone got a good solution for this. 









Blaze

unread,
Feb 22, 2013, 9:08:26 AM2/22/13
to google-we...@googlegroups.com
Hi,

The compiler need to know the .java files(included in the gwt.xml and in the classpath) from your domains,
and if you dont like to create a dto you need to use the requestbuilder backed with the valueproxy and beanproxy...

I have one question, how you access the ear beans form the war? Using remote interfaces and jndi lookup or?!

Kara Marie Rawson

unread,
Feb 22, 2013, 9:12:56 AM2/22/13
to google-we...@googlegroups.com
you need to make sure you validate the beans using the JPA validation before GWT will use them. also when you deal with more complex enterprise scenerios like yours, GWT's server communication and factories for the the beans SUCK!. In fact they break often and do not handle proper json seriliazation of more complex structures. We had to implement our own RESTful interface using the more basic RPC service approach. We then pipe the json structures into an external java servlet project which has all fo our DTO and DAO. The gets around not habving to deal with the really frustrating bean validation that requires, yes requires you to include the source code. 


please note the refactored alot of this in v2.5 

prolly not exactly what your looking for, but meh its better then no response.

kara

Joseph Lust

unread,
Feb 22, 2013, 4:11:50 PM2/22/13
to google-we...@googlegroups.com
Kris,

Read the GWT Hibernate docs, they detail why you're having this problem and the solutions.


Sincerely,
Joseph

Kris

unread,
Feb 27, 2013, 4:47:32 PM2/27/13
to google-we...@googlegroups.com
I ended up with a solution where I in the GWT server implementation convert the Entity Bean class to a plain POJO that implements IsSerializable. 
Not the nicest solution :) 

Kris

Kara Marie Rawson

unread,
Feb 27, 2013, 6:36:46 PM2/27/13
to google-we...@googlegroups.com
Yes, you loose alot of extensiblity with that, but it is a very stable solution though. Also can be a little restricting when you start dealing with nested DAO objects

kara


--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/dhA7PxGfpJg/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.

To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages