Hello Juan, thank you, did you find any bad side effect? Ops! I forgot to say I use EclipseLink and GWT 2.3.0.
Cristiano On 30 Giu, 20:49, Juan Pablo Gardella <gardellajuanpa...@gmail.com> wrote: > 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...>. > 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.