[hibernate-dev] Problems switching tests between old Configuration metadata and new metamodel

Gail Badner gbadner at redhat.com
Tue May 22 17:42:53 EDT 2012


I'm running into 2 problems:


1) I'm not able to run the same test using both types of metadata using the new=style <hibernate-mapping>:

  <hibernate-mapping package="org.hibernate.test.ops"
  xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
                    xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping
                    hibernate-mapping-4.0.xsd"
                    xmlnssi="http://www.w3.org/2001/XMLSchema-instance">

I've tried using -Dhibernate.xml.validate=false, but I get:

org.hibernate.testing.junit4.CallbackException: org.hibernate.testing.junit4.BaseCoreFunctionalTestCase#buildSessionFactory
...
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'hibernate-mapping'.
...

I can change my tests to use the old header for now. I was just wondering if this was expected to work now.

2) It is not possible to override the setting for hibernate.test.new_metadata_mappings using an environment variable if it's already set explicitly in the test's configure(). I thought this was possible with other properties in the past, but maybe not.

Basically, I override BaseCoreFunctionalTestCase.configure() and add:
    cfg.setProperty( USE_NEW_METADATA_MAPPINGS, "true");
for tests that should use the new metamodel by default when "gradle test" is used. 

In addition, I'd like to be able to execute the test using the Configuration metadata by overriding using -Dhibernate.test.new_metadata_mappings=false.

Should this be possible?

Gail


More information about the hibernate-dev mailing list