Monday, July 27, 2009


Before, we put @Version on the LAST_MODIFIED_DATE and openjpa will automatically populate it with the current system time (from that JVM). It is ok in a simple environment.

But when our project is deployed in some enterprise environment, which has clustered application servers, each server may have different time or time zone. It is not good to populate the LAST_MODIFIED_DATE which is from each JVM.

The solution is that we added a listener for that domain object instead of @Version. The listener will be triggered before insert/update is happening.  The listener get the current time from a centralized time service server.

No comments:

Post a Comment