JPA,Mysql Blob 返回数据太长
我的实体中有一些字段,例如:byte[]
@Entity
public class ServicePicture implements Serializable {
private static final long serialVersionUID = 2877629751219730559L;
// seam-gen attributes (you should probably edit these)
@Id
@GeneratedValue
private Long id;
private String description;
@Lob
@Basic(fetch = FetchType.LAZY)
private byte[] picture;
在我的数据库架构上,该字段设置为,因此这应该没问题。无论如何:每次当我尝试插入图片或pdf时 - 没有比,我只收到这个BLOB
1mb
16:52:27,327 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 22001
16:52:27,327 ERROR [JDBCExceptionReporter] Data truncation: Data too long for column 'picture' at row 1
16:52:27,328 ERROR [STDERR] javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not insert: [de.ac.dmg.productfinder.entity.ServicePicture]
16:52:27,328 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
16:52:27,328 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
16:52:27,328 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:52:27,328 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
16:52:27,328 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
16:52:27,328 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
16:52:27,328 ERROR [STDERR] at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46)
16:52:27,328 ERROR [STDERR] at $Proxy142.persist(Unknown Source)
我已经检查了我的MySQL cnf,参数设置为 - 我错过了什么吗?max_allowed
16M