Example usage for org.hibernate.boot.model.naming ImplicitJoinColumnNameSource getNature

List of usage examples for org.hibernate.boot.model.naming ImplicitJoinColumnNameSource getNature

Introduction

In this page you can find the example usage for org.hibernate.boot.model.naming ImplicitJoinColumnNameSource getNature.

Prototype

public Nature getNature();

Source Link

Usage

From source file:com.example.ejb3.auction.NamingStrategy.java

License:Apache License

@Override
public Identifier determineJoinColumnName(ImplicitJoinColumnNameSource source) {
    if (source.getAttributePath() != null) {
        return toIdentifier((source.getNature() == ImplicitJoinColumnNameSource.Nature.ELEMENT_COLLECTION
                ? addUnderscores(transformEntityName(source.getEntityNaming()))
                : addUnderscores(source.getAttributePath().getFullPath())) + '_'
                + source.getReferencedColumnName().getText(), source.getBuildingContext());
    }//  w  w w . ja va2  s. co  m
    if (source.getNature() != ImplicitJoinColumnNameSource.Nature.ELEMENT_COLLECTION) {
        String name = transformEntityName(source.getEntityNaming()) + '_'
                + source.getReferencedColumnName().getText();
        return toIdentifier(addUnderscores(name), source.getBuildingContext());
    }
    return super.determineJoinColumnName(source);
}

From source file:org.ligoj.bootstrap.core.dao.ImplicitNamingStrategyNiceJpaImpl.java

License:MIT License

@Override
public Identifier determineJoinColumnName(final ImplicitJoinColumnNameSource source) {
    if (source.getNature() == ImplicitJoinColumnNameSource.Nature.ELEMENT_COLLECTION
            || source.getAttributePath() == null) {
        return source.getReferencedTableName();
    }//  w w  w .  j  a v a 2  s.  c  o  m
    return toIdentifier(transformAttributePath(source.getAttributePath()), source.getBuildingContext());
}