public void store ( Object obj , ObjectModification mod ) throws PersistenceBrokerException { obj = extractObjectToStore ( obj ) ; // null for unmaterialized Proxy if ( obj == null ) { return ; } ClassDescriptor cld = getClassDescriptor ( obj . getClass ( ) ) ; // this call ensures that all autoincremented primary key attributes are filled Identity oid = serviceIdentity ( ) . buildIdentity ( cld , obj ) ; // select flag for insert / update selection by checking the ObjectModification if ( mod . needsInsert ( ) ) { store ( obj , oid , cld , true ) ; } else if ( mod . needsUpdate ( ) ) { store ( obj , oid , cld , false ) ; } /* arminw TODO: Why we need this behaviour? What about 1:1 relations? */ else { // just store 1:n and m:n associations storeCollections ( obj , cld , mod . needsInsert ( ) ) ; } }
Makes object obj persistent in the underlying persistence system . E . G . by INSERT INTO ... or UPDATE ... in an RDBMS . The ObjectModification parameter can be used to determine whether INSERT or update is to be used . This functionality is typically called from transaction managers that track which objects have to be stored . If the object is an unmaterialized proxy the method return immediately .