* @param ownerSM the current StateManager
*/
public void postInsert(StateManager ownerSM)
{
Object value = ownerSM.provideField(fmd.getAbsoluteFieldNumber());
StateManager sm = null;
if (value != null)
{
sm = ownerSM.getObjectManager().findStateManager(value);
if (sm == null || sm.getObjectManager().getApiAdapter().getPersistenceManager(value) == null)
{
// Assign a StateManager to the serialised object since none present
sm = StateManagerFactory.newStateManagerForEmbedded(ownerSM.getObjectManager(), value, false);
sm.addEmbeddedOwner(ownerSM, fmd.getAbsoluteFieldNumber());
}
}
if (sm != null)
{
sm.setStoringPC();
}
// Generate the contents for the BLOB
byte[] bytes = new byte[0];
if (value != null)
{
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(value);
bytes = baos.toByteArray();
}
catch (IOException e1)
{
// Do Nothing
}
}
// Update the BLOB
OracleBlobRDBMSMapping.updateBlobColumn(ownerSM, getDatastoreContainer(), getDataStoreMapping(0), bytes);
if (sm != null)
{
sm.unsetStoringPC();
}
}