org.hibernate.mappingexception:无法确定Date的类型

时间:2015-03-12 09:37:05

标签: java spring hibernate

我正在使用Spring MVC和hibernate的Web应用程序,

每次我运行网页时都会遇到此错误' org.hibernate.mappingexception:无法确定', 我确实声明了我的所有字段,而且这些数据没有连接到其他表,

这是我的hbm.xml

<?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="prod.support.model.soaapp.DetailBPJS" table="ESBLOG">
        <id name="TIMESTAMP" type="DATE">
           <column name="TIMESTAMP" length="16" not-null="false" />
       </id>
        <property name="UUID" type="string">
           <column name="UUID" length="30" not-null="true" />
       </property>
       <property name="TRANSACTIONTIME" type="DATE">
           <column name="TRANSACTIONTIME" length="16" not-null="true" />
       </property>
        <property name="MESSAGEID" type="string">
           <column name="MESSAGEID" length="30" not-null="true" />
       </property>
        <property name="TRANSACTIONID" type="string">
            <column name="TRANSACTIONID" length="30" not-null="true" />
        </property>
        <property name="CLIENT" type="string">
            <column name="CLIENT" length="30" not-null="true" />
        </property>
        <property name="PROVIDER" type="string">
            <column name="PROVIDER" length="30" not-null="true" />
        </property>
        <property name="MODULE" type="string">
            <column name="MODULE" length="30" not-null="true" />
        </property>
         <property name="SUBMODULE" type="string">
            <column name="SUBMODULE" length="30" not-null="true" />
        </property>
        <property name="TRANSACTION" type="string">
            <column name="TRANSACTION" length="30" not-null="true" />
        </property>
        <property name="SUBTRANSACTION" type="string">
            <column name="SUBTRANSACTION" length="30" not-null="true" />
        </property>
        <property name="CUSTOMERID" type="string">
            <column name="CUSTOMERID" length="30" not-null="true" />
        </property>
        <property name="RAWDATA" type="string">
            <column name="RAWDATA" length="4000" not-null="true" />
        </property>
    </class>
</hibernate-mapping>

这是我的cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
        <property name="hibernate.connection.username">splatter</property>
        <property name="hibernate.connection.password">shikamaru</property>
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
        <property name="hibernate.default_schema">SPLATTER</property>
        <property name="show_sql">true</property>
        <mapping resource="prod/support/resources/DBSOAAPPBPJSTK.hbm.xml">    </mapping>
    </session-factory>
</hibernate-configuration>

这是我的模特,

package prod.support.model.soaapp;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import java.util.Date;

@Entity

@Table(name="ESBLOG")

public class DetailBPJS {

private Date TIMESTAMP;
private String UUID;
private Date TRANSACTIONTIME;
private String MESSAGEID;
private String TRANSACTIONID;
private String CLIENT;
private String PROVIDER;
private String MODULE;
private String SUBMODULE;
private String TRANSACTION;
private String SUBTRANSACTION;
private String CUSTOMERID;
private String RAWDATA;

@Id
@Temporal(TemporalType.TIMESTAMP)
@Column(name="TIMESTAMP")
public Date getTIMESTAMP(){
    return TIMESTAMP;
}

public void setTIMESTAMP(Date TIMESTAMP){
    this.TIMESTAMP = TIMESTAMP;
}

@Column(name="UUID")
public String getUUID(){
    return UUID;
}

public void setUUID(String UUID){
    this.UUID = UUID;
}

@Temporal(TemporalType.TIMESTAMP)
@Column(name="TRANSACTIONTIME")
public Date getTRANSACTIONTIME(){
    return TRANSACTIONTIME;
}

public void setTRANSACTIONTIME(Date TRANSACTIONTIME){
    this.TRANSACTIONTIME = TRANSACTIONTIME;
}

@Column(name="MESSAGEID")
public String getMESSAGEID(){
    return MESSAGEID;
}

public void setMESSAGEID(String MESSAGEID){
    this.MESSAGEID = MESSAGEID;
}

@Column(name="TRANSACTIONID")
public String getTRANSACTIONID(){
    return TRANSACTIONID;
}

public void setTRANSACTIONID(String TRANSACTIONID){
    this.TRANSACTIONID = TRANSACTIONID;
}

@Column(name="CLIENT")
public String getCLIENT(){
    return CLIENT;
}

public void setCLIENT(String CLIENT){
    this.CLIENT = CLIENT;
}

@Column(name="PROVIDER")
public String getPROVIDER(){
    return PROVIDER;
}

public void setPROVIDER(String PROVIDER){
    this.PROVIDER = PROVIDER;
}

@Column(name="MODULE")
public String getMODULE(){
    return MODULE;
}

public void setMODULE(String MODULE){
    this.MODULE = MODULE;
}

@Column(name="SUBMODULE")
public String getSUBMODULE(){
    return SUBMODULE;
}

public void setSUBMODULE(String SUBMODULE){
    this.SUBMODULE = SUBMODULE;
}

@Column(name="TRANSACTION")
public String getTRANSACTION(){
    return TRANSACTION;
}

public void setTRANSACTION(String TRANSACTION){
    this.TRANSACTION = TRANSACTION;
}

@Column(name="SUBTRANSACTION")
public String getSUBTRANSACTION(){
    return SUBTRANSACTION;
}

public void setSUBTRANSACTION(String SUBTRANSACTION){
    this.SUBTRANSACTION = SUBTRANSACTION;
}

@Column(name="CUSTOMERID")
public String getCUSTOMERID(){
    return CUSTOMERID;
}

public void setCUSTOMERID(String CUSTOMERID){
    this.CUSTOMERID = CUSTOMERID;
}

@Column(name="RAWDATA")
public String getRAWDATA(){
    return RAWDATA;
}

public void setRAWDATA(String RAWDATA){
    this.RAWDATA = RAWDATA;
}
}

这是错误

org.hibernate.MappingException: Could not determine type for: DATE, at table: ESBLOG, for columns: [org.hibernate.mapping.Column(TRANSACTIONTIME)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:306)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:290)
at org.hibernate.mapping.Property.isValid(Property.java:217)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)
at org.hibernate.mapping.RootClass.validate(RootClass.java:235)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1332)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1835)
at prod.support.webcontroller.AdmController.listDetailBPJSTK(AdmController.java:422)
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)

我被困住了,任何帮助都会很愉快:)

0 个答案:

没有答案