Example usage for org.hibernate.boot.model.naming ImplicitEntityNameSource getEntityNaming

List of usage examples for org.hibernate.boot.model.naming ImplicitEntityNameSource getEntityNaming

Introduction

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

Prototype

public EntityNaming getEntityNaming();

Source Link

Document

Access to the entity's name information

Usage

From source file:com.devnexus.ting.core.hibernate.DevNexusSpringImplicitNamingStrategy.java

License:Apache License

@Override
public Identifier determinePrimaryTableName(ImplicitEntityNameSource source) {
    if (source == null) {
        // should never happen, but to be defensive...
        throw new HibernateException("Entity naming information was not provided.");
    }/*  w  w w  .jav  a2  s  . c  o  m*/

    String tableName = transformEntityName(source.getEntityNaming());

    if (tableName == null) {
        // todo : add info to error message - but how to know what to write since we failed to interpret the naming source
        throw new HibernateException("Could not determine primary table name for entity");
    }

    return toIdentifier(English.plural(tableName), source.getBuildingContext());
}