When I'm synchronizing image from android to server, it throws this exception:

data truncation: data too long for column

Android:

@DatabaseField(dataType = DataType.BYTE_ARRAY)

private byte[] PERSON_IMAGE;

I am using ormlite for android and the image is saved correctly. I also extract the DB of android on emulator and the image is of type blob in db.

Server:

@Column(name = "PERSON_IMAGE", columnDefinition = "BLOB")
@Basic(fetch = FetchType.EAGER)
@Lob
@XmlElement
byte[] personImage;

I am using hibernate 4.1.3 to persist in mysql DB. My schema is autogenerated by hibernate. The image is also of type blob in mysql. Glad if you can help to sort this out. The exception is throws only when it persists in mysql.

In mysql a blob has a maximum size of 65 kilobytes whereas I believe the mysqlite version of a blob is significantly more than that (I'm assuming you are using mysqlite when you say you're saving the image to android).
You'll need to increase your MySql blob type to mediumblob or longblob.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.