code: private <X extends Class, T extends Object> void validateEntityAttributes(Object entity,
              KunderaMetadata kunderaMetadata)
      {
  
          EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
  
          MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                  entityMetadata.getPersistenceUnit());
          AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(entityMetadata.getEntityClazz());
  
          MetaModelBuilder<X, T> metaModelBuilder = kunderaMetadata.getApplicationMetadata().getMetaModelBuilder(
                  entityMetadata.getPersistenceUnit());
          EntityType entityType = (EntityType) metaModelBuilder.getManagedTypes().get(entityMetadata.getEntityClazz());
  
          
  
  
  
          // if managed type has any validation constraint present then validate
          // the attributes
         
          if (managedType.hasValidationConstraints())
          {
            
              Set<Attribute> attributes = entityType.getAttributes();
              Iterator<Attribute> iter = attributes.iterator();
  
              while (iter.hasNext())
              {
                  Attribute attribute = iter.next();
                 
                  Field f = (Field) ((Field) attribute.getJavaMember());
                  
                  //check if an embeddable field has a constraint
                  if (metaModel.isEmbeddable(attribute.getJavaType()))
                  {
                     
                      EmbeddableType embeddedColumn = (EmbeddableType) metaModelBuilder.getEmbeddables().get(attribute.getJavaType());
                      Object embeddedObject = PropertyAccessorHelper.getObject(entity,
                              (Field) entityType.getAttribute(attribute.getName()).getJavaMember());
                      
                      onValidateEmbeddable(embeddedObject, embeddedColumn);
                  }
                  this.factory.validate(f, entity, new AttributeConstraintRule());
  
              }
  
          }
  
      }
docs: Validates an entity object for CRUD operations
  
  @param entity
  Instance of entity object