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.
Alternative to JB Nizets answer is by specifying
@DiscriminatorColumn(length=100)
would provide a column that is long enough.
Use @DiscriminatorValue("some_short_name")
to all your subclasses. I don't think there is any other solution.
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