67,513
社区成员
发帖
与我相关
我的任务
分享
(id int identity(1,1) primary key,
subID int not null,
subName varchar(20) not null,
subJoinTime date not null,
subDesc varchar(20))
<class name="com.ccsu.cxl.entity.Subject" table="Subject">
<id name="id" >
<generator class="identity"></generator>
</id>
<property name="subID" />
<property name="subName" />
<property name="subJoinTime" />
<property name="subDesc" />
Hibernate: insert into Subject (subID, subName, subJoinTime, subDesc, id) values (?, ?, ?, ?, ?)16:30:01,343 WARN JDBCExceptionReporter:77 - SQL Error: 0, SQLState: null16:30:01,359 ERROR JDBCExceptionReporter:78 - 没有为参数号 5 设置值。16:30:02,609 ERROR runtime:96 - Template processing error: "Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not insert: [com.ccsu.cxl.entity.Subject]"Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not insert: [com.ccsu.cxl.entity.Subject]The problematic instruction:----------==> ${msg[0]} [on line 68, column 29 in org/apache/struts2/dispatcher/error.ftl]----------Java backtrace for programmers:----------freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.GenericJDBCException: could not insert: [com.ccsu.cxl.entity.Subject] at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130) at freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:138) at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111) at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.Expression.getStringValue(Expression.java:93) at freemarker.core.DollarVariable.accept(DollarVariable.java:76) at freemarker.core.Environment.visit(Environment.java:221)
insert into Subject (subID, subName, subJoinTime, subDesc) values (?, ?, ?, ?)
试试<property name="subID" colum="subID"/>
<id name="sid" type="java.lang.Integer">
<column name="sid" />
<generator class="native" />
</id>