hibernate新问题,在线等。

scottwj 2004-06-09 09:02:25
出错信息
log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).

log4j:WARN Please initialize the log4j system properly.

net.sf.hibernate.JDBCException: could not insert: [h.Person#4028808afd06ed0400fd06ed117a0001]

at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:478)

at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:442)

at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)

at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)

at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2335)

at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)

at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)

at h.TestPerson.main(TestPerson.java:39)

Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]将截断字符串或二进制数据。

at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)

at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)

at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)

at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)

at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)

at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:468)

... 7 more

Exception in thread "main"

请具体说明
...全文
151 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
asdmonster 2004-06-19
  • 打赏
  • 举报
回复
将你插入的 h.Person 对象和你的表结构帖出来看看
139129 2004-06-18
  • 打赏
  • 举报
回复
把class和配置文件也贴上来。
sandsworlf 2004-06-14
  • 打赏
  • 举报
回复
在src目录下面有两个文件不可缺少:
1、hibernate.properties
2、log4j.properties
另外需要的库文件都要包含进去,有些配置需要自己修改一下

http://www.hibernate.org.cn
seawolfzxw 2004-06-13
  • 打赏
  • 举报
回复
更改字段类型或进行类型转换。
scottwj 2004-06-09
  • 打赏
  • 举报
回复
不是字段值太长的问题,我试过了改短了也是一样的.
donghx1234 2004-06-09
  • 打赏
  • 举报
回复
up
xylohouse 2004-06-09
  • 打赏
  • 举报
回复
log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).

log4j:WARN Please initialize the log4j system properly.

>>>你少了一个文件:WEB-INF\classes\log4j.properties



Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]将截断字符串或二进制数据。
>>>你执行插入时,字段值太长了。

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧