我正在使用oracle数据库和java应用程序在eclipse中使用Hibernate项目。
在我的Hibernate项目中添加新类(存在于我的数据库中)之后,运行我的java project.it成功加载也允许将数据从java项目添加到hibernate表但是将这些数据添加到数据库时出现此错误< / p>
DocumentWRONGMODDATESTATUS docstatus = new DocumentWRONGMODDATESTATUS();
这是我将数据添加到数据库的代码。
注意(我打开了会话,我测试了另一个类存在于同一个Hibernate项目中,与此类“Hibernate Project”具有相同的结构)
docstatus.setOriginalDocId(doc.getPdf().getId());
addDocumentWrongModDateStatus(docstatus ,Session );
此时每件事都很好,但是在线下面会给出错误(在调试模式下测试它)
<?xml version="1.0" encoding="UTF-8"?>
的hibernate.cfg.xml
<!-- Enable Hibernate's automatic session context management -->
<property name="hibernate.connection.pool_size">1</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="connection.autoReconnect">true</property>
<!-- <property name="show_sql">true</property> -->
<property name="show_sql">true</property>
<property name="format_sql">false</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>
<!-- auto commit -->
<property name="connection.autocommit">true</property>
<!-- configuration pool via c3p0 -->
<property name="c3p0.idleConnectionTestPeriod">1000</property>
<property name="c3p0.initialPoolSize">1</property>
<property name="c3p0.maxPoolSize">1</property>
<property name="c3p0.maxIdleTime">1</property>
<property name="c3p0.maxStatements">3</property>
<property name="c3p0.minPoolSize">1</property>
<mapping resource="com/se/automation/db/client/mapping/DocumentWRONGMODDATESTATUS.hbm.xml" />
<mapping
resource="com/se/automation/db/client/mapping/DocumentCompareChangedFet.hbm.xml" />
<mapping
resource="com/se/automation/db/client/mapping/DocumentCompareCode.hbm.xml" />
<mapping
resource="com/se/automation/db/client/mapping/DocumentCompareComment.hbm.xml" />
<mapping
resource="com/se/automation/db/client/mapping/DocumentCompareMethod.hbm.xml" />
</session-factory>
</hibernate-configuration>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.se.automation.db.client.mapping.DocumentWRONGMODDATESTATUS"
table="DOCUMENTWRONGMODDATESTATUS">
<id column="ID" length="33" name="id" type="long">
<generator class="assigned" />
</id>
<property name="Status" type="java.lang.String">
<column name="STATUS" />
</property>
<property name="OriginalDocId" type="java.lang.Long">
<column name="ORIGINALDOCID" />
</property>
<property name="RevDocId" type="java.lang.Long">
<column name="REVDOCID" />
</property>
</class>
</hibernate-mapping>
DocumentWRONGMODDATESTATUS.hbm.xml
package com.se.automation.db.client.mapping;
import java.io.Serializable;
public class DocumentWRONGMODDATESTATUS implements Serializable
{
private static final long serialVersionUID = 1L;
private Long id;
private String Status;
private Long OriginalDocId;
private Long RevDocId;
public Long getOriginalDocId()
{
return OriginalDocId;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getStatus()
{
return Status;
}
public void setStatus(String status)
{
Status = status;
}
public void setOriginalDocId(Long originalDocId)
{
OriginalDocId = originalDocId;
}
public Long getRevDocId()
{
return RevDocId;
}
public void setRevDocId(Long revDocId)
{
RevDocId = revDocId;
}
{
}
}
DocumentWRONGMODDATESTATUS.java
angular.module('ExampleApp', [])
.controller('ExampleController', function($scope, $timeout) {
$scope.artists = [{
"artistName": 'B',
"albumTitle":5
}, {
"artistName": 'A',
"albumTitle":2
}, {
"artistName": 'C',
"albumTitle":3
}, {
"artistName": 'D',
"albumTitle":4
}];
})
.directive('directiveList', function($timeout) {
return {
restrict: "A",
priority: 1000,
link: function(scope, element) {
var options = {
valueNames: ['artistName', 'albumTitle', 'recordLabel']
};
scope.$watch(function() {
return element.find('li').length;
}, function(val) {
if (val > 0) {
$timeout(function(){ var artistList = new List('artists', options);});
}
});
}
};
});