Get the table name from the model in Hibernate

前端 未结 8 1892
名媛妹妹
名媛妹妹 2020-12-05 04:33

How do I get the table name for a model in Hibernate?

Apparently there used to be a getTableName() method in ClassMetadata, but it\'s been removed.

8条回答
  •  难免孤独
    2020-12-05 04:51

    If you're using the Table annotation you could do something like this:

    Table table = Entity.class.getAnnotation(Table.class);
    String tableName = table.name();
    

提交回复
热议问题