As we know, Hibernate uses version or timestamp columns to implement optimistic locking mechanism which is the default one.
In book “Hibernate in Action”, it says
Quote:
If you don't have version or timestamp columns, Hibernate can still perform optimistic locking, but only for objects that are retrieved and modified in the same Session. If your need optimistic locking for detached objects, you must use a version number or timestamp.
I am confused here. For example, after I retrieve an object from database, the object’s state persistent. So optmistic locking should work here. If I call evict(), close(), or clear(), the object becomes detached. Can I still implement optimistic locking for this detached object which is persistent before?