Hibernate "fixtures" or database population?

P

Peter D.

I've been messing around with Hibernate lately and I am wondering if
it has a "fixture" capability.

Here is an example from the symfony PHP framework which has this
feature:

http://www.symfony-project.org/book...ment-Tools#chapter_16_sub_fixture_file_syntax

"In the process of application development, developers are often faced
with the problem of database population. A few specific solutions
exist for some database systems, but none can be used on top of the
object-relational mapping. Thanks to YAML and the sfPropelData object,
symfony can automatically transfer data from a text source to a
database. Although writing a text file source for data may seem like
more work than entering the records by hand using a CRUD interface, it
will save you time in the long run. You will find this feature very
useful for automatically storing and populating the test data for your
application."

I'm sure I saw something like this for Hibernate and Java but I just
can't seem to figure out the lingo to search for it... anyone know?
 
P

Peter D.

I've been messing around with Hibernate lately and I am wondering if
it has a "fixture" capability.

Here is an example from the symfony PHP framework which has this
feature:

http://www.symfony-project.org/book/1_0/16-Application-Management-Too...

"In the process of application development, developers are often faced
with the problem of database population. A few specific solutions
exist for some database systems, but none can be used on top of the
object-relational mapping. Thanks to YAML and the sfPropelData object,
symfony can automatically transfer data from a text source to a
database. Although writing a text file source for data may seem like
more work than entering the records by hand using a CRUD interface, it
will save you time in the long run. You will find this feature very
useful for automatically storing and populating the test data for your
application."

I'm sure I saw something like this for Hibernate and Java but I just
can't seem to figure out the lingo to search for it... anyone know?

Hibernate will create the database when the entity manager factory is
created (actually when Hibernate's SessionFactory is created by the
entity manager factory). If a file named import.sql exists in the root
of the class path ('/import.sql') Hibernate will execute the SQL
statements read from the file after the creation of the database
schema. It is important to remember that before Hibernate creates the
schema it empties it (delete all tables, constraints, or any other
database object that is going to be created in the process of building
the schema).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top