Skip to content

Attribute escapes class context #437

Description

@lukaskabc

When working with class that has @Context defined and with a simple data property (Instant):
Updating attribute on managed instance from native query saves the value to default context.

Example class (customized version copied from Jopa integration tests)

Steps to reproduce:

  1. Create a class with @Context defined
  2. Create a new entity in a standalone transaction (and commit it)
  3. Everything is saved correctly in the defined context
  4. Start a new transaction
  5. Acquire managed instance with native query
  6. Update value of an attribute
  7. (optional) merge the entity (explicitly calling entity manager merge makes no diference)
  8. Commit transaction
  9. The triple of the attribute is saved to default database context, not in the entity context (the original triple is removed from the entity context)

Expected result: the updated triple should be stored in the entity context

Observations:
a. detaching the entity first and then explicitly calling merge saves the update to correct context
b. updating instance from entity manager find saves the update to correct context

Demo:
https://github.com/lukaskabc/GraphDB-Graph-Transaction/blob/entity_merging_default_context/src/main/java/com/example/demo/TestRunner.java#L34
https://github.com/lukaskabc/GraphDB-Graph-Transaction/blob/entity_merging_default_context/src/main/java/com/example/demo/TransactionExecutor.java#L46

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions