Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339243

Summary: stack overflow in the update if you set an IdClass to an Entity that contains an IdClass
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Nan Li <nan.n.li>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: neil.hauge
Version: 3.0Flags: neil.hauge: review+
Target Milestone: 3.0 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed Patch
neil.hauge: iplog+
Additional Files
neil.hauge: iplog+
Additional File neil.hauge: iplog+

Description Karen Butzke CLA 2011-03-08 11:17:42 EST
The following Entity will result in a neverending update thread that eventually results in a stack overflow exception. You can see the update job running in eclipse and if you put a breakpoint in AbstractJpaNode.stateChanged() you will see the never ending building of an Entity with an IdClass reference that is an Entity with an IdClass reference...

If you realize what is wrong you can edit the code to remove the IdClass annotation and the update will stop.

@Entity
@IdClass(Address.class)
public class Address {

}
Comment 1 Nan Li CLA 2011-04-27 11:18:13 EDT
Created attachment 194168 [details]
Proposed Patch

The fixes are
1. if the given id class is mapped as an entity, embeddable or mapped superclass, we don't build the id class.
2. if the given id class is mapped as an entity, embeddable or mapped superclass, we give an error message saying id class should not be mapped.

Two additional message were added for the orm id class:
1. If the given class is an empty string, we give an error message saying id class has an empty name.
2. If the given class is nonexistent, we give an error message saying id class does not exist on the project classpath.

We didn't add the similar validation for the java id class because the existing validation of annotation and Eclipse can already do the same job.
Comment 2 Nan Li CLA 2011-04-27 11:46:46 EDT
Created attachment 194173 [details]
Additional Files

This patch includes the missing part of the previous one.
Comment 3 Nan Li CLA 2011-04-27 18:09:52 EDT
Created attachment 194220 [details]
Additional File

Missing "JptUiValidationPreferenceMessages"
Comment 4 Neil Hauge CLA 2011-04-27 18:18:36 EDT
Patch committed to head.