// Check if nodeType exists and not mixin
NodeTypeDataManager nodeTypeDataManager = session.getWorkspace().getNodeTypesHolder();
NodeTypeData nodeType = nodeTypeDataManager.getNodeType(primaryTypeName);
if (nodeType == null)
throw new NoSuchNodeTypeException("Nodetype not found "
+ sysLocFactory.createJCRName(primaryTypeName).getAsString());
if (nodeType.isMixin())
throw new ConstraintViolationException("Add Node failed, "
+ sysLocFactory.createJCRName(primaryTypeName).getAsString() + " is MIXIN type!");