import javax.persistence.Table;
/**
* 通过获取类上的@Table注解获取表名称
*
* @param clazz
* @return
*/
public static Map<String, String> getTableName(Class<?> clazz) {
Map<String, String> map = new ConcurrentHashMap<>();
Table annotation = clazz.getAnnotation(Table.class);
String name = annotation.name();
String className = clazz.getSimpleName();
map.put("tableName", name);
map.put("className", className);
return map;
}
Hibernate获取@Table
最新推荐文章于 2021-07-07 14:20:34 发布