Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find the DTD of Hibernate?

The DTD in the hibernate jar is a good way to know what are the attributes that can be included and the expected name for that tag.

Opening up the DTD file is the easiest way to get an overview of all elements and attributes, and to view the defaults, as well as some comments.

This will help the programmer to write hibernate.cfg.xml file from scracth(crazy but some people do ask this to achieve without using internet :O )

Please tell where to locate the DTD when we have a hibernate jar.

This is not a programming question but will be helpful for programmer.

like image 285
NewUser Avatar asked Jun 25 '14 11:06

NewUser


2 Answers

Hibernate 5 and newer

DTD:

hibernate-core-5.2.10.Final.jar\org\hibernate\hibernate-configuration-3.0.dtd
hibernate-core-5.2.10.Final.jar\org\hibernate\hibernate-mapping-3.0.dtd

XSD:

hibernate-core-5.2.10.Final.jar\org\hibernate\hibernate-configuration-3.0.xsd
hibernate-core-5.2.10.Final.jar\org\hibernate\hibernate-mapping-3.0.xsd    

Hibernate 4

hibernate-core-4.3.5.Final.jar\org\hibernate\hibernate-configuration-3.0.dtd 
hibernate-core-4.3.5.Final.jar\org\hibernate\hibernate-mapping-3.0.dtd 

and Hibernate 4 was upgraded to use XSDs as well:

hibernate-core-4.3.5.Final.jar\org\hibernate\hibernate-configuration-4.0.xsd
hibernate-core-4.3.5.Final.jar\org\hibernate\hibernate-mapping-4.0.xsd

Hibernate 3

For old versions, like hibernate3.jar you can find them under:

hibernate3.jar\org\hibernate\hibernate-configuration-3.0.dtd
hibernate3.jar\org\hibernate\hibernate-mapping-3.0.dtd

For any version 3.x or above not listed here, you can find these files in your hibernate-core-X.x.Final.jar archive under the org.hibernate package

like image 63
Vlad Mihalcea Avatar answered Sep 21 '22 16:09

Vlad Mihalcea


Here is an image by which you will get a clear image in your mind that’s where will you get DTD. Click me to open Image for hibernate DTD

Open jar file respectively.

hibernate-core-5.4.10.Final.jar
org.hibernate
hibernate-configuration-3.0.dtd
hibernate-mapping-3.0.dtd

When you will open org.hibernate

You will get two dtd

one for

Hibernate configuration
Hibernate mapping

Hibernate configuration

<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

Hibernate Mapping

<!DOCTYPE hibernate-mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
like image 40
Susheel kumar Avatar answered Sep 20 '22 16:09

Susheel kumar