[jira] [Commented] (OLINGO-546) Cannot create entities with composite key using EmbeddedId annotation
[ https://issues.apache.org/jira/browse/OLINGO-546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16001112#comment-16001112 ] Benjamin Runnels commented on OLINGO-546: - My issue was caused because I was implementing the many-to-many mapping tables as entitiy classes rather than letting jpa handle them. Once I added a JPAEntityType and JPAEmbeddableType exclusion for those entities classes then I stopped getting the NullPointerException. > Cannot create entities with composite key using EmbeddedId annotation > - > > Key: OLINGO-546 > URL: https://issues.apache.org/jira/browse/OLINGO-546 > Project: Olingo > Issue Type: Bug > Components: odata2-jpa >Affects Versions: V2 2.0.1 > Environment: Windows 7, Apache Tomcat 7.0.56 >Reporter: Riccardo >Assignee: Chandan V.A >Priority: Critical > > Hi, > I've some problems when i create entities with composite key using EmbeddedId > annotation. Below there are the classes causing the issue > {code:title=TestTable.java|borderStyle=solid} > @Entity > @Table(name="TEST_TABLE") > public class TestTable implements Serializable { > private static final long serialVersionUID = 1L; > @EmbeddedId > private TestTablePK id; > @Column(name="COL_GENERIC", length=20) > private String colGeneric; > public TestTable() { > } > public TestTablePK getId() { > return this.id; > } > public void setId(TestTablePK id) { > this.id = id; > } > public String getColGeneric() { > return this.colGeneric; > } > public void setColGeneric(String colGeneric) { > this.colGeneric = colGeneric; > } > } > {code} > {code:title=TestTablePK.java|borderStyle=solid} > @Embeddable > public class TestTablePK implements Serializable { > private static final long serialVersionUID = 1L; > @Column(name="COL_KEY1", unique=true, nullable=false) > private int colKey1; > @Column(name="COL_KEY2", unique=true, nullable=false) > private int colKey2; > public TestTablePK() { > } > public int getColKey1() { > return this.colKey1; > } > public void setColKey1(int colKey1) { > this.colKey1 = colKey1; > } > public int getColKey2() { > return this.colKey2; > } > public void setColKey2(int colKey2) { > this.colKey2 = colKey2; > } > public boolean equals(Object other) { > if (this == other) { > return true; > } > if (!(other instanceof TestTablePK)) { > return false; > } > TestTablePK castOther = (TestTablePK)other; > return > (this.colKey1 == castOther.colKey1) > && (this.colKey2 == castOther.colKey2); > } > public int hashCode() { > final int prime = 31; > int hash = 17; > hash = hash * prime + this.colKey1; > hash = hash * prime + this.colKey2; > return hash; > } > } > {code} > When i get the $metadata, the application thrown the following exception > {color:red} > java.lang.NullPointerException > at > org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmMappingModelService.searchJPAEmbeddableTypeMapType(JPAEdmMappingModelService.java:196) > at > org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmMappingModelService.checkExclusionOfJPAEmbeddableType(JPAEdmMappingModelService.java:238) > at > org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmComplexType$JPAEdmComplexTypeBuilder.isExcluded(JPAEdmComplexType.java:260) > at > org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmComplexType$JPAEdmComplexTypeBuilder.build(JPAEdmComplexType.java:239) > at > org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmSchema$JPAEdmSchemaBuilder.build(JPAEdmSchema.java:116) > at > org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel$JPAEdmModelBuilder.build(JPAEdmModel.java:61) > at > org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider.getSchemas(ODataJPAEdmProvider.java:282) > at > org.apache.olingo.odata2.core.edm.provider.EdmServiceMetadataImplProv.getDataServiceVersion(EdmServiceMetadataImplProv.java:102) > at > org.apache.olingo.odata2.api.processor.ODataSingleProcessor.readMetadata(ODataSingleProcessor.java:378) > at > org.apache.olingo.odata2.core.Dispatcher.dispatch(Dispatcher.java:182) > at > org.apache.olingo.odata2.core.ODataRequestHandler.handle(ODataRequestHandler.java:129) > at >
[jira] [Reopened] (OLINGO-1121) Can not create entities via to one navigation property
[ https://issues.apache.org/jira/browse/OLINGO-1121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oliver Grande reopened OLINGO-1121: --- Hello Christian, thanks for the hint. Reading the Atom specification I'm convinced that you should allow a POST on a To One relation. Section 9.2 states: "To add members to a Collection, clients send POST requests to the URI of the Collection." And that exactly what I want to do. The target of the To One association is a collection (either way, as you know, any entity is in V2 a collection). I you look at the example of 2.2.3.5 Resource Path: Semantics at section URI6 what I like to do is creating a new SalesOrder and together with this a new Customer so my URIs would look like: POST .../SalesOders('id 123') POST .../SalesOders('id 123')/OrderedBy > Can not create entities via to one navigation property > -- > > Key: OLINGO-1121 > URL: https://issues.apache.org/jira/browse/OLINGO-1121 > Project: Olingo > Issue Type: Bug > Components: odata2-core >Affects Versions: V2 2.0.8 >Reporter: Oliver Grande >Assignee: Christian Amend > > I try to create three entities via a $batch request with three POSTs. One > "top-level" entity and two related ones. One of the navigation properties is > a "To One" and the other one is a "To Many" relation. > Whereas the "Top Level" and the "To Many" are processed without any problem, > the To One aborts with an ODataMethodNotAllowedException. > Some debugging showed that the "To Many" gets UriType URI6B, where as "To > One" gets UriType URI6A. Later in ODataRequestHandler. validateUriMethod POST > is forbidden for URI6A. > Please enable POST for URI6A as well. > Regards, > Oliver -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OLINGO-1121) Can not create entities via to one navigation property
[ https://issues.apache.org/jira/browse/OLINGO-1121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16000452#comment-16000452 ] Oliver Grande commented on OLINGO-1121: --- Hello Christian, thanks for the hint. Reading the Atom specification I'm convinced that you should allow a POST on a To One relation. Section 9.2 states: "To add members to a Collection, clients send POST requests to the URI of the Collection." And that exactly what I want to do. The target of the To One association is a collection (either way, as you know, any entity is in V2 a collection). I you look at the example of 2.2.3.5 Resource Path: Semantics at section URI6 what I like to do is creating a new SalesOrder and together with this a new Customer so my URIs would look like: POST .../SalesOders('id 123') POST .../SalesOders('id 123')/OrderedBy > Can not create entities via to one navigation property > -- > > Key: OLINGO-1121 > URL: https://issues.apache.org/jira/browse/OLINGO-1121 > Project: Olingo > Issue Type: Bug > Components: odata2-core >Affects Versions: V2 2.0.8 >Reporter: Oliver Grande >Assignee: Christian Amend > > I try to create three entities via a $batch request with three POSTs. One > "top-level" entity and two related ones. One of the navigation properties is > a "To One" and the other one is a "To Many" relation. > Whereas the "Top Level" and the "To Many" are processed without any problem, > the To One aborts with an ODataMethodNotAllowedException. > Some debugging showed that the "To Many" gets UriType URI6B, where as "To > One" gets UriType URI6A. Later in ODataRequestHandler. validateUriMethod POST > is forbidden for URI6A. > Please enable POST for URI6A as well. > Regards, > Oliver -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Resolved] (OLINGO-1121) Can not create entities via to one navigation property
[ https://issues.apache.org/jira/browse/OLINGO-1121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Christian Amend resolved OLINGO-1121. - Resolution: Won't Fix Assignee: Christian Amend The V2 specification does not allow POST requests on navigation to one. POST methods are only allowed for collections: As specified in [RFC5023] section 9.2, insert requests use the HTTP POST method and the request URI must represent an AtomPub Collection. Because a collection maps to a conceptual schema definition language (CSDL) in an Entity Data Model, the HTTP request line URI MUST be any valid data service URI, as defined in URI Format: Resource Addressing Rules (section 2.2.3), which identifies a collection of entities. > Can not create entities via to one navigation property > -- > > Key: OLINGO-1121 > URL: https://issues.apache.org/jira/browse/OLINGO-1121 > Project: Olingo > Issue Type: Bug > Components: odata2-core >Affects Versions: V2 2.0.8 >Reporter: Oliver Grande >Assignee: Christian Amend > > I try to create three entities via a $batch request with three POSTs. One > "top-level" entity and two related ones. One of the navigation properties is > a "To One" and the other one is a "To Many" relation. > Whereas the "Top Level" and the "To Many" are processed without any problem, > the To One aborts with an ODataMethodNotAllowedException. > Some debugging showed that the "To Many" gets UriType URI6B, where as "To > One" gets UriType URI6A. Later in ODataRequestHandler. validateUriMethod POST > is forbidden for URI6A. > Please enable POST for URI6A as well. > Regards, > Oliver -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Created] (OLINGO-1121) Can not create entities via to one navigation property
Oliver Grande created OLINGO-1121: - Summary: Can not create entities via to one navigation property Key: OLINGO-1121 URL: https://issues.apache.org/jira/browse/OLINGO-1121 Project: Olingo Issue Type: Bug Components: odata2-core Affects Versions: V2 2.0.8 Reporter: Oliver Grande I try to create three entities via a $batch request with three POSTs. One "top-level" entity and two related ones. One of the navigation properties is a "To One" and the other one is a "To Many" relation. Whereas the "Top Level" and the "To Many" are processed without any problem, the To One aborts with an ODataMethodNotAllowedException. Some debugging showed that the "To Many" gets UriType URI6B, where as "To One" gets UriType URI6A. Later in ODataRequestHandler. validateUriMethod POST is forbidden for URI6A. Please enable POST for URI6A as well. Regards, Oliver -- This message was sent by Atlassian JIRA (v6.3.15#6346)