Example usage for org.hibernate.tuple IdentifierProperty getName

List of usage examples for org.hibernate.tuple IdentifierProperty getName

Introduction

In this page you can find the example usage for org.hibernate.tuple IdentifierProperty getName.

Prototype

@Override
    public String getName() 

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 w w  w .j  av  a2  s  .co m*/
            }

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

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