0

I'm developing an enterprise management system using: JS, Java 8.91, Tomcat 8.5.4 and MySQL 5.7.

The system has many databases:

  • Main Database that stores user's information(login, password, email and user's database name).

  • User's Database, stores user's company information. When an user signs up, Hibernate creates a new DB for the new User.

It works perfectly on Windows but when I test it on UbuntuServer 16.04 64x, some bugs/issues happens, Hibernate:

  • Duplicates almost every table from MainDB(example: it duplicates table "users". creates a new table "Users").
  • When hibernate creates User's DB, it mess with tables name(example: hibernate should create a table named "address", but it creates a table named "Address" instead).

Honestly I don't know what's happening, I never saw this before and I don't know how to solve it. Every help/tip will be appreciated.

RafaelHarth
  • 85
  • 1
  • 7
  • Please see [How to Ask](http://stackoverflow.com/questions/how-to-ask) and [The perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/). – Shaig Khaligli Aug 19 '16 at 14:47
  • which is the database collation on the operative systems? – Alejandra Aug 19 '16 at 14:56
  • @ShaigKhaligli, thanks for the links. This is my first question at StackOverFlow. – RafaelHarth Aug 19 '16 at 15:43
  • Do you use names for your tables? For example, @Table(name="users") @Entity public class Users { ... }. Database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix (http://stackoverflow.com/questions/6134006/are-table-names-in-mysql-case-sensitive) – Justinas Jakavonis Aug 19 '16 at 15:59
  • @Alejandra database collection is: utf8_general_ci – RafaelHarth Aug 19 '16 at 16:22
  • Both windows and Ubuntu using the same versions of MySQL? – Naros Aug 19 '16 at 16:42
  • @Naros, yes. MySQL version is the same. – RafaelHarth Aug 19 '16 at 17:27
  • @Justas, sorry for keeping you waiting. Yes but not at all classes... thats why hibernate duplicates table names. Thanks for that link, Justas. Solution(as super user): - cd /etc/mysql/mysql.conf.d - nano mysqld.cnf - under [mysqld], add this line: lower_case_table_names = 1 – RafaelHarth Aug 19 '16 at 17:50
  • Thanks for the support, guys. In the future, I'll be happy to help. – RafaelHarth Aug 19 '16 at 18:00

1 Answers1

0

Reference: Are table names in MySQL case sensitive?

Solution 1

  • sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
  • Under [mysqld], add this line: lower_case_table_names = 1
  • sudo service mysql restart

Solution 2

  • Make sure you named all classes using @Table. Example: @Table(name="your_table_name")
Community
  • 1
  • 1
RafaelHarth
  • 85
  • 1
  • 7