Example usage for org.hibernate.tuple NonIdentifierAttribute isInsertable

List of usage examples for org.hibernate.tuple NonIdentifierAttribute isInsertable

Introduction

In this page you can find the example usage for org.hibernate.tuple NonIdentifierAttribute isInsertable.

Prototype

public boolean isInsertable();

Source Link

Usage

From source file:com.github.kuros.random.jpa.metamodel.AttributeProvider.java

License:Open Source License

private List<String> getSupportedAttributeNames(final SingleTableEntityPersister singleTableEntityPersister) {
    final EntityMetamodel entityMetamodel = singleTableEntityPersister.getEntityMetamodel();
    final NonIdentifierAttribute[] properties = entityMetamodel.getProperties();
    final List<String> attributeNames = new ArrayList<String>();
    for (NonIdentifierAttribute property : properties) {
        if (property.isInsertable()) {
            if (property instanceof EntityBasedAssociationAttribute) {
                final EntityBasedAssociationAttribute entityBasedAssociationAttribute = (EntityBasedAssociationAttribute) property;
                if (!(entityBasedAssociationAttribute
                        .getAssociationNature() == AssociationAttributeDefinition.AssociationNature.ENTITY)) {
                    continue;
                }//w w w . j a  va 2s .  c om
            }

            attributeNames.add(property.getName());
        }
    }

    final IdentifierProperty identifierProperty = entityMetamodel.getIdentifierProperty();
    attributeNames.add(identifierProperty.getName());
    return attributeNames;
}