Results 1 to 5 of 5

Thread: load a database schema

  1. #1
    Join Date
    Jul 2006
    Posts
    11

    Default 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. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    When you say "load" a schema, do you mean creating the tables?
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #3
    Join Date
    Jul 2006
    Posts
    11

    Default

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

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote 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
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  5. #5
    Join Date
    Jul 2006
    Posts
    11

    Default

    sir,

    i mean a .sql filename which has the ex:

    insert into tablename(values)...

    Godspeed,
    my_aro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •