I have a problem - I get an "Row size too large (> 8126)." error when trying to create my database table with Hibernate (I'm using the hibernate.hbm2ddl.auto property on "create" to do that).
The issue is that I have a few columns that are supposed to be TEXT, not VARCHAR. Apparently, the rows on these columns are too large and I get the above error.
The way I have Hibernate configured is using mapping files.
Here's how one of the mapped properties looks like:
<property name="transmission_current_range" type="java.lang.String" length="65535">
<column name="TRANSMISSION_CURRENT_RANGE"/>
</property>
Notice I set the length to 65535 in the hope that that will solve my problem, but it doesn't.
How do you tell Hibernate that you want this column to be a TEXT, not a VARCHAR? I've seen examples using adnotations, but I want to do the same using my mapping file.
Also, what's the corresponding java type for TEXT? I searched for this but I found only java.lang.String, which is the same data type used for both VARCHAR and TEXT, so it doesn't help.
EDIT: Apparently, this issue is not because I need to change the data into "TEXT" instead of "String, but because I have so many columns that each line (row) exceeds the limit of 8126.
I get this error, now:
"Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs"
EDIT2: Apparently, the reason for this error is the fact that I have so many columns that the line length becomes way too big. So it's not a matter of having TEXT instead of VARCHAR per se, but instead, I simply have too much "data" in terms of column length.
Changing the innodb_strict_mode = 0
in the mysql cfg file solved the problem, but when I let Hibernate create the database again, automatically, the columns created were BLOB, not their original data types (some of them still maintained to be their original data type).
This just as a heads up for anybody choosing my solution.