Results 1 to 7 of 7

Thread: Spring Batch 1.1.2 : Standard JPA does not support custom isolation levels - use a sp

  1. #1
    Join Date
    Jan 2008
    Posts
    14

    Default Spring Batch 1.1.2 : Standard JPA does not support custom isolation levels - use a sp

    Hi,

    Following migration to spring batch 1.1.2 which needed migration to spring 2.5.5, i am getting the following error on trying to run a sample job:

    job starts with parameters : PROPAGATION_REQUIRES_NEW,ISOLATION_SERIALIZABLE

    org.springframework.transaction.InvalidIsolationLe velException: Standard JPA does not support custom isolation levels - use a special JpaDialect for your JPA implementation

    Code:
    org.springframework.transaction.InvalidIsolationLevelException: 
    Standard JPA does not support custom isolation levels 
    - use a special JpaDialect for your JPA implementation
            at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:66)
            at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:330)
    org.hibernate.dialect.Oracle9Dialect is being used. Through spring version 2.0.x and 2.5.2.

    Hibernate version: 3.2.4.sp1

    Is the problem owing to the job starting up with ISOLATION_SERIALIZABLE transaction attribute.

    I am totally lost on what could have caused this. Thanks in advance for any help/ pointers.

  2. #2
    Join Date
    Aug 2004
    Posts
    1,107

    Default

    Try setting the "isolationLevelForCreate" on the JobRepositoryFactoryBean. I have used the following:

    Code:
          <property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/>
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  3. #3
    Join Date
    Jan 2008
    Posts
    14

    Default

    Hi Thomas,

    Thanks a lot for your response. The suggested configuration works.
    Just one question on the same.
    Is there any reason why spring batch framework was changed to start up jobs with ISOLATION_SERIALIZABLE as against ISOLATION_DEFAULT.
    Will overriding the same fail anything?

  4. #4
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    The create method on the repository could have issues if the same job instance is run by multiple processes, which an isolation of serializable helps with. However, if you have only one process launching jobs, there's no reason to worry about it.

  5. #5
    Join Date
    Jan 2008
    Posts
    14

    Default

    Hi Lucas,

    Thanks for the response. But if i keep the default setting ISOLATION_SERIALIZABLE without overriding the same, none of the existing Hibernate or spring Dialect classes seem to be able to lauch the job. Anything i have tried to google/spring forum on the same has resulted in a response which points at writing a custom Dialect and not call super.beginTransaction. Is that the only way? This probably is not a question for this forum. Sorry about that. I got no reponses on the data-access one related to the same query. Hence asking.

  6. #6
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    I'm not really sure what you can do. If you can't use an isolation of serializable because of issues with JPA, I would use default and code in logic into my application to make sure there are no potential issues when launching jobs.

  7. #7
    Join Date
    Jan 2008
    Posts
    14

    Default

    In that context i think the application currently handles the same to a safe extent. Will incorporate the ISOLATION_SERIALIZABLE in due time.
    Thanks a lot for all the responses.

    Regards,
    Bhramara

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •