Hi!

I'm doing a proof of concept of the architecture for my Spring + JPA new developments. Now I'm testing an "standalone" business model.

I tried different cases of insertion and retrieval of information from the database and all have worked, except for fields with data type BLOB and CLOB

I have researched and tested several alternatives but always gives me the same error (changing the JPA annotations, using a PostgresSQL database, using Toplink, using C3p0) but none has worked.

any suggestions?

Regards.

Daniel R. Criado
LEANDRA SYS SL

========
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;

===============
persistence.xml
================

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="test1_8" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceP rovider</provider>
<class>leandra.test1_8.Test8</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.target-database" value="MySQL4"/>
</properties>
</persistence-unit>
</persistence>

==============
ApplicationContext.xml
===============

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schem...ng-jee-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

<context:load-time-weaver/>

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/test"
p:username="test" p:password="test"/>

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean"
p:dataSource-ref="dataSource">
<property name="jpaVendorAdapter">

<bean class="org.springframework.orm.jpa.vendor.EclipseL inkJpaVendorAdapter"
p:databasePlatform="org.eclipse.persistence.platfo rm.database.MySQLPlatform"
p:showSql="true" />

</property>
</bean>

<bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc .CommonsDbcpNativeJdbcExtractor"/>


<!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager"
p:entityManagerFactory-ref="entityManagerFactory"/>
<context:annotation-config/>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean class="org.springframework.dao.annotation.Persiste nceExceptionTranslationPostProcessor"/>
<bean id="testManager" class="leandra.test1_8.EntityTestManager"/>
</beans>



==========
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.DatabaseExcepti on
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: 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.DatabaseExcepti on
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: 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.DatabaseExcepti on
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: 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)