Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 220798 Details for
Bug 372092
Exceptions using generics, embedded key and entity inheritance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Submitted patch to 2.4.1 and trunk
patch372092.patch (text/plain), 8.68 KB, created by
Guy Pelletier
on 2012-09-06 13:06:12 EDT
(
hide
)
Description:
Submitted patch to 2.4.1 and trunk
Filename:
MIME Type:
Creator:
Guy Pelletier
Created:
2012-09-06 13:06:12 EDT
Size:
8.68 KB
patch
obsolete
>From 53c7ec580d14fb5482a9dc47a49a78d51d34cd01 Mon Sep 17 00:00:00 2001 >From: gpelletie <guy.pelletier@oracle.com> >Date: Thu, 6 Sep 2012 11:49:48 -0400 >Subject: [PATCH] Bug 372092 - EclipseLink dynamic entity does not support > embedded-id > >Existing Inherited model using single letter generics modified to expose error (metadata processing). With fix in place, error goes away and all tests (FullRegressionTestSuite and ExtendedJPATests) pass successfully. > >Reviewed: James Sutherland. >--- > .../testing/models/jpa/inherited/Beer.java | 16 +++++---- > .../testing/models/jpa/inherited/Beverage.java | 10 +++--- > .../accessors/objects/MetadataAsmFactory.java | 42 +++++++++++++++------- > 3 files changed, 44 insertions(+), 24 deletions(-) > >diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beer.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beer.java >index 2999643..95c63d9 100644 >--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beer.java >+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beer.java >@@ -15,6 +15,8 @@ > * -311395 : Multiple lifecycle callback methods for the same lifecycle event > * 08/11/2010-2.2 Guy Pelletier > * - 312123: JPA: Validation error during Id processing on parameterized generic OneToOne Entity relationship from MappedSuperclass >+ * 10/05/2012-2.4.1 Guy Pelletier >+ * - 373092: Exceptions using generics, embedded key and entity inheritance > ******************************************************************************/ > package org.eclipse.persistence.testing.models.jpa.inherited; > >@@ -37,11 +39,11 @@ import java.sql.Timestamp; > > @MappedSuperclass > @ExistenceChecking(CHECK_CACHE) >-public class Beer<G, H, I> extends Beverage<G> { >+public class Beer<PK, ALCOHOL_CONTENT_TYPE, BeerDoubleType> extends Beverage<PK> { > private Timestamp version; >- private H alcoholContent; >+ private ALCOHOL_CONTENT_TYPE alcoholContent; > private BeerConsumer beerConsumer; >- private I beerDouble; >+ private BeerDoubleType beerDouble; > > public static int BEER_PRE_PERSIST_COUNT = 0; > public static int BEER_POST_PERSIST_COUNT = 0; >@@ -66,7 +68,7 @@ public class Beer<G, H, I> extends Beverage<G> { > > @Basic > @Column(name="ALCOHOL_CONTENT") >- public H getAlcoholContent() { >+ public ALCOHOL_CONTENT_TYPE getAlcoholContent() { > return alcoholContent; > } > >@@ -79,7 +81,7 @@ public class Beer<G, H, I> extends Beverage<G> { > @OneToOne(fetch=LAZY) > //@OneToOne > @JoinColumn(name="BD_ID") >- public I getBeerDouble() { >+ public BeerDoubleType getBeerDouble() { > return beerDouble; > } > >@@ -88,7 +90,7 @@ public class Beer<G, H, I> extends Beverage<G> { > return version; > } > >- public void setAlcoholContent(H alcoholContent) { >+ public void setAlcoholContent(ALCOHOL_CONTENT_TYPE alcoholContent) { > this.alcoholContent = alcoholContent; > } > >@@ -96,7 +98,7 @@ public class Beer<G, H, I> extends Beverage<G> { > this.beerConsumer = beerConsumer; > } > >- public void setBeerDouble(I beerDouble) { >+ public void setBeerDouble(BeerDoubleType beerDouble) { > this.beerDouble = beerDouble; > } > >diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beverage.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beverage.java >index 3db118a..fe0c489 100644 >--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beverage.java >+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/inherited/Beverage.java >@@ -13,6 +13,8 @@ > * - 232975: Failure when attribute type is generic > * 07/15/2010-2.2 Guy Pelletier > * -311395 : Multiple lifecycle callback methods for the same lifecycle event >+ * 10/05/2012-2.4.1 Guy Pelletier >+ * - 373092: Exceptions using generics, embedded key and entity inheritance > ******************************************************************************/ > package org.eclipse.persistence.testing.models.jpa.inherited; > >@@ -24,10 +26,10 @@ import javax.persistence.MappedSuperclass; > import static javax.persistence.GenerationType.*; > > @MappedSuperclass >-public class Beverage<T> { >+public class Beverage<PK> { > public static int BEVERAGE_POST_PERSIST_COUNT = 0; > >- private T id; >+ private PK id; > > public Beverage() {} > >@@ -39,11 +41,11 @@ public class Beverage<T> { > pkColumnName="SEQ_NAME", > valueColumnName="SEQ_COUNT", > pkColumnValue="BEVERAGE_SEQ") >- public T getId() { >+ public PK getId() { > return id; > } > >- public void setId(T id) { >+ public void setId(PK id) { > this.id = id; > } > >diff --git a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java >index 7638f6e..08b7651 100644 >--- a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java >+++ b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/accessors/objects/MetadataAsmFactory.java >@@ -1,7 +1,5 @@ >-package org.eclipse.persistence.internal.jpa.metadata.accessors.objects; >- > /******************************************************************************* >- * Copyright (c) 1998, 2010 Oracle, Hans Harz, Andrew Rustleund. All rights reserved. >+ * Copyright (c) 1998, 2012 Oracle, Hans Harz, Andrew Rustleund. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 > * which accompanies this distribution. >@@ -17,7 +15,11 @@ package org.eclipse.persistence.internal.jpa.metadata.accessors.objects; > * DatabaseSessionImpl.initializeDescriptors because @MapKey Annotation is not found. > * 04/21/2011-2.3 dclarke: Upgraded to support ASM 3.3.1 > * 08/10/2011-2.3 Lloyd Fernandes : Bug 336133 - Validation error during processing on parameterized generic OneToMany Entity relationship from MappedSuperclass >+ * 10/05/2012-2.4.1 Guy Pelletier >+ * - 373092: Exceptions using generics, embedded key and entity inheritance > ******************************************************************************/ >+package org.eclipse.persistence.internal.jpa.metadata.accessors.objects; >+ > import java.io.IOException; > import java.io.InputStream; > import java.util.ArrayList; >@@ -516,16 +518,30 @@ public class MetadataAsmFactory extends MetadataFactory { > } > } else { > // Is a generic type variable. >- arguments.add(new String(new char[] { next })); >- if((index+1) < length) { >- if(desc.charAt(index+1)==':') { >- isGenericTyped=true; >- index ++; >- arguments.add(":"); >- if(desc.charAt(index+1)==':') { >- index ++; >- } >- } >+ int start = index; >+ int end = start; >+ >+ char myNext = next; >+ >+ while (':' != myNext && '(' != myNext && ')' != myNext && '<' != myNext && '>' != myNext && ';' != myNext && end < length - 1) { >+ end++; >+ myNext = chars[end]; >+ } >+ >+ if (myNext == ':') { >+ arguments.add(desc.substring(start, end)); >+ isGenericTyped=true; >+ index = end; >+ arguments.add(":"); >+ if(desc.charAt(index+1)==':') { >+ index ++; >+ } >+ } else if (myNext == ';' && next == 'T') { >+ arguments.add(new String(new char[] { next })); >+ arguments.add(desc.substring(start + 1, end)); >+ index = end - 1; >+ } else { >+ arguments.add(new String(new char[] { next })); > } > } > } >-- >1.7.11.msysgit.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 372092
:
211316
|
219268
|
220745
| 220798