hibernate: create table with names in lowercase

冷暖自知 提交于 2020-01-24 05:27:03

问题


Hibernate: I want to have hibernate automatically generate my tables with names in lowercase.

For example, if my class is called com.myapp.domain.Customer, hibernate will generate a table named Customer. I want it to be called customer. I know I can use the @Table annotation to specify the table name per class. But I want it to happen "automagically".


回答1:


Isn'it it the job for NamingStrategy?

You would get the name of the entity managed (i.e. Customer) and should decide the table name used (entityName.toLowerCase() in your case).

One thing I am not sure is if the NamingStrategies are taken into account when generating tables (hbm2ddl).



来源:https://stackoverflow.com/questions/1657119/hibernate-create-table-with-names-in-lowercase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!