Goo Day,
i have problem with Hibernate, when i want to use type="serializable". It is writen, that Data too long ... I had tried to set length, but it dont help. Do you have some idea?
Thanks for help Petr
Hibernate version:hibernate-3.2.5.ga
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="table.AbstractTable" table="AbstractTable">
<id column="Id" name="id">
<generator class="increment"/>
</id>
<discriminator column="TYPETABLE" type="string"/>
<property name="columns" type="serializable">
<column name="Columns" sql-type="binary" length="16777215"/>
</property>
<property name="columnsMap" type="serializable">
<column name="ColumnsMap" sql-type="binary" length="16777215"/>
</property>
<subclass name="table.Table" discriminator-value="BASETABLE">
<many-to-one name="index" column="table_index" class="table.TableIndex" cascade="save-update"/>
</subclass>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
session.beginTransaction();
session.save(f);
session.getTransaction().commit();
Full stack trace of any exception that occurs:
Exception in thread "main" org.hibernate.exception.DataException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at cz.cvut.felk.webing.ewait.dataadapter.dao.GenericsDao.saveOrUpdate(GenericsDao.java:21)
at cz.cvut.felk.webing.ewait.dataadapter.HibernateRunner.main(HibernateRunner.java:30)
Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'Columns' at row 1
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1669)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1085)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 9 more
Java Result: 1
Name and version of the database you are using:
MySQL 5.1
The generated SQL (show_sql=true):
Hibernate: select max(Id) from AbstractTable
Hibernate: select max(Id) from TableIndex
Hibernate: insert into TableIndex (SelectedIndex, Selected, INDEX_TYPE, Id) values (?, ?, 'Long', ?)
Hibernate: insert into AbstractTable (Columns, ColumnsMap, table_index, TYPETABLE, Id) values (?, ?, ?, 'BASETABLE', ?)
Debug level Hibernate log excerpt:
|