You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Michael Bolz (JIRA)" <ji...@apache.org> on 2014/12/22 07:36:13 UTC

[jira] [Comment Edited] (OLINGO-526) Use of uni-directional @OneToMany leads to an exception

    [ https://issues.apache.org/jira/browse/OLINGO-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14255475#comment-14255475 ] 

Michael Bolz edited comment on OLINGO-526 at 12/22/14 6:35 AM:
---------------------------------------------------------------

Hi [~chandan.v.a],

unfortunately, if I change my model to uni-directional with no field in {{Quotation}} and following code in {{RequestForQuotation}}:

{code}
@JoinColumn(name = "requestForQuotationUUID", referencedColumnName = "requestForQuotationUUID")
private List<Quotation> quotation;
{code}

and then do a call to get the metamodel {{http://localhost:8080/peopledirectory.svc/$metadata}} it result in a {{NullPointerException}} with following (shortened) StackTrace :
{code}
org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmNameBuilder	build	175
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmProperty$JPAEdmPropertyBuilder	buildSimpleProperty	335
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmProperty$JPAEdmPropertyBuilder	buildForeignKey	419
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmProperty$JPAEdmPropertyBuilder	addForeignKey	364
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmProperty$JPAEdmPropertyBuilder	build	279
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntityType$JPAEdmEntityTypeBuilder	build	128
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntitySet$JPAEdmEntitySetBuilder	build	89
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntityContainer$JPAEdmEntityContainerBuilder	build	117
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmSchema$JPAEdmSchemaBuilder	build	119
org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel$JPAEdmModelBuilder	build	61
org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider	getSchemas	282
org.apache.olingo.odata2.core.edm.provider.EdmServiceMetadataImplProv	getDataServiceVersion	102
org.apache.olingo.odata2.api.processor.ODataSingleProcessor	readMetadata	378
{code}


Kind regards,
Michael


was (Author: mirbo):
Hi [~chandan.v.a],

unfortunately, if I change my model to uni-directional with no field in {{Quotation}} and following code in {{RequestForQuotation}}:

{code}
@JoinColumn(name = "requestForQuotationUUID", referencedColumnName = "requestForQuotationUUID")
private List<Quotation> quotation;
{code}

and then do a call to get the metamodel {{http://localhost:8080/peopledirectory.svc/$metadata}} it results still in following error:
{code}
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code/>
  <message xml:lang="en">No [EntityType] was found for the key class [java.util.List] in the Metamodel - please verify that the [Entity] class was referenced in persistence.xml using a specific <class>java.util.List</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.</message>
</error>
{code}


Kind regards,
Michael

> Use of uni-directional @OneToMany leads to an exception
> -------------------------------------------------------
>
>                 Key: OLINGO-526
>                 URL: https://issues.apache.org/jira/browse/OLINGO-526
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.1
>            Reporter: Michael Bolz
>            Assignee: Chandan V.A
>             Fix For: V2 2.0.2
>
>
> Issue occurs with use of {{JPA Processor Extension}}.
> If a uni-directional {{@OneToMany}} is used the creation of the {{metamodel}} fails with following exception:
> {code}
> java.lang.IllegalArgumentException
> No [EntityType] was found for the key class [java.util.List] in the Metamodel - please verify that the [Entity] class was referenced in persistence.xml using a specific <class>java.util.List</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
> {code}
> in
> {code}
> org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl entityEmbeddableManagedTypeNotFound  173
> org.apache.olingo.odata2.core.ep.AtomEntityProvider writeServiceDocument 157
> {code}
> Example code:
> {code}
> 	@OneToMany
> 	@JoinColumn(name = "requestForQuotationUUID", referencedColumnName = "requestForQuotationUUID")
> 	private List<Quotation> quotation;
> {code}
> For {{JPA}} following dependencies are used:
> {code}
> <dependency>
> 	<groupId>org.eclipse.persistence</groupId>
> 	<artifactId>eclipselink</artifactId>
> 	<version>2.5.1</version>
> </dependency>
> {code}
> which transitive use {{org.eclipse.persistence:javax.persistence:jar:2.1.0}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)