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.
Here is a simplified database schema (to recreate a problem): CREATE table a ( aid int not null, aname varchar(10), PRIMARY KEY (aid)); CREATE TABLE b ( bid1 int not null, bid2 int not null, aid int not null, bname varchar(10), PRIMARY KEY (bid1, bid2), FOREIGN KEY (aid) REFERENCES a(aid)); CREATE TABLE c ( cid1 int not null, cid2 int not null, cid3 int not null, cname varchar(10), PRIMARY KEY (cid1, cid2, cid3), FOREIGN KEY (cid1, cid2) REFERENCES b(bid1, bid2)); 1) create these 3 tables in your database (I use postgres) 2) create new EJB3 project 3) create new persistance unit 4) create DB schema from those 3 tables You created in step 1. 5) create Entity Classes from Database (under Persistance) NB 5.5 daily build is failing to create classes with following message: javax.jmi.reflect.InvalidObjectException: Object with MOFID 6ADF3B4D-D438-11DA-985D-44F2CC5EAA77:000000000000055B no longer exists, class: org.netbeans.jmi.javamodel.JavaClass$Impl at org.netbeans.mdr.handlers.BaseObjectHandler._getDelegate(BaseObjectHandler.java:359) at org.netbeans.mdr.handlers.InstanceHandler.getInstanceDelegate(InstanceHandler.java:48) at org.netbeans.mdr.handlers.InstanceHandler._immediateComposite(InstanceHandler.java:251) at org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement._immediateComposite(MetadataElement.java:1858) at org.netbeans.mdr.handlers.InstanceHandler.refImmediateComposite(InstanceHandler.java:243) at org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.getResource(MetadataElement.java:537) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.JavaPersistenceGenerator.generateBeans(JavaPersistenceGenerator.java:425) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.createBeans(RelatedCMPWizard.java:241) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.access$100(RelatedCMPWizard.java:42) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard$2.run(RelatedCMPWizard.java:191) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926) Only classes this Wizard has created is A.java, C.java and CPK.java. There is a problem creating B class which contains 2 different relations both to A and C classes.
I tired this scenario and I get slightly different exception. Interesting thing is that when I generate Entity classes from bundled database tables everything is ok (there are some exceptions from NNModelBuilder, but those are already reported). When I tried it from A,B,C tables I have this: java.lang.IllegalArgumentException: Illegal element type 4097!=4098 at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.matchElementInfo(SemiPersistentElement.java:384) at org.netbeans.modules.javacore.jmiimpl.javamodel.AttributeValueImpl.matchElementInfo(AttributeValueImpl.java:222) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.setElementInfo(SemiPersistentElement.java:140) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.createChildrenList(SemiPersistentElement.java:937) at org.netbeans.modules.javacore.jmiimpl.javamodel.AnnotationImpl.initChildren(AnnotationImpl.java:268) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.setElementInfo(SemiPersistentElement.java:146) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.createChildrenList(SemiPersistentElement.java:937) at org.netbeans.modules.javacore.jmiimpl.javamodel.FeatureImpl.initChildren(FeatureImpl.java:63) at org.netbeans.modules.javacore.jmiimpl.javamodel.FieldImpl.initChildren(FieldImpl.java:106) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.setElementInfo(SemiPersistentElement.java:146) at org.netbeans.modules.javacore.jmiimpl.javamodel.JavaClassImpl.initChildren(JavaClassImpl.java:723) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.setElementInfo(SemiPersistentElement.java:146) at org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.initChildren(ResourceImpl.java:332) at org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.initChildren(ResourceImpl.java:316) at org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.setElementInfo(SemiPersistentElement.java:146) at org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.updateMetadata(ResourceImpl.java:762) at org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.resetAST(ResourceImpl.java:523) at org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.parseResource(ResourceImpl.java:901) at org.netbeans.modules.javacore.ExclusiveMutex.notifyElements(ExclusiveMutex.java:525) at org.netbeans.modules.javacore.ExclusiveMutex.leave(ExclusiveMutex.java:359) at org.netbeans.mdr.NBMDRepositoryImpl.endTrans(NBMDRepositoryImpl.java:249) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.JavaPersistenceGenerator.generateBeans(JavaPersistenceGenerator.java:424) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.createBeans(RelatedCMPWizard.java:241) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.access$100(RelatedCMPWizard.java:42) at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard$2.run(RelatedCMPWizard.java:191) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926)
Same here - a bunch of exceptions, though different then from MM. I did get the classes generated and they compile and look ok. But I get exceptions from JMI when I open them. Investigating...
Created attachment 30104 [details] Exceptions from console netbeans is run from
i've attached a copy of log output 5.5-daily(latest) is generating on a console during that wizard process.
Same as issue 74117?
No, the NNModelBuilder exceptions seem to be mostly harmless. I see that the problem is caused by the foreign key in table c which references 2 columns. If I change this to reference table a everything works ok. FOREIGN KEY (cid1, cid2) REFERENCES b(bid1, bid2)); I will look further. Rochelle, let me know if you see what is the problem.
this would be a snippet from C entity (IMHO) after wizard has completed: ... @EmbeddedId protected CPK cPK; ... ... @JoinColumns(value = {@JoinColumn(name = "cid1", referencedColumnName="bid1", insertable=false, updatable=false), @JoinColumn(name = "cid2", referencedColumnName="bid2", insertable=false, updatable=false)}) @ManyToOne private B b; ... ... And entity B: ... ... @OneToMany(cascade = CascadeType.ALL, mappedBy="b", fetch=FetchType.LAZY) private java.util.Collection<C> c; At least this is what works if I create all those etities by hand (in real application).
The problem apears to be in generation of this code: @JoinColumns(value = {@JoinColumn(name = "CID1"), @JoinColumn(name = "CID2")}) It actually gets generated, but numerous exceptions are thrown. After I restart the IDE everything works fine. Altough I do not know internals of JMI the exception apears to be related to array initialization with annotations in it. I would appreciate any ideas from JMI experts. The code is in: http://j2ee.netbeans.org/source/browse/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/JavaPersistenceGenerator.java?only_with_tag=release55 lines 329-337, and it calls heavily: http://j2ee.netbeans.org/source/browse/j2ee/metadata/src/org/netbeans/modules/j2ee/metadata/Attic/JMIGenerationUtil.java?only_with_tag=release55
BTW issue 74117 also has the getDelegate exception in the log (in addition to the NNModelBuilder exceptions).
R: maybe you are right, I missed it in between all those exceptions. Let's test 74117 after this one gets fixed.
Reproducible in javacore/tests.
Caused by this integration (issue #75226): Merged into trunk. /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java new revision: 1.32; previous revision: 1.31
Fixed in trunk na release55 branch. Exception "java.lang.IllegalArgumentException: Illegal element type 4097!=4098" shouldn't be no longer reproducible. Checking in org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java,v <-- AnnotationImpl.java new revision: 1.19.4.5.2.4; previous revision: 1.19.4.5.2.3 done Checking in org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java,v <-- AnnotationImpl.java new revision: 1.33; previous revision: 1.32 done
Please, merge the fix in release55_beta branch as well. Thanks.
I tried NB5.5 build from 27 of April (latest from downloads site) and yes indeed - now classes get generated but I do get a lot of exceptions while wizard finishes (like IAE) and NPE and ISE when opening generated entity C java file (similar to: ------- Additional comments from pbuzek Thu Apr 27 18:06:45 +0000 2006 -------). I'm also attaching output from NB console log while wizard were doing a code generation and then opening entity C class in editor.
Merged to release55_beta. Problem in Array initialization described by Pavel B. has to be fixed too. (I will try to resolve it today.) Tag: release55_beta User: pflaska Date: 06/04/28 04:51:10 Modified: /java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ AnnotationImpl.java Log: #75598: Regression fixed. Caused by integration of fix #75226.
Created attachment 30131 [details] console log as promised
So can this be marked as fixed? Thanks.
Now it is fixed in trunk, release55 and release55_beta. Checking in org/netbeans/modules/javacore/jmiimpl/javamodel/DeferredAttrList.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/DeferredAttrList.java,v <-- DeferredAttrList.java new revision: 1.3; previous revision: 1.2 done Checking in DeferredAttrList.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/DeferredAttrList.java,v <-- DeferredAttrList.java new revision: 1.2.100.1; previous revision: 1.2 done Checking in DeferredAttrList.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/DeferredAttrList.java,v <-- DeferredAttrList.java new revision: 1.2.108.1; previous revision: 1.2 done
*** Issue 75622 has been marked as a duplicate of this issue. ***
Just for clarification: Originally reported exception was correct. Then, Martin Adamek reported different exception which was caused by regression made by our team. My first commit fixed only the regression. Then, the original problem was fixed. Thanks for valuable help to Martin Matula and Tomas Hurka!
This works for this schema, but there is still a getDelegate exception using the dbschema in issue 74117. I'll attach the updated stack trace there and add the jmi folks to the cc there.
verified in release55_beta