mercredi 16 septembre 2015

OrmLite DataType.BYTE_ARRAY field not recognized by lib

I'm using ORMlite 4.48 in my new project and something causes

java.sql.SQLException: ORMLite does not know how to store class [B for field 'imageBytes'. byte[] fields must specify dataType=DataType.BYTE_ARRAY or SERIALIZABLE

obvious answer? I don't think so...

class (deleted other fields)

@DatabaseTable(tableName = "cat_icon")
public class CategoryIcon {

    @DatabaseField(dataType=DataType.SERIALIZABLE)
    byte[] imageBytes;

    public byte[] getImageBytes(){
        return imageBytes;
    }

    public CategoryIcon setImageBytes(byte[] imageBytes) {
        this.imageBytes = imageBytes;
        return this;
    }
}

ormlite_config.txt

# --field-start--
fieldName=imageBytes
columnName=imageBytes
dataType=DataType.DataType
# --field-end--

of course table is not created at all. I've also tried with SERIALIZABLE with same result. what the heck? what can I do with this?

note that in exception log class is named [B, I've googled this line and in other throwns there is proper class name with package... (I'm not using ProGuard for debug)

Aucun commentaire:

Enregistrer un commentaire