tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: CMP2.1 with OneToMany relationship is not working on 1.5.1
Date Mon, 14 Jan 2013 07:52:01 GMT
Hi,

this error is mainly here because the cmrfield type is not filled
(Collection)

btw this should work with this fix:
https://issues.apache.org/jira/browse/TOMEE-730



*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/1/14 BKumar <bibhuti.kumar@creditpointe.com>

> Hi,
>
> I am trying to run CMP2.1 one Tomee+ with OnetoMany  relationship but it is
> throwing exception.The example I am trying to run is done by 'dblevins' few
> years back and he also faced the same issue. Is it possible to get override
> this by  changing something in in generated mapping file?
>
> Source:
>
>  http://people.apache.org/~dblevins/simple-cmp2.tar.gz
>  http://people.apache.org/~dblevins/simple-cmp2/   (unpacked)
>
> Generated Mapping:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
> version="1.0">
>     <entity class="openejb.org.superbiz.cmp2.MovieBean" name="MovieBean">
>         <description>EntityBean#MovieBean</description>
>
>
>         <named-query name="MovieBean.findByDirector(java.lang.String)">
>             <query>SELECT m FROM MovieBean m WHERE m.director = ?1</query>
>         </named-query>
>         <named-query name="MovieBean.findAll">
>             <query>SELECT m FROM MovieBean as m</query>
>         </named-query>
>         <attributes>
>             <id name="id">
>                 <generated-value strategy="IDENTITY"/>
>             </id>
>             <basic name="year"/>
>             <basic name="title"/>
>             <many-to-one name="director"/>
>         </attributes>
>     </entity>
>     <entity class="openejb.org.superbiz.cmp2.DirectorBean"
> name="DirectorBean">
>         <description>EntityBean#DirectorBean</description>
>
>
>         <named-query
> name="DirectorBean.findByName(java.lang.String,java.lang.String)">
>             <query>SELECT d FROM DirectorBean d WHERE d.lastName = ?1 AND
> d.firstName = ?2</query>
>         </named-query>
>         <named-query name="DirectorBean.findAll">
>             <query>SELECT d FROM DirectorBean m</query>
>         </named-query>
>         <attributes>
>             <id name="id">
>                 <generated-value strategy="IDENTITY"/>
>             </id>
>             <basic name="firstName"/>
>             <basic name="lastName"/>
>             <one-to-many mapped-by="director" name="movies">
>                 <cascade>
>                     <cascade-all/>
>                 </cascade>
>             </one-to-many>
>         </attributes>
>     </entity>
> </entity-mappings>
>
> Exception:
>
> 1016  cmp  WARN   [main] openjpa.Enhance - An exception was thrown while
> attempting to per
> form class file transformation on "openejb.org.superbiz.cmp2.MovieBean":
> <openjpa-2.2.0-r422266:1244990 nonfatal general error>
> org.apache.openjpa.util.GeneralExce
> ption: org.xml.sax.SAXException:
> jar:file:/E:/Softwares/apache-tomee-1.5.1-plus/apache-tom
>
> ee-plus-1.5.1/temp/OpenEJB_Generated_38294.jar!/META-INF/openejb-cmp-generated-orm.xml
> [Lo
> cation: Line: 36, C: 61]: The type of field
> "openejb.org.superbiz.cmp2.DirectorBean.movies
> " isn't supported by declared persistence strategy "OneToMany".  Please
> choose a different
>  strategy.
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceM
> etaDataFactory.java:295)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaD
> ataFactory.java:228)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataReposito
> ry.java:580)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataReposito
> ry.java:400)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:
> 384)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataDefaults.getCachedSuperclassM
> etaData(PersistenceMetaDataDefaults.java:312)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineAccessType(
> PersistenceMetaDataDefaults.java:337)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(Persistence
> MetaDataDefaults.java:274)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:
> 914)
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.startClass(XMLPersi
> stenceMetaDataParser.java:1037)
>         at
>
> org.apache.openjpa.lib.meta.CFMetaDataParser.startElement(CFMetaDataParser.java
> :122)
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.startElement(XMLMetaDataParser.ja
> va:499)
>         at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
> Source)
>         at
> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)
>         at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source
> )
>         at
>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher
> .dispatch(Unknown Source)
>         at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Sour
> ce)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
>         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> Source)
>         at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParse
> r.java:424)
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:347)
>
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:324)
>
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:297)
>
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parse(XMLPersistenc
> eMetaDataParser.java:405)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceM
> etaDataFactory.java:293)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaD
> ataFactory.java:228)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataReposito
> ry.java:580)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataReposito
> ry.java:400)
>         at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:
> 384)
>         at
> org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:286)
>         at
> org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:257)
>         at
>
> org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransfo
> rmer.java:146)
>         at
>
> org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransfor
> mer.java:126)
>         at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.tra
> nsform(PersistenceProviderImpl.java:290)
>         at
>
> org.apache.openejb.persistence.PersistenceUnitInfoImpl$PersistenceClassFileTran
> sformer.transform(PersistenceUnitInfoImpl.java:306)
>         at
> sun.instrument.TransformerManager.transform(TransformerManager.java:169)
>         at
> sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:247)
>         at
>
> org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.load(EnterpriseBeanB
> uilder.java:425)
>         at
>
> org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.loadClass(Enterprise
> BeanBuilder.java:405)
>         at
>
> org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.build(EnterpriseBean
> Builder.java:266)
>         at
>
> org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:66)
>
>         at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java
> :713)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java
> :537)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.j
> ava:436)
>         at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:344)
>         at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
>         at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
>         at
> org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:233)
>         at
> org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:130)
>         at
>
> org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:121
> )
>         at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.j
> ava:119)
>         at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90
> )
>         at
>
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
>
>         at
> org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
>         at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
>         at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
> va:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
> Caused by: java.io.IOException: org.xml.sax.SAXException:
> jar:file:/E:/Softwares/apache-to
>
> mee-1.5.1-plus/apache-tomee-plus-1.5.1/temp/OpenEJB_Generated_38294.jar!/META-INF/openejb-
> cmp-generated-orm.xml [Location: Line: 36, C: 61]: The type of field
> "openejb.org.superbiz
> .cmp2.DirectorBean.movies" isn't supported by declared persistence strategy
> "OneToMany".
> Please choose a different strategy.
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParse
> r.java:427)
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:347)
>
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:324)
>
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:297)
>
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parse(XMLPersistenc
> eMetaDataParser.java:405)
>         at
>
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceM
> etaDataFactory.java:293)
>         ... 78 more
> Caused by: org.xml.sax.SAXException:
> jar:file:/E:/Softwares/apache-tomee-1.5.1-plus/apache
>
> -tomee-plus-1.5.1/temp/OpenEJB_Generated_38294.jar!/META-INF/openejb-cmp-generated-orm.xml
>  [Location: Line: 36, C: 61]: The type of field
> "openejb.org.superbiz.cmp2.DirectorBean.mo
> vies" isn't supported by declared persistence strategy "OneToMany".  Please
> choose a diffe
> rent strategy.
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.getException(XMLMetaDataParser.ja
> va:743)
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.assertPCCollection(
> XMLPersistenceMetaDataParser.java:1704)
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parseOneToMany(XMLP
> ersistenceMetaDataParser.java:1720)
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parseStrategy(XMLPe
> rsistenceMetaDataParser.java:1563)
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.startStrategy(XMLPe
> rsistenceMetaDataParser.java:1531)
>         at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.startClassElement(X
> MLPersistenceMetaDataParser.java:843)
>         at
>
> org.apache.openjpa.lib.meta.CFMetaDataParser.startElement(CFMetaDataParser.java
> :125)
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.startElement(XMLMetaDataParser.ja
> va:499)
>         at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
> Source)
>         at
> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)
>         at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source
> )
>         at
>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher
> .dispatch(Unknown Source)
>         at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Sour
> ce)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
>         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> Source)
>         at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
>         at
>
> org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParse
> r.java:424)
>         ... 83 more
>
> Bibhuti
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/CMP2-1-with-OneToMany-relationship-is-not-working-on-1-5-1-tp4660253.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message