NPE during the NavigationProperties build
Valeri-Velev opened this issue · comments
I did the same as this example https://github.wdf.sap.corp/odata-jpa/odata-v4-jpa-spring-example but now when I try to reach my metadata I receive only this:
{
"@odata.context": "$metadata",
"value": []
}
Could you help me?
Best Regards,
Valeri
Update:
Currently, only enum classes are visible in the response
Update #2:
when I call this '/v1' endpoint which should show all my entities I get a response this exception
with status code 500
{
"error": {
"code": null,
"message": "Cannot invoke "javax.persistence.OneToOne.mappedBy()" because the return value of "java.lang.reflect.AnnotatedElement.getAnnotation(java.lang.Class)" is null"
}
}
And this happens only on the 1st invocation. Every other try to call the endpoint returns this.
{
"@odata.context": "$metadata",
"value": []
}
After some investigation, I found an NPE in the code. You can see it on the attached screenshot.
This is the object for which the error occurs:
@entity
@table(name = "edges")
public class WorkflowEdge {
@id
@manytoone
@joincolumn(name = "id")
private Workflow workflow;
@id
@joincolumn(name = "source")
private Workflow sourceWorkflow;
@id
@joincolumn(name = "target")
private Workflow targetWorkflow;
Best Regards,
Valeri
Hello,
here we have two problems:
- Unfortunately, partly generated metadata are not destroyed in case an error occurs during the metadata generation. Therefor a second call returns the part generated till the error occurred. This could also be empty.
- Two of your navigations have no cardinality information sourceWorkflow and targetWorkflow. I'm not sure if JPA supports this. At least the JPA Processor requires this information. So you may need to add the corresponding annotation. Meaningful error message is missing.
Hello,
Can I help somehow?
With release 1.1.1, an error message has been added.