Bug 236109

Summary: remove native query from entity-mappings throws exception
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: 2.0Flags: neil.hauge: review+
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch - HEAD none

Description Karen Butzke CLA 2008-06-06 14:09:53 EDT
Select the EntityMappings node in the jpa structure view for an orm.xml file. Add a Named Native Query.  Remove the NamedNativeQuery from the source and you get an exception.  You can also get a similar exception sometimes removing it using the Details view 'Remove' button.  The same problem does not exist for NamedQueries

java.lang.IndexOutOfBoundsException: toIndex = 1
at java.util.SubList.<init>(AbstractList.java:705)
at java.util.RandomAccessSubList.<init>(AbstractList.java:861)
at java.util.AbstractList.subList(AbstractList.java:571)
at org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel.componentItemsRemoved(CompositeListValueModel.java:473)
at org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel$1.itemsRemoved(CompositeListValueModel.java:132)
at org.eclipse.jpt.utility.internal.model.ChangeSupport.fireItemsRemoved(ChangeSupport.java:1350)
at org.eclipse.jpt.utility.internal.model.ChangeSupport.fireItemsRemoved(ChangeSupport.java:1355)
at org.eclipse.jpt.utility.internal.model.SingleAspectChangeSupport.fireItemsRemoved(SingleAspectChangeSupport.java:212)
at org.eclipse.jpt.utility.internal.model.AbstractModel.fireItemsRemoved(AbstractModel.java:446)
at org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter.itemsRemoved(ListAspectAdapter.java:269)
at org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter$1.itemsRemoved(ListAspectAdapter.java:123)
at org.eclipse.jpt.utility.internal.model.ChangeSupport.fireItemRemoved(ChangeSupport.java:1439)
at org.eclipse.jpt.utility.internal.model.ChangeSupport.fireItemRemoved(ChangeSupport.java:1445)
at org.eclipse.jpt.utility.internal.model.AbstractModel.fireItemRemoved(AbstractModel.java:438)
at org.eclipse.jpt.utility.internal.model.AbstractModel.removeItemFromList(AbstractModel.java:612)
at org.eclipse.jpt.core.internal.context.orm.GenericEntityMappings.removeNamedNativeQuery_(GenericEntityMappings.java:462)
at org.eclipse.jpt.core.internal.context.orm.GenericEntityMappings.updateNamedNativeQueries(GenericEntityMappings.java:723)
at org.eclipse.jpt.core.internal.context.orm.GenericEntityMappings.update(GenericEntityMappings.java:575)
at org.eclipse.jpt.core.internal.context.orm.OrmXmlImpl.update(OrmXmlImpl.java:119)
Comment 1 Karen Butzke CLA 2008-06-10 14:30:42 EDT
Created attachment 104363 [details]
proposed patch - HEAD

This patch cleans up the property strings for named queries and named native queries
Comment 2 Karen Butzke CLA 2008-07-08 21:10:38 EDT
checked in to HEAD, haven't branched for 2.0.1 yet
Comment 3 Neil Hauge CLA 2008-08-21 16:49:20 EDT
Verified in wtp-sdk-R-3.0.1-20080818032401.