This content has been marked as final.
Show 3 replies
-
1. Re: Will EJB delete tables automatically
wolfgangknauf Nov 11, 2009 4:56 AM (in response to james4u)Hi,
this is the default behavior, which is declared in "persistence.xml":<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="myPersistenceUnit"> <jta-data-source>java:/DefaultDS</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> </properties> </persistence-unit> </persistence>
See here (last table in the chapter) for other values: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-optional
Best regards
Wolfgang -
2. Re: Will EJB delete tables automatically
james4u Nov 11, 2009 1:50 PM (in response to james4u)Hi Wolfgang,
Thanks for your reply. But, I have a doubt. In real-time scenario where user details are stored in a database table, do we let the server drop the tables? Or is there a mechanism where we can restore the data or automatically cache it in the server files? -
3. Re: Will EJB delete tables automatically
jaikiran Nov 12, 2009 2:56 AM (in response to james4u)"james4u" wrote:
But, I have a doubt. In real-time scenario where user details are stored in a database table, do we let the server drop the tables? Or is there a mechanism where we can restore the data or automatically cache it in the server files?
In production environments, the DB is created only once. This setting in the persistence.xml is turned off to avoid any kind of changes to the schema or contents during the entitymanagerfactory creation.