You can use:
EntityManager.lock(Object entity, LockModeType type);
to lock an existing entity using READ or WRITE lock.
You can use native query like SELECT * FROM X FOR UPDATE.
Or Query.setHint(TopLinkQueryHints.PESSIMISTIC_LOCK, PessimisticLock.Lock); which uses FOR UPDATE internally.
Or as mentioned you can use optimistic locking. I personally avoid optimistic locking.
If you use hibernate as JPA provider, then hint will be different.
[Message sent by forum member 'jarol1' (jarol1)]
http://forums.java.net/jive/thread.jspa?messageID=270828