我在 liferay6 中有我的自定义 portlet,在将长数据插入数据库时遇到异常java.sql.BatchUpdateException: Data truncation: Data too long for column 'XXXX' at row 1
即使我在portlet-modal-hints
<field name="advurl" type="String">
<hint name="max-length">4000</hint>
</field>
这是抛出错误的列中的字符串:http://www.coderanch.com/t/435635/java/java/Regular-expression-check-specific-special
谁能告诉我为什么这仍然会引发错误?
错误堆栈
Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.DataException: Could not execute JDBC batch update
at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:122)
at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.flush(ClassLoaderSession.java:218)
at com.liferay.portal.service.persistence.BatchSessionImpl.update(BatchSessionImpl.java:95)
at com.liferay.portal.service.persistence.BatchSessionUtil.update(BatchSessionUtil.java:50)
at emenu.advertise.database.service.persistence.advertisePersistenceImpl.updateImpl(advertisePersistenceImpl.java:505)
... 178 more
Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:119)
... 182 more
Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'advlink' at row 1
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1257)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:943)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 188 more
谁能给我一些建议?