title: Hibernate org.hibernate.MappingException: invalid configuration
body: <p>I started learned hibernate. But when i try use <code>hibernate.cfg.xml.</code> I see on the console:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.MappingException: invalid configuration
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2014)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1931)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1910)
      at testHibernate.HibernateStart.main(HibernateStart.java:28)
  Caused by: org.xml.sax.SAXParseException; lineNumber: 32; columnNumber: 49; Attribute "class" must be declared for element type "mapping".
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1253)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1917)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:763)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2715)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
      at org.dom4j.io.SAXReader.read(SAXReader.java:465)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2011)
      ... 3 more 
  </code></pre>
  
  <p>And <code>hibernate.cfg.xml</code> file. </p>
  
  <pre><code>&gt; &lt;?xml version='1.0' encoding='utf-8'?&gt; &lt;!DOCTYPE
  &gt; hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration
  &gt; DTD 2.0//EN"
  &gt; "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"&gt; 
  &gt; 
  &gt; &lt;hibernate-configuration
  &gt;         xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
  &gt;         xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration
  &gt; hibernate-configuration-4.0.xsd"
  &gt;         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;   &lt;session-factory&gt;
  &gt;     &lt;!-- Database connection settings --&gt;
  &gt;     &lt;property name="connection.driver_class"&gt;org.apache.derby.jdbc.EmbeddedDriver&lt;/property&gt;
  &gt;     &lt;property name="connection.url"&gt;jdbc:derby:/home/user/DataBase/db;create=true&lt;/property&gt;
  &gt;     &lt;property name="connection.username"&gt;&lt;/property&gt;
  &gt;     &lt;property name="connection.password"&gt;&lt;/property&gt;
  &gt;     
  &gt;     &lt;!-- JDBC connection pool (use the built-in) --&gt;
  &gt;     &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  &gt; 
  &gt;     &lt;!-- SQL dialect --&gt;
  &gt;     &lt;property name="dialect"&gt;org.hibernate.dialect.DerbyDialect&lt;/property&gt;
  &gt; 
  &gt;     &lt;!-- Enable Hibernate's automatic session context management --&gt;
  &gt;     &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
  &gt; 
  &gt;     &lt;!-- Disable the second-level cache  --&gt;
  &gt;     &lt;property name="cache.provider_class"&gt;org.hibernate.cache.internal.NoCacheProvider&lt;/property&gt;
  &gt;     
  &gt;     &lt;!-- Echo all executed SQL to stdout --&gt;
  &gt;     &lt;property name="show_sql"&gt;true&lt;/property&gt;
  &gt; 
  &gt;     &lt;!-- Drop and re-create the database schema on startup --&gt;
  &gt;     &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
  &gt;     &lt;mapping class="testHibernate.UserDetails"/&gt;   &lt;/session-factory&gt; &lt;/hibernate-configuration&gt;
  </code></pre>