0

I have an entity :

@Entity
public class Client {
  .....

    @Version
    @Column(name="OPTLOCK")
    private long version;
}

Now Optimistic lock is always working, now each method can throw a ObjectStaleStateException BUT, if I want to make Optimistic just some certain method how can I do that ? I have 10 methods in my Service that use my Client entity, but I want to make Optimistic just one method from 10.

idmitriev
  • 4,619
  • 4
  • 28
  • 44

1 Answers1

1

What I understand from your question is, you want the locking feature to be used for specific service method.

As far as I know this is not possible.

If you go for pessimist locking you can explicitly pass lock mode.

VGaur
  • 705
  • 1
  • 9
  • 19