This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 133651 - Setting in persistence.xml to drop-and-create has no effect
Summary: Setting in persistence.xml to drop-and-create has no effect
Status: RESOLVED WORKSFORME
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Vince Kraemer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-22 12:29 UTC by ieising
Modified: 2008-05-02 02:28 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ieising 2008-04-22 12:29:24 UTC
Hi,
 
I found that when I run or debug my project the setting in persistence.xml when set to drop-and-create has no effect.
The tables are not dropped. The only way to get it working correctly is to undeploy-deploy the project. Or to exit
Netbeans and restart it again.
In NB60 this works perfectly.
 
So the scenario is:
- Start NB61
- Run application
- Tables are dropped and created
- Stop GF
- Run application
- Tables are not dropped
 
Alternatively:
- Start NB61
- Run application
- Tables are dropped and created
- Undeploy-deploy the application
- Tables are not dropped
 
This behavior is found in GF v2, v2-ur1 and v2-ur2.
 
Iwan
Comment 1 Petr Blaha 2008-04-22 13:47:38 UTC
Does the clean&build of the project help?
Comment 2 ieising 2008-04-22 14:10:19 UTC
No, only an undeploy/deploy seems to help. I verified this in NB61RC2. In NB60 it works all the time.

Iwan
Comment 3 Petr Blaha 2008-04-22 15:02:04 UTC
I guess that this behavior is related to enabled directory deployments. I tested to disable this option in RC2 and
everything works as expected, e.g. when you just run app then tables are dropped/created. Please, try to righ-click
server node in service tab and invoke Properties -> Options tab and uncheck  'Directory deployment' option.
Comment 4 ieising 2008-04-22 22:39:29 UTC
When disabling the directory deployment option as suggested, it does in fact work, and the tables are dropped and
recreated. Please note that in NB60 directory deployment is enabled and it still works. I tried this procedure with both
NB60 and NB61RC1 and NB61RC2 for GFv2, GFv2ur1 and GFv2ur2.

Iwan
Comment 5 Andrei Badea 2008-04-25 13:57:01 UTC
Not caused by the persistence support per se. I can't tell when the server recreates the EntityManagerFactory for the
persistence unit (which I suppose triggers the drop and create), so reassigning to the plugin.
Comment 6 Vince Kraemer 2008-04-30 00:53:31 UTC
I added code that would avoid calling for deployment processing on Run if the app's java code is unchanged...  this
allows folks to have faster Run-> edit jsp-> Run response times. I guess that was too aggressive.

Andrei: Is there an API that will tell me if the drop-and-create element is present in the persistence.xml of a module?
Comment 7 Vince Kraemer 2008-05-02 02:28:18 UTC
Here is what i have found...

i registered gf
i created the webjpa sample project which became the main project...
i started the db
i started the server
i used the Run Main Project item in the Run menu to run the webjpa project
   the tables were created
i added data to the table through the interface that webjpa provides
i verified that the data was in the table.
I stopped the server
i used the Run Main Project item in the Run menu to run the project (which restarts the server)
i saw that there was still data in the table
I used the Undeploy and Deploy item on the project's right click menu
I verified that the tables were empty

That seems like it is doing what we would expect.... Run doesn't always mean deploy.

Undeploy and deploy appears to force the web app to be redeployed, even if the redeployment is not strictly necessary.

I am going to close this as worksforme.