Hy again,
Yesterday was working fine and today I receive the following error when I started with the same code in class and hibernate file.
Have anyone some clue what happened?
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>".
I have written the hibernate mapping file for class Utilizator that uses the Utilizatori table in SQL 2008 and I am getting the following error when the class is called by the application:
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 = ?]
Here is the class code:
/*
* 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;
}
}
and mapping file:
<?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>
Your query is wrong; it should use the name of the class, not the name of the database table; i.e., use
UtilizatornotUtilizatori.