主要是为了在OneFeed里测试一下<table>

Lock Mode Description
OPTIMISTIC Obtain an optimistic read lock for all entities with version attributes.
OPTIMISTIC_FORCE_INCREMENT Obtain an optimistic read lock for all entities with version attributes, and increment the version attribute value.
PESSIMISTIC_READ Immediately obtain a long-term read lock on the data to prevent the data from being modified or deleted. Other transactions may read the data while the lock is maintained, but may not modify or delete the data. The persistence provider is permitted to obtain a database write lock when a read lock was requested, but not vice versa.
PESSIMISTIC_WRITE Immediately obtain a long-term write lock on the data to prevent the data from being read, modified, or deleted.
PESSIMISTIC_FORCE_INCREMENT Immediately obtain a long-term lock on the data to prevent the data from being modified or deleted, and increment the version attribute of versioned entities.
READ 来自JPA 1.0,OPTIMISTIC的同义词。
WRITE 来自JPA 1.0,OPTIMISTIC_FORCE_INCREMENT的同义词。
NONE 不加应用任何锁机制

可以通过多种途径设置锁,

EntityManager em = ...;
Person person = ...;
em.lock(person, LockModeType.OPTIMISTIC);

String personPK = ...;
Person person = em.find(Person.class, personPK, 
        LockModeType.PESSIMISTIC_WRITE);
        
String personPK = ...;
Person person = em.find(Person.class, personPK);
...
em.refresh(person, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

Query q = em.createQuery(...);
q.setLockMode(LockModeType.PESSIMISTIC_FORCE_INCREMENT);

@NamedQuery(name="lockPersonQuery",
  query="SELECT p FROM Person p WHERE p.name LIKE :name",
  lockMode=PESSIMISTIC_READ)        

其它参考

Locking and Concurrency in Java Persistence 2.0

kramdown的table语法

bootstrap的table样式