Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339243 - stack overflow in the update if you set an IdClass to an Entity that contains an IdClass
Summary: stack overflow in the update if you set an IdClass to an Entity that contains...
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 11:17 EST by Karen Butzke CLA
Modified: 2011-04-27 18:19 EDT (History)
1 user (show)

See Also:
neil.hauge: review+


Attachments
Proposed Patch (17.00 KB, patch)
2011-04-27 11:18 EDT, Nan Li CLA
neil.hauge: iplog+
Details | Diff
Additional Files (3.68 KB, patch)
2011-04-27 11:46 EDT, Nan Li CLA
neil.hauge: iplog+
Details | Diff
Additional File (1.58 KB, patch)
2011-04-27 18:09 EDT, Nan Li CLA
neil.hauge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.