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.
When more than one entity is generated by the EntitiesFromDBGenerator then usually just one of them appear in the model. The second didn't appear in the model until the restart of the IDE. Steps to reproduce: 1. Open or create some java project. 2. Create some package in the project (this is just a workaround for another issue - creation of a form together with a new package doesn't work well). 3. Open Master/Detail Form wizard (New File > Java GUI Forms > Sample Forms). 4. Specify name of the form and existing package on the first tab. 5. On the second tab: select DB connection to sample DB of GlassFish; select DISCOUNT_CODE table 6. On the third tab select Table choice and CUSTOMER table. 7. Press Finish. 8. Wait approximately 40s - we are waiting for both entities (DiscountCode and Customer) to appear in the model. By now the Customer and DiscountCode entity classes are generated, but the model don't know about them. When I tried this use-case, just the DiscountCode entity was in the model, but Customer wasn't there. Note that it doesn't help to wait for even a longer time. The entity will not appear in the model until restart of the IDE. Marking this issue as a high priority one because it makes Master/Detail wizard unusable (the generated form is not correct because we didn't have information about the entities).
No "added" ClassIndex events seem to be sent for DiscountCode, only "changed" events. Tomasi, could you please look at it? I can work around by checking if changed types are entity classes (which I should do anyway), but still, the "added" events should be sent too. With the following diff to ClassIndexImpl -----%<----- Index: ClassIndexImpl.java =================================================================== RCS file: /cvs/java/source/src/org/netbeans/modules/java/source/usages/ClassIndexImpl.java,v retrieving revision 1.4 diff -u -r1.4 ClassIndexImpl.java --- ClassIndexImpl.java 11 Apr 2007 11:45:51 -0000 1.4 +++ ClassIndexImpl.java 20 Apr 2007 10:26:41 -0000 @@ -107,12 +107,15 @@ ClassIndexImplListener l = lr.get(); if (l != null) { if (added != null) { + System.out.println("added " + added.getTypes()); l.typesAdded(added); } if (removed != null) { + System.out.println("removed " + removed.getTypes()); l.typesRemoved(removed); } if (changed != null) { + System.out.println("changed " + changed.getTypes()); l.typesChanged(changed); } } -----%<----- I obtained the attached log, which does not contain an "added" event for DiscountCode.
Created attachment 41329 [details] Events
Don't you generate the classes by java.io.File? Are the generated classes visible in the GoToType?
The files are created using GenerationUtils, which uses DataObject.createFromTemplate(). I assume that uses FileObject's, right? Yes, both classes are visible in Go To Type.
I just got "added" events for both classes during a debug session.
Adding some logging and checking and adding new objects to the model also on "changed" events. This needs to be done anyway, and in this case it also works around the "added" events not being sent. Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/AnnotationScanner.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/AnnotationScanner.java,v <-- AnnotationScanner.java new revision: 1.3; previous revision: 1.2 done Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/ObjectProvider.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/ObjectProvider.java,v <-- ObjectProvider.java new revision: 1.3; previous revision: 1.2 done Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObject.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObject.java,v <-- PersistentObject.java new revision: 1.3; previous revision: 1.2 done Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManager.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManager.java,v <-- PersistentObjectManager.java new revision: 1.4; previous revision: 1.3 done Checking in j2ee/metadata/support/test/unit/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManagerTest.java; /cvs/j2ee/metadata/support/test/unit/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManagerTest.java,v <-- PersistentObjectManagerTest.java new revision: 1.4; previous revision: 1.3 done Checking in j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityImpl.java; /cvs/j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityImpl.java,v <-- EntityImpl.java new revision: 1.3; previous revision: 1.2 done Checking in j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityMappingsImpl.java; /cvs/j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityMappingsImpl.java,v <-- EntityMappingsImpl.java new revision: 1.4; previous revision: 1.3 done
Previous commit had a commit log referring to issue 101719 instead of this one. Committing again with the right commit log. Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/AnnotationScanner.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/AnnotationScanner.java,v <-- AnnotationScanner.java new revision: 1.5; previous revision: 1.4 done Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/ObjectProvider.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/ObjectProvider.java,v <-- ObjectProvider.java new revision: 1.5; previous revision: 1.4 done Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObject.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObject.java,v <-- PersistentObject.java new revision: 1.5; previous revision: 1.4 done Checking in j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManager.java; /cvs/j2ee/metadata/support/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManager.java,v <-- PersistentObjectManager.java new revision: 1.6; previous revision: 1.5 done Checking in j2ee/metadata/support/test/unit/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManagerTest.java; /cvs/j2ee/metadata/support/test/unit/src/org/netbeans/modules/j2ee/metadata/model/api/support/annotation/PersistentObjectManagerTest.java,v <-- PersistentObjectManagerTest.java new revision: 1.6; previous revision: 1.5 done Checking in j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityImpl.java; /cvs/j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityImpl.java,v <-- EntityImpl.java new revision: 1.5; previous revision: 1.4 done Checking in j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityMappingsImpl.java; /cvs/j2ee/persistenceapi/src/org/netbeans/modules/j2ee/persistenceapi/metadata/orm/annotation/EntityMappingsImpl.java,v <-- EntityMappingsImpl.java new revision: 1.6; previous revision: 1.5 done
The remaining part is up to Tomas, assigning to Java module.
*** Issue 102161 has been marked as a duplicate of this issue. ***
J1_STOPPER? Probably I've missed something. To reproduce this issue I have to turn off "workaround" which is in the frozen trunk. So even if I fix this no one in trunk or tomorrow on the branch will notice anything. Can you explain more deeply what effect will have the fix on J1 build except of possible destabilization?
I've did some changes to prevent javac to generate more signature files + logging. But it seems that problem is somewhere in model. See attached log file. The TYPES_ADDED events are fired from ClassIndex for all the generated classes, but the wizard crashes. It's strange that at the beginning there are 2 ClassIndexes and after while there are 4.
Created attachment 41660 [details] log file
Created attachment 41661 [details] RepositoryUpdater diff which fixes the java side and does logging
I'm sorry, I thought that the issue isn't workarounded and should be fixed in java module. In case nobody is able to reproduce in the latest daily build, let's to downgrade, remove SW and fix after M9.
If Andrei's workaround works fine I will be rather not to integrate it into M9 since it seems that the fix is not isolated in single (java) module.
jstola or jvagner can you check whether Andrei's workaround resolves the issue? Thanks, Petr
Cool, now Master/Detail Form wizard works perfectly. NetBeans IDE Dev (Build 20070426-0113) 1.6.0_02-ea; Java HotSpot(TM) Client VM 1.6.0_02-ea-b02 Linux version 2.6.17-10-386 running on i386 en_US (nb); UTF-8
I suggest to downgrade the bug now since workaround works.
Workaround exists, decreasing priority.
http://java.netbeans.org/source/browse/java/source/src/org/netbeans/modules/java/source/usages/RepositoryUpdater.java?r1=1.53&r2=1.54