采用hibernate insert的问题,急

guohongluo 2008-11-07 02:47:03
第三个参数qwrs是 integer类型数据,jt.setJobdate(java.sql.Date.valueOf(jobdate));
jt.setModel(model);
System.out.println("qwrs "+qwrs+" "+Integer.valueOf(qwrs));
jt.setQwrs(Integer.valueOf(qwrs));
jt.setQwsj(Double.valueOf(qwsj));
jt.setQwsjxjh(Double.valueOf(qwsjxjh));
jt.setQwsjxjm(Double.valueOf(qwsjxjm));
jt.setTotal(Double.valueOf(total));

在jsp页面输入101,save时出现下面的错误,请高手看看是什么原因造成的?
2008-11-7 14:28:58 com.opensymphony.xwork2.validator.ActionValidatorManagerFactory <clinit>
信息: Detected AnnotationActionValidatorManager, initializing it...
2008-11-7 14:28:58 org.hibernate.cfg.Environment <clinit>
信息: Hibernate 3.1
2008-11-7 14:28:58 org.hibernate.cfg.Environment <clinit>
信息: hibernate.properties not found
2008-11-7 14:28:58 org.hibernate.cfg.Environment <clinit>
信息: using CGLIB reflection optimizer
2008-11-7 14:28:58 org.hibernate.cfg.Environment <clinit>
信息: using JDK 1.4 java.sql.Timestamp handling
2008-11-7 14:28:58 org.hibernate.cfg.Configuration configure
信息: configuring from resource: /hibernate.cfg.xml
2008-11-7 14:28:58 org.hibernate.cfg.Configuration getConfigurationInputStream
信息: Configuration resource: /hibernate.cfg.xml
2008-11-7 14:28:58 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource: model.hbm.xml
2008-11-7 14:28:58 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
信息: Mapping class: tables.model -> model
2008-11-7 14:28:58 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource: jobTime.hbm.xml
2008-11-7 14:28:58 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
信息: Mapping class: tables.jobTime -> JobTime
2008-11-7 14:28:58 org.hibernate.cfg.Configuration doConfigure
信息: Configured SessionFactory: null
2008-11-7 14:28:58 org.hibernate.cfg.Configuration secondPassCompile
信息: processing extends queue
2008-11-7 14:28:58 org.hibernate.cfg.Configuration secondPassCompile
信息: processing collection mappings
2008-11-7 14:28:58 org.hibernate.cfg.Configuration secondPassCompile
信息: processing association property references
2008-11-7 14:28:58 org.hibernate.cfg.Configuration secondPassCompile
信息: processing foreign key constraints
2008-11-7 14:28:58 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: Using Hibernate built-in connection pool (not for production use!)
2008-11-7 14:28:58 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: Hibernate connection pool size: 20
2008-11-7 14:28:58 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: autocommit mode: false
2008-11-7 14:28:58 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost/testtest
2008-11-7 14:28:58 org.hibernate.connection.DriverManagerConnectionProvider configure
信息: connection properties: {user=postgres, password=****}
2008-11-7 14:28:58 org.hibernate.cfg.SettingsFactory buildSettings
信息: RDBMS: PostgreSQL, version: 8.3.3
2008-11-7 14:28:58 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.3 JDBC4 with SSL (build 603)
2008-11-7 14:28:59 org.hibernate.dialect.Dialect <init>
信息: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2008-11-7 14:28:59 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
信息: Using default transaction strategy (direct JDBC transactions)
2008-11-7 14:28:59 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
信息: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic flush during beforeCompletion(): disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic session close at end of transaction: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC batch size: 15
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC batch updates for versioned data: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Scrollable result sets: enabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC3 getGeneratedKeys(): disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Connection release mode: auto
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default batch fetch size: 1
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Generate SQL with comments: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL updates by primary key: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
信息: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2008-11-7 14:28:59 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
信息: Using ASTQueryTranslatorFactory
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query language substitutions: {}
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Second-level cache: enabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query cache: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory createCacheProvider
信息: Cache provider: org.hibernate.cache.EhCacheProvider
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Optimize cache for minimal puts: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Structured second-level cache entries: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Echoing all SQL to stdout
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Statistics: disabled
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Deleted entity synthetic identifier rollback: disabled
qwrs 101 101
Hibernate: select nextval ('JobTime_jobID_seq')
Hibernate: insert into JobTime (jobdate, model, qwrs, qwsj, cysj, qwsjxjh, cysjxjh, qwsjxjm, cysjxjm, total, jobid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2008-11-7 14:28:59 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default entity-mode: pojo
2008-11-7 14:28:59 org.hibernate.impl.SessionFactoryImpl <init>
信息: building session factory
2008-11-7 14:28:59 net.sf.ehcache.config.Configurator configure
警告: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/EfficiencyM/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
2008-11-7 14:28:59 org.hibernate.impl.SessionFactoryObjectFactory addInstance
信息: Not binding factory to JNDI, no JNDI name configured
2008-11-7 14:28:59 org.hibernate.impl.SessionFactoryImpl checkNamedQueries
信息: Checking 0 named HQL queries
2008-11-7 14:28:59 org.hibernate.impl.SessionFactoryImpl checkNamedQueries
信息: Checking 0 named SQL queries
2008-11-7 14:28:59 org.hibernate.type.NullableType nullSafeSet
信息: could not bind value '101' to parameter: 32008-11-7 14:28:59 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 0, SQLState: 22023
2008-11-7 14:28:59 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: 未设定参数值 3 的内容。
2008-11-7 14:28:59 org.hibernate.event.def.AbstractFlushingEventListener performExecutions
严重: Could not synchronize database state with session
org.hibernate.exception.DataException: Could not execute JDBC batch update
...全文
305 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
guohongluo 2008-11-07
  • 打赏
  • 举报
回复
jobTime.hbm.xml中定义的类型和jobTime.java(定义表的类)中定义的类型不一致造成的。
我用的是hibernate3.1
各给一半分
yehuiling 2008-11-07
  • 打赏
  • 举报
回复
把qwrs类型Integer改为Long

如:
po.java中:
private Long qwrs;

po.hbm.xml中:
<property name="qwrs" type="java.lang.Long">

参考:http://topic.csdn.net/u/20080725/14/239ee1ee-c1c7-4489-b752-22e884476b61.html

http://www.java2000.net/p7516
beckhamcat1 2008-11-07
  • 打赏
  • 举报
回复
hibernate.cfg.xml 有错吧

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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