ManyToOne Mapping throws exception "com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException: Error when creating Referential Constraints"
See original GitHub issueI am trying to make a simple demo application using this library. I get the above error when using a ManyToOne
mapping between my entities.
Entity BeerRating
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BEER_RATING_ID_GENERATOR")
@Column(name = "ID", nullable = false, precision = 10)
private BigDecimal id;
@ManyToOne
@JoinColumn(name = "BEER_ID", referencedColumnName = "ID")
private Beer beer;
Entity Beer
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BEER_ID_GENERATOR")
@Column(name = "ID", nullable = false, precision = 10)
private BigDecimal id;
@Column(name = "NAME", nullable = false)
private String name;
@Column(name = "BRAND", nullable = false)
private String brand;
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
olingo jpa processor v4 Exception when using @ManyToOne ...
olingo jpa processor v4 Exception when using @ManyToOne relation. com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException: ...
Read more >Odata V4 String[] mapping - SAP Community
I am currently using PostgreSQL with Odata V4 Olingo and JPA and Hibernate ... "com.sap.olingo.jpa.metadata.core.edm.mapper.exception.
Read more >com.sap.olingo.jpa.metadata.core.edm.mapper ... - Tabnine
private EdmEnumeration getAnnotation() throws ODataJPAModelException { final EdmEnumeration enumAnnotation = javaEnum.getAnnotation(EdmEnumeration.class); ...
Read more >EdmSimpleType (olingo-odata2-parent 2.0.10 API)
EdmSimpleType is a primitive type as defined in the Entity Data Model (EDM). There are methods to convert EDM simple types from and...
Read more >[jira] [Resolved] (OLINGO-1459) Apache Olinge OData service ...
Resolution: Fixed I found the solution > Apache Olinge OData service throws EdmSimpleTypeException when the column in > database is of type ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello, I had similar issue and Your solution helped me. Thanks a lot.
However, I wanted to have my relationship bidirectional. So keeping the same entities as in original post I would like to use both
ODataDemo.svc/BeerRatings?$expand=Beer
andODataDemo.svc/Beers?$expand=BeerRating
The first one is working perfectly. To achieve the second I added to theBeer
something like thatHowever it does not work - I got error of
null
code with error messageElement BeerId does not correspond to an element in the query result.
Do You happen to know what I’m doing wrong? Error message does not tell much to me especially since beerId located in BeerRating have@EdmIgnore
annotation.Thanks
Hello,
in opposite of JPA the JPA Processor needs, as of now, the join column as attribute. You need add the following to BeerRating:
Now the error is gone and BeerId wont appear as property in the metadata document.