I use this approach and I preferr to RF, is more simple. But you need something in the middle to pass jpa classes with proxies (if you use Hibernate).
I use the approach mentioned in this thread<http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/41abe949b4104817?fwc=1&pli=1>. No DTO, no Gilead. I will share the code soon. 2011/6/30 Cristiano <cristiano.costant...@gmail.com> > Hello All, > > While searching for instructions and best practices for using GWT and > JPA, I see everywhere guides suggesting to create 2 different bean > classes, a JPA Entity for handling on the server-side the persistence > on the database, and a DTO for exchange between the servlet and the > browser... > These guides suggest that GwtRpcService interface uses the DTO bean in > the method signature, and in the GwtRpcService implementation, the DTO > has to be transformed to the Entity bean so to persist it on the DB. > > > I have instead developed a test application where I have only one > single bean, placed in the client folder and annotated with JPA's > @Entity, and I exchange it within my RPC service interface. > This way it is elegant as I do not have to handle to different classes > and convert them, and from my test, it is simple and it seems to _be > working fine_. > > Anyone can give me good reasons why I shouldn't follow this > approach? > > To be noted that someone says that to follow this approach, > RequestFactory should be used instead of RPC service... why? > > > Here the significant information about my test project: > > the GWT module is net.cristcost.test.jpa.TestJpa.gwt.xml, > the GWT client package (<source path="client" />) is > net.cristcost.test.jpa.client, > the bean is net.cristcost.test.jpa.client.MyBean; > the RPC Service interface is > net.cristcost.test.jpa.client.MyBeanManagerService; > the RPC Service implementation is > net.cristcost.test.jpa.server.MyBeanManagerServerImpl; > > the RPC service has these two methods: > public void addBean(MyBean bean); > public List<MyBean> getBeans(); > > And here the relevant lines of the bean: > -------------------------------------------- > package net.cristcost.test.jpa.client; > > // imports... > > @Entity > @SuppressWarnings("serial") > @Table(name="my_beans", schema="jpa_test") > public class MyBean implements Serializable { > @Id > @Column(name="id") > @GeneratedValue(strategy=GenerationType.IDENTITY) > private Integer id; > > @Column(name="object") > private String object; > > @Column(name="subject") > private String subject; > > // ... class continues with getter and setters ... > } > -------------------------------------------- > > Thanks, > Cristiano > > -- > 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. > > -- 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.