PluginDbServiceImpl.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:lider 作者:
/**
 * Returns the table name for a given entity type in the
 * {@link EntityManager}.
 * 
 * @param entityClass
 * @return
 */
public <T> String getTableName(Class<T> entityClass) {
    /*
     * Check if the specified class is present in the metamodel. Throws
     * IllegalArgumentException if not.
     */
    Metamodel meta = entityManager.getMetamodel();
    EntityType<T> entityType = meta.entity(entityClass);

    // Check whether @Table annotation is present on the class.
    Table t = entityClass.getAnnotation(Table.class);

    String tableName = (t == null) ? entityType.getName().toUpperCase() : t.name();
    logger.debug("Table name found: {}", tableName);
    return tableName;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号