JavaEE anottation in a POJO and compile dose pojo to JS objects

23 views
Skip to first unread message

Blaze

unread,
Oct 19, 2012, 9:46:16 AM10/19/12
to google-we...@googlegroups.com
HI all,

I have one question:

      I like to use JPA EJB(actually its already done) backend and now to create a JS UI with gwt.
      The problem comes when I want to use the domain pojo-s as a dto-s for the RPC because of the javax.persistance.*
      annottaions in the pojo-s, the compiler asks for the source code when compailing to JS objects.

      What would be the best solution to this?

      1. I can create a new plain pojos from the old jpa domain pojos with exactly the same fields. Will alwasy work, but this looks like a overwork for noting, also in the project Ill send a list      of 5-6000 pojos to the frontend, so Ill lose a O(n) time to recriate the new DTO-s.

      2. If try to include the source code for javax.persistance.*  will this work? Has someone tried this? I think most of them are having RETENTION=RUNTIME so the compiler shoud totaly dont care about them..but..

Any idea or expiriance on this?

Tnx,
Blaze
 

Jens

unread,
Oct 19, 2012, 10:15:27 AM10/19/12
to google-we...@googlegroups.com
Simply add the annotations to the classpath of GWT compiler and it should work. They won't compile to JS but the compiler needs them to load you client side classes. Also I guess you need everything on classpath that your annotations reference.

The real issue you may have is that JPA providers enhance your server JPA pojos and that can break serialization (e.g. a java.util.List will become a jpa.provider.LazyList after enhancement and GWT does not know LazyList).

-- J.

Blaze

unread,
Oct 19, 2012, 10:24:36 AM10/19/12
to google-we...@googlegroups.com
Hi Jens,

Thank for the replay first!

My queston was more on the part dose this would be compiled if I add the source code for the anottation.
For the Lazy classes this is normal. Ill have to use the real lists not the Lazy. But I dont think Ill transfare that big trees of objects.

Ill give it a try...so will se what happens..:)

B
Reply all
Reply to author
Forward
0 new messages