Your question:
i am new to hibernate. My PL tolled me we can able to create table using .hbm.xml in any database. with out logging in to the db console.
is it possible through hibernate.
My Answer : Yes You can do that
Download Middlegen Software supplied.
there will be a build.xml file provided with it which has the code used to create tables, and generate lot of java/j2ee stuff. I have used it to connect to sybase table and create hbm.xml files. This can be achieved very easily, you just need to add the following lines in the build.xml file.
<!DOCTYPE project [
<!ENTITY database SYSTEM "file:./config/database/sybase.xml">
what this does is you are pointing to sybase table, the sybase.xml file has the necessary properties for the sybase database..sample sybase.xml file:
<!-- =================================================================== -->
<!-- ant properties/targets for mysql -->
<!-- note: this is not a proper xml file (there is no root element) -->
<!-- it is intended to be imported from a *real* xml file -->
<!-- =================================================================== -->
<property name="database.driver.file" value="${lib.dir}/jconn2.jar"/>
<property name="database.driver.classpath" value="${database.driver.file}"/>
<property name="database.driver" value="com.sybase.jdbc2.jdbc.SybDriver"/>
<property name="database.url" value="jdbc:sybase:Tds:enter your database name here "/>
<property name="database.userid" value="useid"/>
<property name="database.password" value="pwd"/>
<property name="database.schema" value="dbo1"/>
<property name="database.catalog" value="p22"/>
<property name="jboss.datasource.mapping" value="Sybase"/>
Once you have this set up you just need to run the build script which will provide you a GUI from where you can select the proper table and click generate which will generate the hbm.xml files for you in the hibernate directory.
If you still have doubts about let me know.
The following links will help you in downloading the software and how to work with them, If you still have problesm let me know.
http://boss.bekk.no/boss/middlegen/getstarted/index.html http://www.hibernate.org/98.html http://www.mjwall.com/node/view/138 http://boss.bekk.no/boss/middlegen/getstarted/ let me tell you this is a terrific tool which saves you a lot of time.