Example usage for org.hibernate.tuple.entity EntityBasedAssociationAttribute getAssociationNature

List of usage examples for org.hibernate.tuple.entity EntityBasedAssociationAttribute getAssociationNature

Introduction

In this page you can find the example usage for org.hibernate.tuple.entity EntityBasedAssociationAttribute getAssociationNature.

Prototype

@Override
    public AssociationNature getAssociationNature() 

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;
                }/*from  ww  w  . j a  v  a  2s . co m*/
            }

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

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