Hello i am using ORMLite 4.33.
I have an entity class that gives me an error when trying to destroyTable:
E/AndroidRuntime(6715): java.lang.IllegalArgumentException: Field class
java.lang.String for field FieldType:name=udm,class=Prodotti is not valid
for data persister com.j256.ormlite.field.types.EnumStringType@40a3a2e0
here is the class
@DatabaseTable(tableName = "Prodotti")
public class Prodotti extends BaseDaoEnabled{
....
@DatabaseField(dataType = DataType.ENUM_STRING,
columnDefinition="VARCHAR(100) DEFAULT NULL")
//also tried @DatabaseField(dataType = DataType.ENUM_STRING)
private String udm;
...
}
I runned DatabaseConfigUtil to update the ormlite_config.txt, right now i’m thinking the only solution is to change the type of the field to String
ORMLite does not support database SQL enum columns which are only supported by a couple of database types. The
ENUM_STRINGis supposed to persist an enum type. Something like:By default, ORMLite will then persist the enum as it’s string value (RED, GREEN, BLUE) in a
VARCHARSQL field. If you have aStringfield then you should just let it be persisted as aSTRINGtype. You can also use theDataType.ENUM_INTEGERif you want to store its value instead but that is not recommended for backwards compatibility reasons.If you edit your questions to better explain what you are trying to accomplish, I can edit my answer to provide more information.