[jboss-user] [JBoss Seam] - Re: when and how does the seam create tables in the databas

bfo81 do-not-reply at jboss.com
Thu Aug 31 04:50:25 EDT 2006


In a Seam project (or maybe for kinds of EJB projects using Hibernate?) the database is created during server start (plus import.sql gets imported). This is an important difference to e.g. AppFuse (Spring + Hibernate), where the database gets created by an ant task which you have to call explicetly (btw. this is the better solution in my opinion... but you can argue about that *g*).

The line texan made bold is an important one. There are two values (as far as I know), and I experienced the following behaviour:

create-drop: The database is recreated every time your server starts. If there is already a database it gets dropped before, so all your data entries vanish.

update: The database is only created once, and your data "survives" server restarts. But if you change your entities by adding new fields the new fields get created in the database, too (upon server restart, remember ;)). If you delete entity bean fields the fields in the database remain. And if you change fields (e.g. from type Long to String, or from @ManyToOne to @ManyToMany) you will run into trouble, so you better do not do this ;).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968570#3968570

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968570



More information about the jboss-user mailing list