Skip to content

IDGeneration, saving & object_already_persistent #32

@niniemann

Description

@niniemann
  • IncrementalIDGeneration needs to store "meta"-information: Prefix & highest assigned ID.
  • Currently, it only saves this information during its destructor
  • Problem: ctrl+x, crashes, etc. lead to inconsistent data, and when creating a new entity it is given an invalid id, resulting in an object_already_persistent exception when trying to save it
  • tried hotfix: Not only save it in the d'tor, but also every time it generated an id
  • Problem: transaction already in progress in this thread.
    • Load an entity
    • --> inside a transaction
    • create instance
    • generates Id (which is stupid in itself)
    • tries to save it
    • therefore, storage tries to open a new transaction
    • --> exception.
  • Possible fix:
    • storage: check if transaction already in progress
    • better: rework IDGeneration.

I'd like to change something fundamentally here. Original idea was to create the ID all the way down in the c'tor of DBObject so that every derived entity can already access and use it (especially usefull for creating a child-RDF-Entity / PropertyMap etc). By now I'm rather convinced that it would be better to split things up: Leave the "default c'tor" as simple as possible, without any ID-generation whatsoever, and add a second initialization step to set the id and update anything that relies on it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions