[Beankeeper-discussion] save method
Brought to you by:
demonsystem
From: Shay M. <mat...@gm...> - 2009-03-02 14:41:36
|
Hi, the following is taken form form the Save Jdoc, i belive that the description should be expended,please see my questions inline : Save the given object to the store. The given object's all private non-transient fields will be saved. If the object was not selected from the store, and not yet saved, it will be created in the store, and a unique id will be assigned, so all subsequent calls to save the given object will only modify the already existing instance in store. A few tips: 1) only private fields ? what about public and protected? 2) the existence or no existence of accessors methods does not affect the library at all? * Use simple beans. Although this library does not scan methods to determine the attributes to save, it is a good idea to simplify work with them. 3) what do you mean by simple? for example i am using the XMLRootElement annotation, and i implement numerous interfaces , should i avoid it? 4) if the library does not use reflection how does it get the list of fields? * If you do not use simple beans, watch out that your object does not reference unnecessary objects, because if it does, all will be saved/inserted and tracked. 5) i assume that marking such objects as transient will address that? * You CAN use objects which reference other beans though. But beware, that all objects which are directly referenced will be loaded when the parent object loads. 6) can you expend on the above? * You CAN use Map, and List types in your beans. Check the documentation. some samples on what not do and best practices, would probably be helpful. hopefully anybody that reads my posts , will get a some hints ,on what not to do :) Thanks, Shay |