开发者

Hibernate Uppercase

开发者 https://www.devze.com 2023-01-05 23:45 出处:网络
When I try to map a table in my database with a bean in my application using hibernate xml mapping files ...hbm.xml I obtein the fallowing resulteverytime I run the app:

When I try to map a table in my database with a bean in my application using hibernate xml mapping files ...hbm.xml I obtein the fallowing resulteverytime I run the app:

INFO: table not found: especies Initial SessionFactory creation failed.org.hibernate.HibernateException: Missing table: especies

I've realize th开发者_如何学运维e problem is that hibernate doesn´t recognize my table because I have it in lowercase in the db.

I realize about this because when I change the property hibernate.hbm2ddl.auto (placed in the hibernate.cfg.xml, I have it in validate mode) in create and drop mode it works because it create a new table all in uppercase(included column names) and let the old one in lowercase with no change.

I assume this is something about the hibernate conguration, so...

How can I change the hibernate configuration to understand my lowercase configuration of the db?


By default, Hibernate uses the DefaultNamingStrategy, which uses mixed-case database object names. This often doesn't work well. It provides an alternative called ImprovedNamingStrategy, which uses underscores rather than mixed case, which is often a better fit for the database.

How you configure this depends on your setup, but you haven't said if you're using annotations or XML config.

0

精彩评论

暂无评论...
验证码 换一张
取 消