Reloading/Refreshing attributes of an persistent object
Since, all discussions on reloading/refreshing an persistent object somehow ended up on different topics. Therefore I'm trying to formulate it as simple as possible: What are the exact steps to refresh the attributes of a single persistent object without generating a new instance? - What settings have to be made in the class descriptor. - What methods of the persistence broker needs to be called. - Is it possible at all? - If it is not possible right now, will there be an option in the future and what could be a workaround for the moment. Thanks in advance, Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reloading/Refreshing attributes of an persistent object
Sebastian wrote: Since, all discussions on reloading/refreshing an persistent object somehow ended up on different topics. Therefore I'm trying to formulate it as simple as possible: What are the exact steps to refresh the attributes of a single persistent object without generating a new instance? - What settings have to be made in the class descriptor. - What methods of the persistence broker needs to be called. - Is it possible at all? - If it is not possible right now, will there be an option in the future and what could be a workaround for the moment. Thanks in advance, Sebastian The following seems to work, but I have no clue if it's the best way to reload an object: public void reload(Object obj) { ClassDescriptor cld = pb.getClassDescriptor(obj.getClass()); cld.setAlwaysRefresh(true); pb.getObjectByQuery(new QueryByIdentity(obj)); } Any comments? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reloading/Refreshing attributes of an persistent object
Sebastian wrote: The following seems to work, but I have no clue if it's the best way to reload an object: public void reload(Object obj) { ClassDescriptor cld = pb.getClassDescriptor(obj.getClass()); cld.setAlwaysRefresh(true); pb.getObjectByQuery(new QueryByIdentity(obj)); } Any comments? pb.retrieveAllReferences(obj); needs to be added ... that's what I'm using now: public void reload(Object ojb) { ClassDescriptor cld = pb.getClassDescriptor(rechnung.getClass()); synchronized (cld) { boolean refresh = cld.isAlwaysRefresh(); cld.setAlwaysRefresh(true); pb.getObjectByQuery(new QueryByIdentity(obj)); pb.retrieveAllReferences(obj); cld.setAlwaysRefresh(refresh); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]