Reputation: 1045
I have a custom persister which stores ZonedDateTimes as strings in my database. OrmLite is generating column definition VARCHAR(0)
which is invalid in PostgreSQL.
I need to specify a length but I am not sure the best way to do it.
I know I could do something like
@DatabaseField(columnName = "my_column",
persisterClass = MyCustomPersister.class,
columnDefinition = "VARCHAR(17)")
But I would have to do this for every declaration of a field with this datatype. That means that every field annotated with DatabaseField(persisterClass=MyCustomPersister.class) should always be in SQL a VARCHAR of length 17
Is there a way to fix this problem in the data persister?
Upvotes: 0
Views: 340
Reputation: 1045
It is enough with just overriding the method int getDefaultWidth();
in the data persister
Upvotes: 1