OPENJPA-1049: Register type alias for MappedSuperclass.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@770516 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-05-01 02:22:35 +00:00
parent f9fd4837b3
commit 861db8ddd0
2 changed files with 14 additions and 5 deletions

View File

@ -2802,7 +2802,7 @@ public class PCEnhancer {
code.getstatic().setField(PRE + "FieldFlags", byte[].class); code.getstatic().setField(PRE + "FieldFlags", byte[].class);
code.getstatic().setField(SUPER, Class.class); code.getstatic().setField(SUPER, Class.class);
if (_meta.isMapped()) if (_meta.isMapped() || _meta.isAbstract())
code.constant().setValue(_meta.getTypeAlias()); code.constant().setValue(_meta.getTypeAlias());
else else
code.constant().setNull(); code.constant().setNull();

View File

@ -18,14 +18,21 @@
*/ */
package org.apache.openjpa.persistence.inheritance; package org.apache.openjpa.persistence.inheritance;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.meta.ClassMetaData; import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.kernel.AbstractBrokerFactory; import org.apache.openjpa.persistence.test.AllowFailure;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
/** /**
* Test that entities, mapped superclasses, and embeddables can all share * Test that entities, mapped superclasses, and embeddables can all share
* the same short names without any collisions. * the same short names without any collisions.
*
* This test is modified to ignore conflict of alias between MappedSuperclass
* and derived Entity. This earlier assertion is no more valid after the
* changes introduced to allow MappedSuperclass to be used in query.
* That feature seemed more significant than the feature asserted by this test.
* The details of the change can be found at
* <A HREF="https://issues.apache.org/jira/browse/OPENJPA-1049">JIRA</A>
*
*/ */
public class TestSharedUnqualifiedClassNames public class TestSharedUnqualifiedClassNames
extends SingleEMFTestCase { extends SingleEMFTestCase {
@ -42,6 +49,8 @@ public class TestSharedUnqualifiedClassNames
emf.createEntityManager().close(); emf.createEntityManager().close();
} }
@AllowFailure(message="MappedSuperclass can be aliased and has higher" +
"search order in alias if it clashes with other types's alias")
public void testMappedSuperclass() { public void testMappedSuperclass() {
ClassMetaData meta = emf.getConfiguration() ClassMetaData meta = emf.getConfiguration()
.getMetaDataRepositoryInstance() .getMetaDataRepositoryInstance()