On Tue 22 May 2012 04:42:53 PM CDT, Gail Badner wrote:
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">
Please do not use schemaLocation. This should just look like:
<hibernate-mapping package="org.hibernate.test.ops"
xmlns="http://www.hibernate.org/xsd/hibernate-mapping">
That's it. Your IDE will complain, but thats OK. You just manually
set up a resource mapping point from that URI to the project-local path.
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.
And no, it wont work. But I don't expect it to. Again, I am not
really sure why we care whether or not tests that explicitly targeting
the new metamodel code run against the old Configuration based
approach. All I really care about is that old-style mapping files
(those naming the old DTD) continue to work with the new JAXB stuff
from the metamodel code (and I have verified that it in fact does).
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.
Correct, but again, the ones overriding it should explicitly be tests
of new metamodel based code so I am not sure why you are wanting to
test that with the old Configuration bootstrap approach.
--
steve(a)hibernate.org
http://hibernate.org