views:

23

answers:

1

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 the 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?

+1  A: 

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.

skaffman
Thank for your answer, I'm using xml config. I will be grateful if you tell me how can I configure this.
Diana
@Diana: See http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-namingstrategy @skaffman: +1
Pascal Thivent