Oops, sorry for the large attachment. I hope it wouldn't clog anyone's mail server...
On Fri, Aug 27, 2010 at 2:14 PM, Taro App <[email protected]> wrote: > Yes, I may not have enough time to write up a blog entry, I'll just > attach the demo here. It's a war file with the source code. Should > work on Java 1.6 + Tomcat 6.0. Libraries used are: > > - Hibernate 3.5.5 (with Annotation & JPA) > - Apache Derby 10.6.1.0 (Embeded, In Memory) > - JUnit 4.8.2 > and of course, Apache Pivot 1.5.1 QueryServlet! > > jpaqueryservlet.servlet.ContactQueryServlet extends QueryServlet to > provide CRUD services for Contact data, which only has id, last name, > first name and version for optimistic locking. ContactQueryServlet > makes calls to ContactDao, and ContactDao uses JPA for database > access. Hibernate provides the underlining database work for JPA, as > configured in persistence.xml. ContactDao is a bit overly complex for > the purpose of this demo, but it uses JPA generic DAO pattern. > OpenEntityManagerInViewFilter, a servlet filter, provides > open-session-in-view pattern, which may also be a bit overly complex > for the purpose. Derby database is started and shutted down by > DerbyManagerListener, a servlet context listener. ContactWsTest is the > class to test the web service. > > apptaro > > > > On Thu, Aug 26, 2010 at 9:25 PM, Greg Brown <[email protected]> wrote: >> Nice! Can we see it, or do we have to wait for the blog entry? :-) >> >> On Aug 26, 2010, at 7:14 AM, Taro App wrote: >> >>> Hi Greg, >>> >>> I made a simple demo with QueryServlet/Hibernate/JPA and JUnit test. >>> I'll clean up some more and will publish it on my blog. >>> >>> apptaro >>> >>> >>> >>> On Thu, Aug 26, 2010 at 11:41 AM, Greg Brown <[email protected]> wrote: >>>> It occurred to me earlier this evening that QueryServlet might make a good >>>> REST-based front end to Hibernate or some other Java-based ORM tool. >>>> However, I don't have a lot of experience with ORMs - the DB apps I have >>>> written have generally used JDBC directly. >>>> >>>> Anyone with Hibernate knowledge care to comment (or possibly write up a >>>> simple demo to test the theory)? I think an example that retrieves a bean >>>> from the DB and uses JSONSerializer to write it back out to the caller >>>> would be very cool. I'd be happy to help with such an example if anyone is >>>> interested. >>>> >>>> G >>>> >>>> >> >> >
