[hibernate-dev] Hbm mapping with hibernate 4

Dmitry Geraskov dgeraskov at exadel.com
Wed Nov 23 18:01:40 EST 2011


Hey, guys,

I created the simplest hbm mapping and try to build session factory(full 
project attached, Hibernate-core4.0.0.CR6):

/new MetadataSources(
                  new ServiceRegistryBuilder().configure()
                 
  .buildServiceRegistry()).buildMetadata().buildSessionFactory();/


And I get this exception(full log attached):

Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 
26; cvc-elt.1: Cannot find the declaration of element 
'hibernate-configuration'.
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
    ...


When I build session factory using old syntax

/new Configuration().configure().buildSessionFactory();/

it works only with DTD schema(not 100% sure I found a correct header to 
use xsd for hibernate.cfg.xml):

<hibernate-configuration
xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration 
https://raw.github.com/hibernate/hibernate-core/master/hibernate-core/src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd">

.

This seems like a bug, or I do something wrong?

Dmitry Geraskov


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log.txt
Url: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20111123/6bdd19a5/attachment.txt 


More information about the hibernate-dev mailing list