Announcement Announcement Module
Collapse
No announcement yet.
load a database schema Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • load a database schema

    hi,

    is there a way of how to automatically load a database schema in Spring using hibernate tru hbm2ddl? for example i have database.sql file. How will i invoke it in Spring-hibernate so it will automatically be loaded upon initialization?

    please help..

    Godspeed,
    my_aro

  • #2
    When you say "load" a schema, do you mean creating the tables?

    Comment


    • #3
      i mean an .sql which has the db structure.. can i do this?

      Comment


      • #4
        Originally posted by my_aro View Post
        i mean an .sql which has the db structure.. can i do this?
        I'm still not sure I understand what you are trying to do. What do you mean load the schema file? Do you just want to load it or are wanting to execute it as well? You can use the HBM2DDL task to create or drop the schema.

        hibernate.hbm2ddl.auto
        Automatically validate or export schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.
        eg. validate | update | create | create-drop
        http://www.hibernate.org/hib_docs/re...iguration.html

        Comment


        • #5
          sir,

          i mean a .sql filename which has the ex:

          insert into tablename(values)...

          Godspeed,
          my_aro

          Comment

          Working...
          X