Announcement Announcement Module
Collapse
No announcement yet.
Spring Batch 1.1.2 : Standard JPA does not support custom isolation levels - use a sp Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Try setting the "isolationLevelForCreate" on the JobRepositoryFactoryBean. I have used the following:

    Code:
          <property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/>

    Comment


    • #3
      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?

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment


          • #6
            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.

            Comment


            • #7
              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

              Comment

              Working...
              X