[hibernate-dev] Hbm mapping with hibernate 4
Max Rydahl Andersen
max.andersen at redhat.com
Mon Nov 28 07:25:44 EST 2011
> As mentioned in the migration guide, MetadataSources (in fact all of o.h.metamodel) is still a work in progress and not for usage...
>
> http://community.jboss.org/wiki/HibernateCoreMigrationGuide40
So for Hibernate 4.0 there are no changes in how xml is used/defined ?
All based on the "old" DTD's and not XSD ?
/max
>
>
> On Thu 24 Nov 2011 06:55:06 AM CST, Max Rydahl Andersen wrote:
>> 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
>>
>>
>>
>>
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
> --
> steve at hibernate.org
> http://hibernate.org
/max
http://about.me/maxandersen
More information about the hibernate-dev
mailing list