• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

persistence.xml create tables only when needed

 
Yan Zhou
Ranch Hand
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic