openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "yun teng (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-145) support Java5 wildcard on OpenJPA
Date Tue, 13 Feb 2007 21:08:06 GMT
support Java5 wildcard on OpenJPA
---------------------------------

                 Key: OPENJPA-145
                 URL: https://issues.apache.org/jira/browse/OPENJPA-145
             Project: OpenJPA
          Issue Type: Improvement
          Components: jpa, kernel
         Environment: OPENJPA 0.95
            Reporter: yun teng


This enhancement request is to support  Java 5 wildcard on OpenJPA. The java 5 widecard is
defined at 
http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeArguments.html#Wildcards

Currently, iusing java 5 widecard annotation in OpenJPA will cause org.apache.openjpa.persistence.ArgumentException

for example

package parent;

public Class Account {

...
@OneToMany(mappedBy="account", cascade={CascadeType.ALL})
	private Set<? extends AccountPerson> accountPersonCollection; ...}

public Class AccountPerson{...}

______________________________________________________________________

package child;

public Class Account extend parent.Account {

}

public Class AccountPerson{..}
 

In such case, the parent.Account has relationship to parent.AccountPerson, while child.Account
has relationship to child.AccountPerson. Now if I do not use wildcard, my test passed.  If
I use wildcard, Java compile and Kodo enhancement all worked fine.  But at runtime, I got
the following exception


766  TRACE  [main] openjpa.MetaData - 	Resolving field
"com.psi.vida.platform.entity.pojo.Account@26757789.accountPersonCollect
ion".
766  WARN   [main] openjpa.MetaData - OpenJPA cannot map field
"com.psi.vida.platform.entity.pojo.Account.accountPersonCollection"
efficiently.  It is of an unsupported type. The field value will be serialized to a BLOB by
default. <4|true|0.9.5-incubating>
org.apache.openjpa.persistence.ArgumentException: Errors encountered while resolving metadata.
 See nested exceptions for details.
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:500)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:284)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
y.java:519)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:480)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:284)
	at
org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2343)
	at
org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2196)
	at kodo.kernel.KodoBroker.persist(KodoBroker.java:155)
	at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java
:991)
	at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerIm
pl.java:486)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManag
erInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
	at $Proxy5.persist(Unknown Source)
	at com.psi.vida.platform.util.VidaEntityManager.saveNew(VidaEntityManager.j
ava:160)
	at com.psi.vida.platform.util.VidaEntityManager.save(VidaEntityManager.java
:114)
	at com.psi.vida.platform.util.VidaEntityManagerTest.testSave(VidaEntityMana
gerTest.java:50)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase
.java:69)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe
stRunner.java:421)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUni
tTestRunner.java:912)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT
estRunner.java:766)
Caused by: <4|true|0.9.5-incubating>
org.apache.openjpa.persistence.ArgumentException: Field "com.psi.vida.platform.entity.pojo.Account.accountNoteCollection"
cannot declare that it is mapped by another field. Its mapping strategy
(org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy) does not support mapping
by another field.
	at org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappe
dBy(AbstractFieldStrategy.java:56)
	at org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedLobFieldStrategy.map(MaxE
mbeddedLobFieldStrategy.java:73)
	at org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy.map(Max
EmbeddedBlobFieldStrategy.java:96)
	at
org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:
117)
	at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(Ru
ntimeStrategyInstaller.java:77)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.ja
va:435)
	at
org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:400)
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(Cla
ssMapping.java:819)
	at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRep
ository.java:311)
	at org.apache.openjpa.meta.MetaDataRepository.loadMapping(MetaDataRepositor
y.java:586)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:486)
	... 34 more
NestedThrowables:
<4|true|0.9.5-incubating>
org.apache.openjpa.persistence.ArgumentException: Field "com.psi.vida.platform.entity.pojo.Account.accountPersonCollection"
cannot declare that it is mapped by another field. Its mapping strategy
(org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy) does not support mapping
by another field.
	at org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappe
dBy(AbstractFieldStrategy.java:56)
	at org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedLobFieldStrategy.map(MaxE
mbeddedLobFieldStrategy.java:73)
	at org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy.map(Max
EmbeddedBlobFieldStrategy.java:96)
	at
org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:
117)
	at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(Ru
ntimeStrategyInstaller.java:77)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.ja
va:435)
	at
org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:400)
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(Cla
ssMapping.java:819)
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.ja
va:779)
	at
org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1568)
	at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataReposit
ory.java:640)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataReposi
tory.java:601)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:492)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:284)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
y.java:519)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:480)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:284)
	at
org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2343)
	at
org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2196)
	at kodo.kernel.KodoBroker.persist(KodoBroker.java:155)
	at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java
:991)
	at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerIm
pl.java:486)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManag
erInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
	at $Proxy5.persist(Unknown Source)
	at com.psi.vida.platform.util.VidaEntityManager.saveNew(VidaEntityManager.j
ava:160)
	at com.psi.vida.platform.util.VidaEntityManager.save(VidaEntityManager.java
:114)
	at com.psi.vida.platform.util.VidaEntityManagerTest.testSave(VidaEntityMana
gerTest.java:50)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase
.java:69)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe
stRunner.java:421)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUni
tTestRunner.java:912)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT
estRunner.java:766)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message