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

Bug 333488

Summary: Serializable attribute being defaulted to a variable one to one mapping and causing exception
Product: z_Archived Reporter: Guy Pelletier <guy.pelletier>
Component: EclipselinkAssignee: Guy Pelletier <guy.pelletier>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.orm-inbox, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed changes none

Description Guy Pelletier CLA 2011-01-04 11:02:22 EST
The following model (from the mailing lists):

@Entity
public class Parameter {
    @Id
    private Long id;

    private Serializable parameterValue;

    public Serializable getParameterValue() {
        return parameterValue;
    }

    public void setParameterValue(Serializable parameterValue) {
        this.parameterValue = parameterValue;
    }   
}

Causes the following exception to occur at runtime:

junit.framework.AssertionFailedError: Error persisting the Parameter : javax.persistence.RollbackException: Exception [EclipseLink-6168] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.QueryException
Exception Description: Query failed to prepare, unexpected error occurred: [java.lang.IndexOutOfBoundsException: Index: 0, Size: 0].
Internal Exception: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Query: DoesExistQuery(referenceClass=String )
	at junit.framework.Assert.fail(Assert.java:47)
	at org.eclipse.persistence.testing.tests.jpa.ddlgeneration.DDLGenerationJUnitTestSuite.testUserIssue(DDLGenerationJUnitTestSuite.java:1382)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:499)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Comment 1 Guy Pelletier CLA 2011-01-04 11:16:27 EST
Work around is to add @Basic to "parameterValue"
Comment 2 Tom Ware CLA 2011-01-13 11:21:26 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 3 Guy Pelletier CLA 2011-01-25 15:10:35 EST
Created attachment 187569 [details]
Proposed changes
Comment 4 Guy Pelletier CLA 2011-01-25 15:19:10 EST
Changes have been submitted.

Reviewed by: Chris Delahunt

Tests: No, metadata processing exception. Model change made to expose the error and cause the exception. With fix in place, no exceptions are thrown and all tests (FullRegressionTestSuite and extended JPA) pass successfully.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:03:47 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink