Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA Error when new entity is added without DropAndCreate
JPA Error when new entity is added without DropAndCreate [message #878336] Tue, 29 May 2012 05:27 Go to next message
Buddhika Ariyaratne is currently offline Buddhika AriyaratneFriend
Messages: 2
Registered: May 2012
Junior Member
I am developing a J2EE application with JSF, EclipseLink2 as JPA installation and mySQL as the back-end database with Netbeans. Application works fine except when I add new attributes to existing entities, or create new Entities. If I select the dropandcreate option in Persistance.xml file, the application runs again without errors, but it deletes the whole data base with previous entries. When I go to production, I can not afford to lose data of the database when I add a new entity. Is there any way to overcome this. I tried to use a database schema, but could not figure how to do it. Thanks in advance
Re: JPA Error when new entity is added without DropAndCreate [message #878522 is a reply to message #878336] Tue, 29 May 2012 13:29 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If you use create-tables instead of drop-and-create-tables then it will not delete your data. In production, you should probably remove the schema generation entirely as you will already have the production database defined.

EclipseLink 2.4 will also add a create-or-extend-tables option.


James : Wiki : Book : Blog : Twitter
Re: JPA Error when new entity is added without DropAndCreate [message #878536 is a reply to message #878522] Tue, 29 May 2012 13:47 Go to previous message
Buddhika Ariyaratne is currently offline Buddhika AriyaratneFriend
Messages: 2
Registered: May 2012
Junior Member
I want to add attributes to existing entities, but when I use create option, it add new entities, but do not add new fields to existing tables. I can not assure 100% that there will be no possibility to add a new attribute during the production phase. So best thing is to wait till EclipseLink 2.4 is available. Will it allow adding new attributes will be update the database with new fields without deleting existing data? When will it be released?
Previous Topic:eclipselink 2.4 mongodb with criteria api
Next Topic:[SOLVED] How to register pre/post refresh callbacks on an entity?
Goto Forum:
  


Current Time: Thu Apr 18 23:33:03 GMT 2024

Powered by FUDForum. Page generated in 0.01785 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top