I am starting with Hibernate. i have downloaded version 4.1. What header should I use for my cfg.xml files?
In documentation there is no word about it. In their examples they are using standard (old) header:
It indicates hibernate configuration version 3.0. When I use it my basic aplication it works fine but shouldn't I use a newer header for my Hibernate 4.1?
I have found on the net en axample of such header but i doesn't work for my aplications:
So is there enything else for Hibernate 4 or should I use old type of header?
I talk with someone who knows the xsd schema isssue very well and he says that the http doesn't have to indicate appropriate location to the xsd file because this file is in one of hiberante jars (I have found it there) and all the request for this schema are rediverted there. So this is not an answer why it doesn't work.
I am well aware it does not have to be on the internet but most good libraries will have it in both places funny that hibernate does not. But that is exactly why I asked you the question
Is it in the Jar?
I have not had the opportunity to make the leap to 4 at work yet and at home I don't use XML configuration. But here are a few things you could try:
There is more than one XSD, are you using the correct one for the correct purpose (there is a different XSD for your hibernate mappings, ORM, configuration etc). You really have not posted enough information to make that determination. See the below JIRA where they added this.
https://hibernate.onjira.com/browse/HHH-6080
Lastly when you say "it does not work" that does not give us much to go on, what kind of errors are you getting? Is your config invalid against the schema or is the schema just not found?
See Tell The Details
When I write "does not work" I mean that I get an arror concernig header. I exactly get:
ExceptionInitializerError caused by MappingException: invalid configuration
lover there is another cause:
SAXParseException: Document is ivalid: no grammar found.
As I mentioned, when I change header on old version (3) the application works perfect (although it is using libraries from Hibernate version 4.x).
Thanks for that link to documentation but my header is exactly the same. To avoid missing any difference (single letter) I have copied it to my application and doesn't work to. I suspect this is the only version of Header for Hib. 4 on the net and that is why the one I have found is the same that you have indicated in this documentation.
I haven't tried to modify this header by changing the name of xsd file because I a newbie in that issue and I rely on standard settings. I use link to standard file "hibernate-configuration-4.0.xsd".
What hibernate jars are on your classpath? The XSD should be in the core jar which would suggest that your classpath is not correct. Could you possibly have an old version of hibernate on there?
Witold Marshal wrote: I exactly get:
ExceptionInitializerError caused by MappingException: invalid configuration
lover there is another cause:
SAXParseException: Document is ivalid: no grammar found.
Please post that entire exception stacktrace. That might give us an hint about what it's complaining about. Also post your hibernate configuration (in its entirety) which uses that xsd.
My application is meant for JSE environment, JDBC connection, run from Eclipse or executable jar (in both cases result is the same).
Here you have all the materials:
My cfg.xml looks like this:
If I pack it to executable jar then I have Manifest.mf which indidcates Hibernate jars:
Thanks for this new header but it gives no results as the previous one (The same error). Propably it can't find this xsd schema. The strange thing is that when I change header on this for version 3.x (3.0.dtd) it works. And both schema files (xsd and dtd) are in the same folder "org/hibernate" of Hibernate libraries.