[hibernate-dev] Hbm mapping with hibernate 4

Max Rydahl Andersen max.andersen at redhat.com
Thu Nov 24 07:55:06 EST 2011


For hibernate guys: to be clear, what Dmitry is working on is
to test and develop support in hibernate tools / jboss tools to work with both Hibernate 3.x and Hibernate 4.

The docs/migration guide doesn't seem to cover these differences so asked him to raise the question on the list.

/max

On Nov 24, 2011, at 24:01, Dmitry Geraskov wrote:

> 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
> 
> 
> <TestXMLSchema-core.zip><log.txt>

/max
http://about.me/maxandersen







More information about the hibernate-dev mailing list