Just read the faq, and the solution became quite simple:
Code:
public boolean onSave( Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types ) throws CallbackException
{
return setModificationUser( propertyNames, state );
}
public boolean onFlushDirty( Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types ) throws CallbackException
{
return setModificationUser( propertyNames, currentState );
}
public boolean setModificationUser( String[] propertyNames,
Object[] currentState )
{
boolean dirty = false;
for( int i = 0; i < propertyNames.length; i++ )
{
if( "user".equals( propertyNames[ i ] ) )
{
currentState[ i ] = user;
dirty = true;
}
if( "ua".equals( propertyNames[ i ] ) )
{
currentState[ i ] = new SimpleDateFormat( "yyyy-MM-dd HH:mm" ).format( new Date() );
dirty = true;
}
}
return dirty;
}