Node node = mainCache.getNodeFromCache(nodeId, this);
// if node is not in persistence cache or is dirty, fetch from database
if (node == null || node.isDirty())
{
node = new Node(nodeId, entityClass, new ManagedState(), getPersistenceCache(), primaryKey, this);
node.setClient(getClient(entityMetadata));
// TODO ManagedState.java require serious attention.
node.setPersistenceDelegator(this);
try