cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Skladaniec <mar...@ish.com.au>
Subject ROP, prePersist() and missing values
Date Sun, 29 Apr 2007 04:31:53 GMT
Hello

In our application we utilise prePersist on server to update some  
information about the committed object (ie. createdOn), but there is  
a problem, the values set in the prePersist are not returned with the  
object to the client. Re-fetching the object gives all the correct  
values. Example:

on server prePersist :

public void prePersist() {
super.perPersist();
setCreatedOn(new Date());
}


on client:

Apple apple = (Apple) context.newObject(Apple.class);
logger.debug("before commit, created on : " + apple.getCreatedOn());
context.commitChanges();
logger.debug("after commit, created on : " + apple.getCreatedOn());
apple.setPersistenceState(PersistenceState.HOLLOW);
logger.debug("after refresh, created on : " + apple.getCreatedOn());

the output :

before commit, created on :null
after commit, created on :null
after refresh, created on :Sun Apr 29 14:21:25 EST 2007

Is that a bug ? We have caching turned off at the moment, so this  
should not be an issue. Also, I have not tested postPersist(),  
preUpdate() and postUpdate(), but I assume that it will be the same.
Marcin



Mime
View raw message