// Is the context now with an identity? in which case we need to insert
if (ctx.getId() != null)
{
BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
lock.sync(); // lock all access to BeanLock
try
{
// Check there isn't a context already in the cache
// e.g. commit-option B where the entity was
// created then removed externally