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.
Build 200911241400 I have a class that has a relationship marked as read only with the "insertable = false, updatable = false" modifiers for the joincolumn definition. The controller generated from it tries to update (write) to this relationship when I'm writing an entity causing cyclical behavior. I had to comment out the related code to make it stop.
Created attachment 91705 [details] Database Script Use this script to create the database then use the wizards to create the entities and then the controlers.
Created attachment 91707 [details] Modified controller class This is the modified class that makes it work. (Change only made in the create method)
Created attachment 91708 [details] JUnit test where the issue manifests I'm using EclipseLink 2.0. Not sure if this has something to do.
Unit test use VMUserJpaController for create but modified controller is UserModifiedRecordJpaController, is there the same problem in VMUserJpaController or it's wrong test?
The problem is in the relationship between the two. Check commented out code in UserModifiedRecordJpaController. Also the work done in the entity listener.
According to jpa spec insertable/updatable should be used just to control if this field will be used in INSERT/UPDATE sql command, looks like it's not prohibited to update this locally, but it will not be updated with commit in database and changes may be lost after commit. But may be I miss something as can't try test as is. What library should be used for DatabaseManager and MD5? I don't see it in eclipselink. Or is DatabaseManager/MD5 usage can be removed or replaced with just string/number and at what step the problem will appear? Do you mean UserModifiedRecordJpaController::create is called from some event handler? I don't see this usage if just generate entities and then jpa controllers and use attached unit test.
DatabaseManager and MD5 are classes defined in my project. VMUser has a persistence listener from which UserModifiedRecord is created. Looks like you need the whole project?
full project or part enough to see the issue, are you sure it's not because of your listener?
Is provoked by my listener but it goes like this: 1. An entity is changed/created/deleted so when its going to be stored an UserModified record is created. 2. When the record is created another change is triggered on VMUser (by their relationship) 3. Step 2 causes a loop unless the commented code is removed..
yes, it solve the problem, but it may not mean commented code is wrong, it's just one of places to break a loop.
SO how do I proceed?
I need to investigate a bit more. Also if you can share more from your project so there will be easy way to reproduce a problem from current realization it will be good.
Created attachment 94083 [details] Project source Here is the source. The test will make sense from it.
On first attempt have a problem with password reset in persistemce.xml, if I clean&build persitense.xml contain proper code with password set to appropriate value, after test execution password value is reset to "", and eclipselink can't connect to mysql with empty password, it's strange. Tried to create test myself and all works fine without password resetting. Still not sure it's an issue, but need to investigate a bit more.
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.