kmsram420 wrote:
Hibernate version:3.0
Name and version of the database you are using:Postgresql 8.0
I am trying to access data using hibernate. But the problem is I need to create the cfg.xml file and the mapping files with the database name and its location.
Given the database name I will need to create the cfg.xml file, connect to the database, get the tables and columns details and create the mapping files.
Is there a way of doing this using hibernate?
I tried searching through the forums. But I couldn't conclude whether it is possible or not.
Can somebody help me find a solution for this?
Thanks in advance.
If you wish to generate the mapping files, from an existing DB, you can use the Hibernate Tools in eclipse:
http://www.wikihow.com/Generate-Hiberna ... -DB-Tables
If you have a java code and if you want to have a quick schema generation from the classes, it's good to use Hibernate Annotations
http://www.javaworld.com/javaworld/jw-0 ... tions.html