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

Bug 313799

Summary: Null text range exception with generator in both orm.xml and eclipselink-orm.xml
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jolene.moffitt, neil.hauge
Version: 2.3Flags: neil.hauge: review+
Target Milestone: 2.3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch against head none

Description Karen Butzke CLA 2010-05-20 15:18:06 EDT
Create an EclipseLink project with an orm.xml file and an eclipselink-orm.xml file.  Add the following java entity to the project and specify the entity in both the orm.xml file and eclipse-orm.xml file. Save the files. When the validation runs it will hit the below IllegalArgumentException.  The exception is logged and the validation continues. The error still appears just with no location info inside the file. This is an incorrect validation since the generator in question is being defaulted in to the mappings files.


@Entity
public class Employee {
    @Id
    @GeneratedValue(strategy=SEQUENCE, generator="EMPLOYEE_SEQUENCE_GENERATOR")
    @SequenceGenerator(name="EMPLOYEE_SEQUENCE_GENERATOR", sequenceName="EMPLOYEE_SEQ", allocationSize=10)
	private int id;
}



java.lang.IllegalArgumentException: Null text range for message ID: GENERATOR_DUPLICATE_NAME
at org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages.buildMessage(DefaultJpaValidationMessages.java:51)
at org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer.validateGenerators(GenericOrmGeneratorContainer.java:189)
at org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer.validate(GenericOrmGeneratorContainer.java:180)
at org.eclipse.jpt.core.internal.context.orm.AbstractOrmIdMapping.validate(AbstractOrmIdMapping.java:362)
Comment 1 Karen Butzke CLA 2010-06-18 12:03:09 EDT
Created attachment 172226 [details]
proposed patch against head

This patch changes the Generator.duplicates(Generator) logic such that a virtual generator is not a duplicate of another generator. This patch does not solve the problem where a generator is specified in both the orm.xml file and the eclipselink-orm.xml file as this is a larger bug about the eclipselink-orm.xml being an override of all other mappings files (bug 251237)
Comment 2 Karen Butzke CLA 2010-06-24 14:53:41 EDT
resolved in HEAD for 2.3.1 maintenance
Comment 3 Jolene Moffitt CLA 2010-07-23 10:24:51 EDT
Verified in wtp-R3.2.1-M: M-3.2.1-20100716070539 build, by creating a project, adding the documented entity and adding it to the eclipse-orm.xml and orm.xml files.  The error no longer appears.