Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update to-one relationship based on public id #481

Open
andrus opened this issue Jan 12, 2021 · 0 comments
Open

Can't update to-one relationship based on public id #481

andrus opened this issue Jan 12, 2021 · 0 comments

Comments

@andrus
Copy link
Contributor

andrus commented Jan 12, 2021

Given:

  • Entity A with ID hidden from the Agrest model, and a special public ID attribute used instead.
  • Entity B with to-one relationship to A

Issue: how do we update B's "a" value? The following update results in an exception. The error happens even if "B.a" was excluded from the B model via a constraint (I suppose it will not throw if exclusion happens via entity overlay).

PUT {\"a\":val}
Caused by: java.lang.IllegalArgumentException: Entity 'A' has unexpected number of ID attributes: 0
at io.agrest.runtime.protocol.EntityUpdateJsonTraverser.converter(EntityUpdateJsonTraverser.java:158)
at io.agrest.runtime.protocol.EntityUpdateJsonTraverser.processRelationship(EntityUpdateJsonTraverser.java:107)
at io.agrest.runtime.protocol.EntityUpdateJsonTraverser.processObject(EntityUpdateJsonTraverser.java:81)
at io.agrest.runtime.protocol.EntityUpdateJsonTraverser.traverse(EntityUpdateJsonTraverser.java:39)
at io.agrest.runtime.protocol.EntityUpdateParser.parse(EntityUpdateParser.java:45)
at io.agrest.runtime.protocol.EntityUpdateParser.parse(EntityUpdateParser.java:34)
at io.agrest.provider.EntityUpdateReaderProcessor.read(EntityUpdateReaderProcessor.java:24)
at io.agrest.provider.EntityUpdateReader.readFrom(EntityUpdateReader.java:51)
at io.agrest.provider.EntityUpdateReader.readFrom(EntityUpdateReader.java:29)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant