Weird GWT and OpenJPA problem

Posted by batman on Feb 27th, 2010
2010
Feb 27

I had the strangest problem the other day. I have a GWT app which uses Spring to load the backend beans – and this has always worked well. Recently I have added a servlet to this application, which provides an entrypoint into the system from another app (in a callback kinda way). Now this servlet needs to load my backend beans (DAO) using Spring, so as to effect changes to my database. I have full SHOW SQL logging on so that I can see every SQL statement that gets executed.

My problem – any kind of SELECT query works fine, retrieving the data as one would expect. However any UPDATE or INSERT just doesn’t happen – and here is the funny thing. No exceptions thrown whatsoever, nothing breaking, but also NO logging – it’s as if the framework just decided to skip the execution of these SQL statements (turns out this was exactly what was happening).

My thinking led me to transactions, and so I started investigating this – I had a @Transactional annotation on a method in my servlet, and it seems that this was the cause of my problems. As soon as I moved the method to a backend POJO bean with an annotated method – problem solved.

My understanding of it isn’t complete (I’m by no means a Spring expert), but I suspect it had something to do with the transaction boundaries being set in the backend layer and not the Service layer??? Please feel free to enlighten me 🙂

For the record, these are my project specs:

  • Windows XP
  • Tomcat 6.0.16
  • GWT 1.5
  • OpenJPA 1.1.0
  • Spring 2
  • Java 1.5

It had me baffled (for a while at least) – hope it can help someone else someday…

Technorati : , ,
Del.icio.us : , ,
Zooomr : , ,
Flickr : , ,

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit

Leave a Comment




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.