What is workaround for Select for update query in Hibernate?

Solution Verified - Updated -

Issue

  • Following is the issue description which can cause the problem

    • There is special kind of entity exists which has ID (primary key) field which is dependent on other fields of the table.

    • The ID field has some internal dependency on the other fields, which are being used to generate the next value for ID field.

    • For such id field, next value cannot be generated through sequence or through some auto-increment logic.

    • Simple SELECT FOR UPDATE query with JDBC APIs can be used to implement this logic but it may not work with clustered environment due to Database lock if multiple threads are trying to access same code.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 6.x
  • JBoss Hibernate
    • 3.x
    • 4.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content