Using ORMLite config file: java.sql.SQLException: Serializable fields must specify dataType=DataType.SERIALIZABLE

StackOverflow https://stackoverflow.com/questions/18258697

  •  24-06-2022
  •  | 
  •  

Question

I'm trying to use a generated class (generated using the Google App Engine) in my Android application through ORMLite. I've created a config file as follows:

# --table-start--
dataClass=com.name.app.entities.customerendpoint.model.Customer
tableName=customer
# --table-fields-start--
# --field-start--
fieldName=key
generatedId=false
# --field-end--
# --field-start--
fieldName=firstName
#columnName=lastClickDate
# --field-end--
# --field-start--
fieldName=lastName
#indexName=clickcount_name_idx
# --field-end--
# --field-start--
fieldName=email
# --field-end--
# --field-start--
fieldName=postcode
# --field-end--
# --field-start--
fieldName=birthDate
dataType=DataType.SERIALIZABLE
#foreign=true
# --field-end--
# --field-start--
fieldName=gender
# --field-end--
# --field-start--
fieldName=facebookId
# --field-end--
# --field-start--
fieldName=googleId
# --field-end--
# --field-start--
fieldName=pictureUrl
# --field-end--
# --field-start--
fieldName=verificationCode
# --field-end--
# --table-fields-end--
# --table-end--
#################################

In the constructor of my DBHelper I'm referring to this file:
super(context, "APP", null, 1, R.raw.ormlite_config);

Unfortenately, when I'm creating the table an SQLException is raised:

java.sql.SQLException: ORMLite can't store unknown class class com.google.api.client.util.DateTime for field 'birthDate'. Serializable fields must specify dataType=DataType.SERIALIZABLE

The weird thing is I definitely specified the birthDate field to be Serializable:

fieldName=birthDate
dataType=DataType.SERIALIZABLE

Does anyone have a clue what I'm doing wrong or is it a bug in ORMLite?

Was it helpful?

Solution

You need to persist datatype by dataPersister=SERIALIZABLE, instead dataType=DataType.SERIALIZABLE in your config file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top