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

Bug 355415

Summary: Create JPA project and Add New JPA Entity and receive Stack Overflow Error
Product: [WebTools] Dali JPA Tools Reporter: Jolene Moffitt <jolene.moffitt>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: brian.vosburgh, karenfbutzke, nan.n.li, neil.hauge
Version: 3.0Flags: neil.hauge: review+
Target Milestone: 3.0.2   
Hardware: PC   
OS: Windows Mobile 2003   
Whiteboard:
Attachments:
Description Flags
proposed patch against 3.0 maintenance
none
proposed patch against 3.0 maintenance none

Description Jolene Moffitt CLA 2011-08-22 13:40:10 EDT
Using wtp build I-3.4.0-20110822071621 
Select File > New > JPA Project
Enter name (JPA 2.0 EL 2.2 Project)
Select JPA 2.0 and Target runtime (jdk1.6.0_18)
Click on Next button twice
Select EclipseLink 2.2.x, EclipseLink Library 2.2.0, Oracle 11g DB (connect)
Check Create mapping file check box
Click on Finish button
Select File > New > JPA Entity
Enter java_package for Java package name, Employee for Class name
Check the Add to entity mappings in XML checkbox
Click on Next button
Click on Add button - Add the following 2 Entity fields
Type - java.lang.String, Name - Emp_Id
Type - java.lang.String, Name - L_Name
Click on Finish button
Receive java.lang.StackOverflowError

java.lang.StackOverflowError
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:473)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
	at org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType.getValidationTextRange(GenericOrmPersistentType.java:1317)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTypeMapping.getValidationTextRange(AbstractOrmTypeMapping.java:474)
Comment 1 Neil Hauge CLA 2011-08-23 17:46:18 EDT
Update: So far Karen and I have been unable to reproduce this problem.  I've actually been unable to have the code go down this execution path following the reproduction steps so this is definitely a bit strange.  Will require some more investigation.
Comment 2 Neil Hauge CLA 2011-08-25 17:36:26 EDT
Jolene, can you reproduce this over and over, or is it just something you saw once?  Could you attache a project that produces this?
Comment 3 Jolene Moffitt CLA 2011-08-30 09:57:38 EDT
This can be re-created over and over in Build I-3.4.0-20110822071621, however I got a new build this week Build I-3.4.0-20110826171354 and it works fine without error running the automated test suite and running the test manually per the steps listed.
Comment 4 Jolene Moffitt CLA 2011-09-07 13:01:54 EDT
I got the latest builds on Monday for Maintenance 3.3.1-20110906011014 and Integration 3.4.0-20110904212209 and when I ran the automated tests Bug 355415 fails on the Integration Build but passes on the Maintenance build.  I also ran it manually and can re-create it on the Integration build (If you check the key checkbox for one of the entity fields it happens everytime).
Comment 5 Nan Li CLA 2011-09-27 18:18:02 EDT
FYI. I got the same error with the same steps today with the target platform of M-3.3.1-20110914031739.
Comment 6 Karen Butzke CLA 2011-11-08 09:34:02 EST
Created attachment 206596 [details]
proposed patch against 3.0 maintenance

This patch is against 3.0 maintenance, but it will be the same fix for 3.1
Comment 7 Neil Hauge CLA 2011-11-08 10:11:06 EST
(In reply to comment #6)

Is there a reason for the added getEntityMappings() method on AbstractOrmTypeMapping?
Comment 8 Karen Butzke CLA 2011-11-08 10:20:04 EST
Created attachment 206602 [details]
proposed patch against 3.0 maintenance

No there is not, originally I was calling getEntityMappings().getTextRange(), but decided to go with the Empty text range instead. This is really just working around the bug that the validation could run while the type mapping is in the process of being adding to the orm.xml. It prevents null text range exceptions out of the validation framework. With Brian's batch process code I think we should be able to get rid of this.
Comment 9 Karen Butzke CLA 2011-11-08 11:12:12 EST
fixed in HEAD
Comment 10 Neil Hauge CLA 2011-11-08 11:21:22 EST
Yep...looks good.  You probably already did this but you can axe the unused EntityMappings import after getting rid of that method.
Comment 11 Karen Butzke CLA 2011-11-08 12:33:03 EST
checked in for maintenance, yanked the import. Stupid team synchronize view doesn't remove my unused imports on save :)
Comment 12 Karen Butzke CLA 2011-11-08 12:33:38 EST
fixed
Comment 13 Jolene Moffitt CLA 2011-11-21 11:01:00 EST
Verified in Build M-3.3.2-20111117045640

Verified you can create JPA project without error using the steps and also running the Dali Automation Test Suite.  See the link to view test steps for verification.  http://wiki.eclipse.org/Dali_3.0.2