海蘭再次,休眠錯誤
昨天工作正常,今天我收到以下錯誤,當我開始在課堂上相同的代碼和休眠文件。 有沒有人知道發生了什麼?
15:56:26 ERROR [AWT-EventQueue-0] (XMLHelper.java:81) - Error parsing XML: XML InputStream(4) The content of element type "class" is incomplete, it must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
null
15:56:26 ERROR [AWT-EventQueue-0] (XMLHelper.java:81) - Error parsing XML: XML InputStream(4) The content of element type "class" is incomplete, it must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
15:56:26 ERROR [AWT-EventQueue-0] (XMLHelper.java:81) - Error parsing XML: XML InputStream(13) The element type "hibernate-mapping" must be terminated by the matching end-tag "</hibernate-mapping>".
Cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [app-data.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
15:56:26 ERROR [AWT-EventQueue-0] (XMLHelper.java:81) - Error parsing XML: XML InputStream(13) The element type "hibernate-mapping" must be terminated by the matching end-tag "</hibernate-mapping>".
我已經寫了Utilizator
類使用Utilizatori
表中2008年SQL Hibernate映射文件,我收到以下錯誤,當該類應用程序調用:
Cause: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'utilizatorDAO' defined in class path resource [app-data.xml]:
Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException:
Initialization of DAO failed; nested exception is org.springframework.orm.hibernate3.HibernateQueryException:
Utilizatori is not mapped [from Utilizatori where utilizator = ?];
nested exception is org.hibernate.hql.ast.QuerySyntaxException:
Utilizatori is not mapped [from Utilizatori where utilizator = ?]
下面是類代碼:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package domain;
/**
*
* @author Admin
*/
public class Utilizator {
private Long idUtilizator;
private String utilizator;
private String parola;
private String nivelAcces;
private String nume;
private String prenume;
public Utilizator() {
}
public Long getIdUtilizator() {
return idUtilizator;
}
public void setIdUtilizator(Long idUtilizator) {
this.idUtilizator = idUtilizator;
}
public String getUtilizator() {
return utilizator;
}
public void setUtilizator(String utilizator) {
this.utilizator = utilizator;
}
public String getParola() {
return parola;
}
public void setParola(String parola) {
this.parola = parola;
}
public String getNivelAcces() {
return nivelAcces;
}
public void setNivelAcces(String nivelAcces) {
this.nivelAcces = nivelAcces;
}
public String getNume() {
return nume;
}
public void setNume(String nume) {
this.nume = nume;
}
public String getPrenume() {
return prenume;
}
public void setPrenume(String prenume) {
this.prenume = prenume;
}
}
和馬pping文件:
<?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="domain.Utilizator" table="Utilizatori"/>
<id name="idUtilizator" column="IDUtilizator">
<generator class="native" />
</id>
<property name="utilizator"/>
<property name="parola"/>
<property name="nivelAcces"/>
</class>
</hibernate-mapping>
請發佈您的映射文件和您的代碼。 – ziesemer 2012-01-08 20:23:57
是「Utilizator」還是「Utilizatori」? HQL應該使用類名稱。 – 2012-01-08 20:26:26
Utilizator是類; Utilizatori是SQL表的名稱 – JavaNUB 2012-01-08 20:28:07