You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2007/05/02 15:28:08 UTC

Re: ROP, prePersist() and missing values

Hi Marcin,

this is not a bug, rather a limitation of the current ROP protocol.  
We need to improve it in this area to send back the server-end  
changes. Would you mind to log a Jira issue please? (although I  
vaguely recall we discussed it before... wonder if there's already a  
Jira?)

Andrus


On Apr 29, 2007, at 7:31 AM, Marcin Skladaniec wrote:
> 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
>
>
>