openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Exception when doing join
Date Sat, 11 Jul 2009 22:23:47 GMT
Hi,

I haven't been able to reproduce the problem you describe, could you post
the entire entity (or a subset that illustrates the problem)?

BTW the JoinColumn is on the wrong side of the relationship in your example
you should see a different exception once you get past the access type
problem. Ie :
 <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.persistence.ArgumentException: You have supplied columns
for "openjpa.users.cndavies.entities.UserEntity.addresses", but this mapping
cannot have columns in this context.
    at
org.apache.openjpa.jdbc.meta.MappingInfo.assertNoSchemaComponents(MappingInfo.java:327)
    at
org.apache.openjpa.jdbc.meta.strats.RelationToManyTableFieldStrategy.map(RelationToManyTableFieldStrategy.java:96)
    <snip>

-mike

On Sat, Jul 11, 2009 at 9:15 AM, C N Davies <cnd@cndavies.com> wrote:

> I've not done this before so maybe I'm missing something basic but I have
> followed the docs as far as I can see.
>
>
>
> I have an Entity User, which I want to have multiple addresses so I simply
> added a I thought were the appropriate annotations and members like so:
>
>
>
>      private Collection <Address> addresses;
>
>
>
>       */
>
>      public void setAddresses(Collection <Address> addresses) {
>
>            this.addresses = addresses;
>
>      }
>
>
>
>      @OneToMany(cascade={CascadeType.ALL})
>
>      @JoinColumn(name="id")
>
>      public Collection <Address> getAddresses() {
>
>            return addresses;
>
>      }
>
>
>
> As soon as I add the @OneToMany annotation and OpenJPA starts to generate
> the tables, it throws an exception complaining I am using both field and
> property access, however the exception lists no members using field access
> and only 1 using property access so I a not sure why it is telling me I am
> using both.
>
>
>
> Here is the stack trace, thanks for any advice!:
>
>
>
> <openjpa-1.2.0-r422266:683325 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: Type "com.trm.core.User"
> attempts to use both field and property access. Only one access method is
> permitted. Field access is used on the following fields: []. Property
> access
> is used on the following methods: [public java.util.Collection
> com.trm.core.User.getAddresses()].
>
>
>
> org.apache.openjpa.meta.AbstractMetaDataDefaults.populate(AbstractMetaDataDe
> faults.java:161)
>
>
>
> org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(Persiste
> nceMetaDataDefaults.java:227)
>
>
>
> org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.ja
> va:794)
>
>
>
> org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.ja
> va:780)
>
>
>
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getMetaDa
> ta(AnnotationPersistenceMetaDataParser.java:657)
>
>
>
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClas
> sAnnotations(AnnotationPersistenceMetaDataParser.java:480)
>
>
>
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(Ann
> otationPersistenceMetaDataParser.java:352)
>
>
>
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMe
> taDataFactory.java:229)
>
>
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepos
> itory.java:474)
>
>
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.ja
> va:294)
>
>
>
> org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.
> java:285)
>
>
> org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
>
>
> org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748)
>
>        org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646)
>
>
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBro
> kerFactory.java:153)
>
>
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFac
> tory.java:119)
>
>
>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFact
> ory.java:189)
>
>
>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBroker
> Factory.java:142)
>
>
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
> EntityManagerFactoryImpl.java:192)
>
>
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
> EntityManagerFactoryImpl.java:145)
>
>
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
> EntityManagerFactoryImpl.java:56)
>
>
>
> com.trm.jpa.services.EntityService.createEntityManager(EntityService.java:73
> )
>
>        com.trm.jpa.services.EntityService.<init>(EntityService.java:34)
>
>
>
> com.trm.beans.backing.CountryListBackingBean.init(CountryListBackingBean.jav
> a:28)
>
>
>
> com.trm.beans.backing.CountryListBackingBean.<init>(CountryListBackingBean.j
> ava:33)
>
>        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>
>        sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
>
>        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
>
>        java.lang.reflect.Constructor.newInstance(Unknown Source)
>
>        java.lang.Class.newInstance0(Unknown Source)
>
>        java.lang.Class.newInstance(Unknown Source)
>
>
>
> com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryIm
> pl.java:275)
>
>
>
> com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBea
> ns(ApplicationAssociate.java:551)
>
>
>
> com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:8
> 2)
>
>        javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
>
>
>
> com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.
> java:64)
>
>        org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
>
>        org.apache.el.parser.AstValue.getValue(AstValue.java:86)
>
>
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
>
>
>
> org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101
> )
>
>        javax.faces.component.UIData.getValue(UIData.java:582)
>
>
> org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1624)
>
>
>
>

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