Hi,
I'm using hibernate (annotations) to auto create the structure for the SQL tables in my project. I would however, like to know the best practice for auto initializing a table with some default data.
More specifically I will have a table "Authorities":
|AUTHORITIES |
|ID | ROLE |
----------------------
| 0 | ROLE_XYZ|
| 1 | ROLE_123|
etc...
Users of the system would then associate with this table in a Many-To-One relationship.
Now enough of the boring background story. What I'd like to understand, is the method I should use to have a few ROLE (varchar) entries auto populated into the DB as the table is created.
Ideas I've considered thus far are:
ANT scripts
Alternately, using Enums.
If anyone has an idea on the best way to do this, please let me know.
Thanks in advance.
[b]Hibernate version:3.1.1
|