Can not save byte[] in android sqlite using ormlite

25 views
Skip to first unread message

Debasish Mitra

unread,
Feb 21, 2018, 2:51:22 AM2/21/18
to ORMLite Android Users
I am trying to save some byte[] data in a column my "ormlite_config.txt" files for the field is as below

# --field-start--
dataType=DataType.BYTE_ARRAY
fieldName=faceRecogData
# --field-end--


The class which describes my Table has this variable as below:

@DatabaseField(dataType = DataType.BYTE_ARRAY)
public byte[] faceRecogData;


But the below line, which returns the object throws this error.  
m_recognitionTable = FacialProcessingApp.getHelper(FacialProcessingApp.getContext(), databaseHelper).getRecognitionTable();

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


Can someone tell me what am I missing here? The above code is working fine without the byte[] field.



Gray Watson

unread,
Feb 21, 2018, 5:38:22 PM2/21/18
to ORMLite Android
Are you _sure_ that the ormlite_config.txt file is up to date? ORMLite is complaining because the DataType is not being explicitly set. Your ormlite_config.txt entry below looks good so I'm wondering if it hasn't been updated into your application.

gray
> --
> You received this message because you are subscribed to the Google Groups "ORMLite Android Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ormlite-andro...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Debasish Mitra

unread,
Feb 21, 2018, 5:45:06 PM2/21/18
to ORMLite Android Users
Ignore this request. My mistake I did not use the utility to generate the ormlite config file. Once used, it worked fine.
Reply all
Reply to author
Forward
0 new messages