Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dtype column is too short to hold class name

I have some long name classes which I store in the database using Hibernate.
I've noticed that hibernate creates the dtype column (for inheritance support) as character varying(31).
Since the class name is longer than 31 characters the insert fails.
What is the best way to resolve it?
Since I have lots of classes I prefer some global setting over adding annotation to each class.

like image 426
Avner Levy Avatar asked Feb 11 '13 11:02

Avner Levy


2 Answers

Alternative to JB Nizets answer is by specifying

@DiscriminatorColumn(length=100)

would provide a column that is long enough.

like image 197
DataNucleus Avatar answered Sep 24 '22 09:09

DataNucleus


Use @DiscriminatorValue("some_short_name") to all your subclasses. I don't think there is any other solution.

like image 44
JB Nizet Avatar answered Sep 21 '22 09:09

JB Nizet