Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Error inserting a BLOB data type in MySQL

Hi!
	
My application fail to insert a BLOB data type. I have researched and tested
several alternatives but always gives me the same error.

any suggestions?

Regards.

Daniel R. Criado

========
Platform
=======

- EclipseLink version: 1.1.1.v20090430-r4097 (using javax.persistent_1.99)
- Spring Framework 2.5.6
- MySQL 5.1.33-community
- MYSQL Connector 

===========
Class Code:
===========

@Entity
public class Test8 implements Serializable {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	private String name;

	@Lob
	private byte[] desc;

	@Temporal(TemporalType.TIMESTAMP)
	private Date date;

	private static final long serialVersionUID = 1L;

	public Test8() {
		super();
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public byte[] getDesc() {
		return this.desc;
	}

	public void setDesc(byte[] desc) {
		this.desc = desc;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

}

=======
Database Script
=======

CREATE  TABLE EXISTS `test8` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(45) NULL ,
  `desc` LONGBLOB NULL ,
  `date` DATETIME NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;

==========
Error description
=========

[EL Warning]: 2009-05-25
20:06:26.281--UnitOfWork(189219)--Thread(Thread[main,5,main])--Exception
[EclipseLink-4002] (Eclipse Persistence Services - 1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'DESC, NAME, DATE) VALUES
(_binary'<html>\r\n<body>\r\n\r\nThe classes in this pa' at line 1
Error Code: 1064
Call: INSERT INTO TEST8 (DESC, NAME, DATE) VALUES (?, ?, ?)
	bind => [[B@1dacccc, prueba, 2009-05-25 20:06:25.718]
Query: InsertObjectQuery(leandra.test1_8.Test8@12c8fa8)
class org.springframework.orm.jpa.JpaSystemException  Exception
[EclipseLink-4002] (Eclipse Persistence Services - 1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'DESC, NAME, DATE) VALUES
(_binary'<html>\r\n<body>\r\n\r\nThe classes in this pa' at line 1
Error Code: 1064
Call: INSERT INTO TEST8 (DESC, NAME, DATE) VALUES (?, ?, ?)
	bind => [[B@1dacccc, prueba, 2009-05-25 20:06:25.718]
Query: InsertObjectQuery(leandra.test1_8.Test8@12c8fa8); nested exception is
javax.persistence.PersistenceException: Exception [EclipseLink-4002]
(Eclipse Persistence Services - 1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'DESC, NAME, DATE) VALUES
(_binary'<html>\r\n<body>\r\n\r\nThe classes in this pa' at line 1
Error Code: 1064
Call: INSERT INTO TEST8 (DESC, NAME, DATE) VALUES (?, ?, ?)
	bind => [[B@1dacccc, prueba, 2009-05-25 20:06:25.718]
Query: InsertObjectQuery(leandra.test1_8.Test8@12c8fa8)


-- 
View this message in context: http://www.nabble.com/Error-inserting-a-BLOB-data-type-in-MySQL-tp23711038p23711038.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top