If you use Hibernate as JPA2 provider, you can see an Hibernate Filter<http://books.google.com/books?id=OG816JSZYVcC&pg=PA159&lpg=PA159&dq=Hibernate+Filter+gwt&source=bl&ots=BM1HBLx_k5&sig=5silfT798yalPd_Vn4dEukahha0&hl=en&ei=Ud53TqjeDerh0QGDvoH3Cw&sa=X&oi=book_result&ct=result&resnum=5&ved=0CEcQ6AEwBA#v=onepage&q=Hibernate%20Filter%20gwt&f=false>implementation in this thread<http://groups.google.com/group/google-web-toolkit/browse_thread/thread/7e46e8c33e7ee5da?pli=1>. With this you don't need DTO objects.
2011/9/19 StrongSteve <[email protected]> > Hi Jens, > > Thanks for the quick reply. > > I have the creation of DTOs and the JPA query language in mind. Thanks > for pointing out. > Our DB-Accesses are very straight forward, so no really complex > queries. > > Just one more thing... Why is it important to have one EntityManager > instance per request? > What would the consequences be? If I am only allowed to have one > EntityManager from the top till deep down in the business logic maybe > it would be better to write a servlet filter and keep the > EntityManager as a ThreadLocal variable for this request... > > Greetings > Stefan > > On 19 Sep., 12:26, Jens <[email protected]> wrote: > > Should work.. just make sure you only have one EntityManager instance per > > request. I use a command pattern so I have one place where I can handle > the > > transaction (create transaction before command handler executes and > commit > > afterwards). But command pattern as well as DTO's leads to lots of > classes > > for a simple server request...don't know if I would choose it again > > (command, command result, command handler, JPA entity, DTO class, > possibly > > DAO class). Also JPA's query language (JPQL) does not support everything > > that native SQL supports so you have to keep that in mind (but sure you > can > > also execute native SQL queries with JPA if there is no other > possibility). > > > > Currently I am looking into myBatis (http://www.mybatis.org/) for a new > > projects. It uses native SQL and has some nice code generator support. > Maybe > > you should take a look at it, as you already have native SQL for a given > > database. > > > > -- J. > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
