boolean retval;
ExecutionContext ec = ownerSM.getExecutionContext();
try
{
ManagedConnection mconn = storeMgr.getConnection(ec);
SQLController sqlControl = storeMgr.getSQLController();
try
{
PreparedStatement ps = sqlControl.getStatementForUpdate(mconn, updateFkStmt, false);
try
{
int jdbcPosition = 1;
if (ecs.getElementInfo().length > 1)
{
DatastoreClass table = storeMgr.getDatastoreClass(element.getClass().getName(), clr);
if (table != null)
{
ps.setString(jdbcPosition++, table.toString());
}
else
{
NucleusLogger.PERSISTENCE.info(">> FKArrayStore.updateElementFK : " +
"need to set table in statement but dont know table where to store " + element);
}
}
if (owner == null)
{
JavaTypeMapping ownerMapping = ecs.getOwnerMapping();
ownerMapping.setObject(ec, ps, MappingHelper.getMappingIndices(jdbcPosition, ownerMapping), null);
jdbcPosition += ownerMapping.getNumberOfDatastoreMappings();
}
else
{
jdbcPosition = BackingStoreHelper.populateOwnerInStatement(ownerSM, ec, ps, jdbcPosition, ecs);
}
jdbcPosition = BackingStoreHelper.populateOrderInStatement(ec, ps, index, jdbcPosition, ecs.getOrderMapping());
if (ecs.getRelationDiscriminatorMapping() != null)
{
jdbcPosition = BackingStoreHelper.populateRelationDiscriminatorInStatement(ec, ps, jdbcPosition, ecs);
}
jdbcPosition =
BackingStoreHelper.populateElementInStatement(ec, ps, element, jdbcPosition, ecs.getElementMapping());
sqlControl.executeStatementUpdate(mconn, updateFkStmt, ps, true);
retval = true;
}
finally
{
sqlControl.closeStatement(mconn, ps);
}
}
finally
{
mconn.release();