About Question enthuware.oce-jpad.v6.2.366 :

Moderator: admin

Post Reply
unvector
Posts: 18
Joined: Sun Jun 21, 2015 2:56 am
Contact:

About Question enthuware.oce-jpad.v6.2.366 :

Post by unvector »

Hi,

could you clarify explanation to option 2? I think these statements:
it must throw the PersistenceException
and
it is possible that Persistence exception will be thrown but not necessarily
are in conflict.

admin
Site Admin
Posts: 8802
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.366 :

Post by admin »

No, they are not. The first statement is talking about a general rule about non-versioned object. If an entity is non-version and if the container doesn't support locking for it, then it must throw PersistenceException.
The second statement is talking about a possibility because a container may choose to support locking on a non-versioned object and in that case there will be no exception. In this question, we don't know whether the container supports it or not and therefore we don't know for sure if there will be an exception.
If you like our products and services, please help us by posting your review here.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.366 :

Post by himaiMinh »

In option 3 explanation:
The issue of version check arises only when you request a pessimistic lock.
I think version check also arises when we request an optimistic lock.
So, OptimisticLockException can be thrown in this case em.lock(obj, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests