- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试使用 @lob 字符串持久化实体时出现错误。我记得那部分代码运行良好,但我根本不记得更改过它。我很困惑。这是我遇到的错误:
ERROR 30 04 12 23:50:31 [org.hibernate.util.JDBCExceptionReporter] => Start position [1] cannot exceed overall CLOB length [0] com.vaadin.event.ListenerMethod$MethodException Cause: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [life.domain_model.Post] at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:507) at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161) at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1154) at com.vaadin.ui.Button.fireClick(Button.java:371) at com.vaadin.ui.Button.changeVariables(Button.java:193) at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1094) at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:590) at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:266) at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:476) at org.vaadin.navigator7.NavigableApplicationServlet.service(NavigableApplicationServlet.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [life.domain_model.Post] at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1153) at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:695) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240) at $Proxy29.merge(Unknown Source) at life.dao.ForumDao.merge(ForumDao.java:24) at life.dao.ForumDao$$FastClassByCGLIB$$6eb7cb5f.invoke() at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621) at life.dao.ForumDao$$EnhancerByCGLIB$$8ecdd1fd.merge() at life.dao.ForumDaoImpl.mergeDiscussion(ForumDaoImpl.java:29) at life.dao.ForumDaoImpl.saveNewPostForDiscussion(ForumDaoImpl.java:50) at life.dao.ForumDaoImpl$$FastClassByCGLIB$$6d37da1f.invoke() at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621) at life.dao.ForumDaoImpl$$EnhancerByCGLIB$$66b0b0bd.saveNewPostForDiscussion() at life.ui.layouts.ForumEditorLayout.replyToDiscussion(ForumEditorLayout.java:112) at life.ui.layouts.ForumEditorLayout$3.buttonClick(ForumEditorLayout.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:487) ... 22 more Caused by: org.hibernate.exception.GenericJDBCException: could not insert: [life.domain_model.Post] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2327) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2834) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129) at org.hibernate.ejb.event.EJB3MergeEventListener.saveWithGeneratedId(EJB3MergeEventListener.java:62) at org.hibernate.event.def.DefaultMergeEventListener.saveTransientEntity(DefaultMergeEventListener.java:415) at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:341) at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:303) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:258) at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:877) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:859) at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:279) at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascade(Cascade.java:161) at org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:630) at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:490) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:255) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84) at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:867) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:851) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:855) at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:686) ... 54 more Caused by: java.sql.SQLException: Start position [1] cannot exceed overall CLOB length [0] at org.hibernate.engine.jdbc.ClobProxy.invoke(ClobProxy.java:146) at $Proxy36.getSubString(Unknown Source) at com.mysql.jdbc.PreparedStatement.setClob(PreparedStatement.java:3553) at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187) at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doBind(ClobTypeDescriptor.java:60) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:89) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277) at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:85) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2166) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2143) at org.hibernate.persister.entity.AbstractEntityPersister$4.bindValues(AbstractEntityPersister.java:2321) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:56) ... 85 more
这是 Post 实体:
@Entity
public class Post {
@Id @GeneratedValue
private Long id;
@ManyToOne @JoinColumn(name = "owner_id")
private User owner;
@ManyToOne @JoinColumn(name = "editer_id")
private User lastEditer;
private Date creationDate;
private Date lastEditionDate;
@Lob
private String content;
@ManyToOne @JoinColumn(name = "discussion_id")
private Discussion discussion;
public Post(){
}
public Post(User owner,String content){
this.owner = owner;
this.lastEditer = null;
Date curent = new Date();
this.creationDate = curent;
this.lastEditionDate = curent;
this.content = content;
this.discussion = null;
}
//G&S
....
无论字符串内容长度如何,我都会收到错误。我仍在使用 hibernate 3.6.0 和 MySql 5.5 ( + spring )。谁能告诉我如何纠正这个问题?
最佳答案
当我尝试将空字符串保存到用 @Lob 注释的字段时,我遇到了同样的问题。发现这个错误单:https://hibernate.onjira.com/browse/HHH-5704
我的项目隐式包含 Hibernate 核心版本 3.6.0,一旦我更新 POM 以显式包含核心版本 3.6.10,它就开始按预期工作。
这张票很好地解释了问题。
关于java - Hibernate @Lob 注释不再起作用 : cannot exceed overall CLOB length with a few String?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10391510/
我最近更新了 ADT 插件,我的整个 Eclipse-Android 构建系统都停止工作了。从那以后,我尝试了我在互联网上可以找到的所有关于如何解决这个问题的方法。徒然。如果有人有确定的方法来解决此问
我已经知道有类似的话题,但对我来说没有任何帮助...... 这里是信息: 该应用程序始终在模拟器和设备上运行。我最近将该项目重命名为另一个名称。仍然工作得很好。今天我意识到它没有更改文件夹名称,然后它
在装有El Capitan的MacMini上,我无法再进行冲泡了。我收到以下错误: /usr/local/Library/Homebrew/config.rb:34:in `initialize':
是的,所以我不知道发生了什么。我一直在编写一个 AJAX 评论脚本,并且它可以工作,但它不再工作了。我从备份中恢复了它,以防万一我改变了任何东西,但没有运气。它转到表单的“操作”而不是 jQuery,
请原谅我的无能...我正在尝试在全局 var 阶段不再未定义后使用 Proxy 执行一些代码。这是我天真的尝试: ``` var stage = undefined let myObj; let st
我对 segues 了解不多,但我已经开始工作了..但突然间它不再工作了...... 我的代码似乎可以工作,但没有发生 segue: NSLog(@"login started"); if ([use
我已将以下重写规则添加到我的 web.config 中。它运行良好,阻止了所有提及的推荐垃圾邮件站点。然而,今天我突然注意到 social-buttons.com 突然出现在我的 Google Ana
在 C++ 中,可以在翻译单元中使用 static 关键字来影响符号(变量或函数声明)的可见性。 在 n3092 中,这已被弃用: Annex D.2 [depr.static] The use of
升级到 com.crashlytics.sdk.android:crashlytics:2.7.1@aar 后(从 2.6.8 开始),我无法再在 Firebase 应用中禁用 Crashlytics
您好,我遇到了一些障碍,我一直在为我的应用程序重新设计菜单导航。我设法做到了。但现在我的应用程序的一项功能已决定停止运行。 想法是你摇动你的手机,它会随机选择一张图片,与应用程序分开的代码工作正常,就
我有一行(容器)包含三个元素,我想水平显示它们之间的间距相等(并且行的左侧或右侧没有空格)。我正在使用带有 justify-content:space-between 的 flexbox。 这是在 F
直到最近,我才能够在 Windows 上使用 python 3.6.7 时安装 tensorflow 1.5.0 包。现在我不能,从下面的“来自版本”的消息来看,似乎根本没有可用的 tensorflo
不确定是否与最近的更新有关,但我突然无法在 Android Studio 编辑器中获得单行间距。如果我尝试将它更改为 1,它让我设置它,但当我按下“应用”时,它会迅速恢复为 1.5。用不同的字体试过,
我遵循了有关如何在 macOS 上安装 pip 的在线说明(例如 this、this 和 this)。 我看起来很简单,但它不适合我。 我的 python --version 是 2.7.10。 当我
Due to rounding errors, most floating-point numbers end up being slightly imprecise. https://www.flo
我试图让用户从他们在 Android 上的库中选择一张图片。但是当我使用 PictureChooser 插件时,它似乎不再起作用了 我看到这段代码可以工作,但现在不行了,我也不知道为什么。
自 .NET 4.5 起,Exception.HResult 的 setter/getter 现在是 public,但它曾经是 protected。 来自 MSDN: Starting with th
今天去处理一个较旧的 Python2.7 AppEngine 标准项目,但我似乎无法让端点工作。我下载了示例代码,看看我的项目是否是罪魁祸首,但该示例也不起作用。 https://cloud.goog
我是一名优秀的程序员,十分优秀!