• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Standard JPA and dead locks

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My app is using Struts2 + Spring + JPA (Standard). Currently the struts actions access service classes which return entities. All my service classes have Spring's @Transactional annotation on them. When more than one person uses the app lots of dead lock conflicts occur. This is really not cool.

I have tried changing the isolation levels for the transaction but I get an error saying that Standard JPA does not allow custom settings of isolation levels.

I have tried removing the annotation, which I really don't need but the quickstart app I based this one off of had it so I continued with it. Removing the annotation generated errors.

I tried removing the Spring bean for the transation manager. Surprise!... errors.

I don't really need transactions on these service classes. But I have not been able to find an alternative annotation. How is this supposed to be done in Standard JPA?
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like your database is defaulting to a serializable transaction isolation level, as you have noticed this is not good. You best solution is most likely to change you database transaction isolation default on your database (consult your database documentation or DBA). You may also be able to configure the default transaction isolation in your data-source configuration (in Spring or your JEE server if you are using one).

Otherwise what JPA implementation are you using? JPA does provide a <non-jta-data-source> element in the persistence.xml, on some JPA implementations, this may help. Some JPA implementations also provide a way to set the transaction isolation level.
 
Rusty Enisin
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah. I am using OpenJPA. I was not able to find any way to set it. Also, the way this is set up persistance.xml is not used.

I ran out of time looking for a solution, so I just slapped synchronize on to the methods and called it good for now. This is not a high traffic app, so that will hold for now.
 
Get off me! Here, read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic