Hibernate table name capitalization IFAS_util_max_object_v - mysql

I'm trying to setup my hibernate entity to auto create the table IFAS_util_max_object_v in that exact format. No matter what I try, I can't seem to get it to capitalize IFAS. Does anybody have any ideas?
This is what I've tried.
#Table(name="\"IFAS_util_max_object_v\"")
Also, I'm using mysql db.

What operating system are you using?
Mysql has a setting in the configuration file to determine if table names should be converted to lower case. As the tables correspond to files on the disk with the table name they are converted to lower case when using Windows as Windows file names are case insensitive. So it is impossible when using Windows.
You can read here about the details.

Related

How to use UPPER case in (existing) mySQL names in Windows

Does anyone know HOW I might preserve case in my table names please
(Win 10 using phpMyAdmin,latest xampp distribution). Could this be because xampp is using MariaDB instead of mySQL?
Table names being rewritten to all lowercase.
Read on phpMyAdmin site that to use preserve case I should add:
'set-variable=lower_case_table_names=0'
this stopped mySQL starting with an error message:
[ERROR] c:\xampp\mysql\bin\mysqld.exe: unknown variable 'set-variable=lower_case_table_names=0'
Then after reading an answer here I learned I should use lower_case_table_names=0so aded that to my.ini and still got the same error.
I then spent 20 mins trying to work out where my set-variable=lower_case_table_names=0 was set. (Thought it must be cached or duplicated or something.)
In desperation I deleted the lower_case_table_names=0 and the error disappeared. I put it back and got the
[ERROR] c:\xampp\mysql\bin\mysqld.exe: unknown variable 'set-variable=lower_case_table_names=0' error. IE they seem to be aliases with the error reporting translating. Somewhat irritating.
You should read the documentation bit more carefully, specifically identifier case sensitivity section.
In MySQL, databases correspond to directories within the data
directory. Each table within a database corresponds to at least one
file within the database directory (and possibly more, depending on
the storage engine). Triggers also correspond to files. Consequently,
the case sensitivity of the underlying operating system plays a part
in the case sensitivity of database, table, and trigger names. This
means such names are not case sensitive in Windows, but are case
sensitive in most varieties of Unix.
Value Meaning
0 Table and database names are stored on disk using the
lettercase specified in the CREATE TABLE or CREATE DATABASE statement.
Name comparisons are case sensitive. You should not set this
variable to 0 if you are running MySQL on a system that has
case-insensitive file names (such as Windows or OS X). If you force
this variable to 0 with --lower-case-table-names=0 on a
case-insensitive file system and access MyISAM tablenames using
different lettercases, index corruption may result. 1 Table names are
stored in lowercase on disk and name comparisons are not case
sensitive. MySQL converts all table names to lowercase on storage and
lookup. This behavior also applies to database names and table
aliases. 2 Table and database names are stored on disk using the
lettercase specified in the CREATE TABLE or CREATE DATABASE statement,
but MySQL converts them to lowercase on lookup. Name comparisons are
not case sensitive. This works only on file systems that are not case
sensitive! InnoDB table names are stored in lowercase, as for
lower_case_table_names=1.
To summarise: on windows you should not set lower_case_table_names to 0. If you want to preserve the letter case for table names on windows, then set lower_case_table_names to 2.
The using system variables section explains how to set a system variable in various ways.
Putting lower_case_table_names=2 in your my.ini files allows the use of upper and lower case in tabel names... BUT .... BIG BUT... it does NOT allow you to put upper case letters into EXISTING file names.
The solution is to COPY your table to a new table with the "correct" name.
However as this only changes the appearance of the table names (tables are stored in lower case files) you must use an intermediate table.
EG you want the table name to be HelloWorld but you discover it is stored as helloworld. Add the line above to your my.ini file then make a copy helloworld to a new table, say "helloTemp", delete helloworld copy helloTemp to HelloWorld delete helloTemp and you have a table with HelloWorld as the name.

mysql data free always zero(0)

I am using mysql workbench for mysql databases.
I created 2 tables to store files.i.e., "database" and "reports".
I used the same collation and engine for both tables.
But when I look in the table maintenance, "data free" for table-database is always 1Mib
but for table-reports is always 0.
Consequently when I try to download the file from the database, it downloads just 10bytes. I am quite sure my code to download file from the database is correct, since I am using the same code for the table-database, and its working perfectly, and not with table-reports (I know that for table-reports I need to change some parameters and field names).
Kindly solve the issue.

Force lowercase table names in Play Framework

On this one project I develop on Windows and deploy on Linux, and use mysql as database.
Because of the filesystem nature, table names (and more, I suppose) are case insensitive on windows, and sensitive on *nix [Ref]
Problem is, by default play/jpa uses the same name as the java model class for the table (so it is capitalized, eg. UserProfile). When I dump my windows mysql database it dumps lowercase table names.
Which means I can't import them in Linux because of the case sensitivity.
Is there a way to tell Play / JPA to always use lowercase names for the models?
Or must I set a #Table(name="userprofile") annotation on any single model?
You need to use a different naming strategy for hibernate. There is an improved NS available with hibernate
http://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/cfg/ImprovedNamingStrategy.html
you can simply add this line to application.conf
hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
Look also at this post and at this SO question

Is it possible to convert mysql table names from lowercase to uppercase in linux?

I imported a database from Windows to linux and all the tables names are in lowercase.
Is there a way to convert the mysql table names form lowercase to uppercase in linux?
Thanks a lot for any suggestion provided.
I am assuming you are addressing the table names in uppercase, which worked in Windows but no longer works on Linux because of case sensitivity.
You could rename each database. However, if you have access to the mySQL configuration, you should also be able to set --lower-case-table-names to 1.
I have no experience with the option, but according to the manual, it makes mySQL behave case-insensitively towards tables, as it does by default on Windows.

MySQL Lowercase Table Names in Windows Uppercase names on Unix

I have a a problem whereby my production server runs Unix and my dev server runs MS Windows.
The problem is that Windows is not case sensitive and Unix is. So my table set on the production server uses Uppercase table names ie "Customers" and on Windows the table names are in lowercase "customers".
All this is fine until you need to get data from one box to another and your SQL export says insert into "customers" in lowercase, and presto "Unkown table customers". Because the production server is currently on a shared hosting plan i cant change the settings and install the key that ignores case.
So my question, is there a way to get Windows to convert the tables back to the correct case or is there some setting I can include in the export SQL file so that i can upload data without this problem.
Thanks
UPDATE
Here is what I discovered for anybody else having this issue.
If you have already set up your tables running MySQL on Windows adding
lower_case_table_names=2 to your my.cnf or my.ini file will not change the case of your tables automatically even if they were originally created using uppercase or mixed case names.
CREATE TABLE "MyTable" will create a new table "mytable" not "MyTable" even when lower_case_table_names=2 is set in your my.cnf file.
To get around this problem use this method
Make a copy of your original table
Drop your original table
Rename your copy table using the correct case.
This is the only way it will work. Hope this helps somebody.
Taken from dev.mysql.com:
To avoid data transfer problems arising from lettercase of database or table names, you have two options:
Use lower_case_table_names=1 on all systems. The main disadvantage with this is that when you use SHOW TABLES or SHOW DATABASES, you do not see the names in their original lettercase.
Use lower_case_table_names=0 on Unix and lower_case_table_names=2 on Windows. This preserves the lettercase of database and table names. The disadvantage of this is that you must ensure that your statements always refer to your database and table names with the correct lettercase on Windows. If you transfer your statements to Unix, where lettercase is significant, they do not work if the lettercase is incorrect.
Exception: If you are using InnoDB tables and you are trying to avoid these data transfer problems, you should set lower_case_table_names to 1 on all platforms to force names to be converted to lowercase.
If you plan to set the lower_case_table_names system variable to 1 on Unix, you must first convert your old database and table names to lowercase before stopping mysqld and restarting it with the new variable setting.
There is one easy solution:
Always name your tablenames lowercase.
The universal guiding philosophy of Windows with respect to case is "case-insensitive, case stored". That means Windows never intends to discard your case, so it's a little mysterious why your tables on Windows are lower-case.
Apologies if this is a dumb question, but have you tried renaming the tables on the Windows machine so they have the correct case pattern?