File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes persistence.xml create tables only when needed Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "persistence.xml create tables only when needed" Watch "persistence.xml create tables only when needed" New topic
Author

persistence.xml create tables only when needed

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 136
Hi,

with persistence.xml specifying table creation strategy, I can have the tables automatically created when deployed.

However, I noticed that when I redeploy the app., it still tries to recreate the table because of the table creation strategy is "create". Should not it be smart enough to know that the tables already exist?

I sure can set the strategy to "None" to avoid creation, but that means I have to change the descriptor file after initial deployment, is there a better solution?


Thanks,
Yan
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
This behavior is controlled by Persistence Provider-specific properties.

For example, for Hibernate you can specify a property

[ December 21, 2006: Message edited by: Edvins Reisons ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: persistence.xml create tables only when needed
 
Similar Threads
"hibernate.hbm2ddl.auto">create - to generate DB Tables
JPA EclipseLink SEQUENCE table does not exist
How to Create Auto Schema
Does the persistence layer know when the database has changed?
Hibernate: table per class inheritance