Skip to main content
13-Aquamarine
August 5, 2019
Question

select for update by QuerySpec

  • August 5, 2019
  • 1 reply
  • 1610 views

Hi all,

I want to know how to realize the function with QuerySpec or other measure same as SQL statement of "select for update".
I found "qs.setLock(true)" api, but according to TS it is unsupported api.

 

backgound:
Target class is created with Information Modeler to manage specific list of numbers. Stored numbers on the database table need to be exclusively used with WTPart each by each. So I want to update the column which means processed flag when a record is used. I think a record should be locked when it is extracted first.

1 reply

5-Regular Member
August 6, 2019

Hello,

good question!

Try this method:

com.ptc.core.percol.PersistedCollectionServerUtils.rowLockCollections(final WTSet holdersOrCollections)

 

 

shin1h13-AquamarineAuthor
13-Aquamarine
August 7, 2019

Hi fivigg,

 

Thank you for your reply.

 

Although I checked that method, it is package-private method.

Can I use it somehow?


I found below methods which are possible to be solution.
I still need to identify how would the exception ocurr if a row had been locked, though..

 

PersistenceHelper.manager.refresh(ObjectIdentifier objId, boolean lock)
or
PersistenceHelper.manager.refresh(Persistable obj, boolean fullRefresh, boolean inPlace, boolean lock)