I am facing the problem that the hibernate generated schema names (table names for example) differ between Windows and Linux. On Windows all table names are small case, e.g. account
, whereas under Linux created table names are camel cases, e.g. Account
.
On both systems I use MySQL 5 in the same version and the following hibernate config:
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<prop key="hibernate.bytecode.provider">cglib</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
What happens here? Basically I can live with that weird issue, but sometimes its annoying I cannot just export my tables from my windows IDE to my linux environment.
You might want to set the property hibernate.ejb.naming_strategy
to org.hibernate.cfg.ImprovedNamingStrategy
or implement your own naming strategy class.
Unfortunately, this is the way mysql works on case sensitive file systems (I had the same problem on Mac with the case "insenstive" filesystem). To solve this problem, you'll need to provide the name for the tables yourself.
For example
@Entity
@Table(name="user")
public class User implements Serializable {
...
}
The table name should be all in lower case! In this way, you can be sure that the table will be named properly by MySQL.
Jut to be very clear, the problem is not hibernate, but how mysql handles table names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With