Summary
Add an explicit repository operation that assigns a generated database identifier back to an entity implementing vix::orm::Entity.
Current behavior
BaseRepository<T>::create(const T&) returns the generated identifier but cannot modify the passed object.
Entity::setId() exists, but the repository does not currently use it.
Users must manually call setId() after insertion.
Expected behavior
The ORM should provide an explicit operation that inserts an entity and assigns the generated ID when the entity supports it.
The existing create(const T&) behavior must remain unchanged.
Scope
Suggested API direction
A possible method name is createAndAssign().
The final method name should be reviewed before implementation.
Suggested files
modules/orm/include/vix/orm/Repository.hpp
modules/orm/include/vix/orm/Entity.hpp
modules/orm/tests/entity_identity_test.cpp
modules/orm/examples/15_entity_identity.cpp
Acceptance criteria
Non-goals
This issue does not include:
- automatic entity persistence;
- dirty tracking;
- identity maps;
- non-integer generated identifiers.
Suggested labels
scope:orm
type:feature
tests
good first issue
status:accepted
Summary
Add an explicit repository operation that assigns a generated database identifier back to an entity implementing
vix::orm::Entity.Current behavior
BaseRepository<T>::create(const T&)returns the generated identifier but cannot modify the passed object.Entity::setId()exists, but the repository does not currently use it.Users must manually call
setId()after insertion.Expected behavior
The ORM should provide an explicit operation that inserts an entity and assigns the generated ID when the entity supports it.
The existing
create(const T&)behavior must remain unchanged.Scope
vix::orm::Entity.setId().Suggested API direction
A possible method name is
createAndAssign().The final method name should be reviewed before implementation.
Suggested files
modules/orm/include/vix/orm/Repository.hppmodules/orm/include/vix/orm/Entity.hppmodules/orm/tests/entity_identity_test.cppmodules/orm/examples/15_entity_identity.cppAcceptance criteria
create(const T&)remains unchanged.setId().Non-goals
This issue does not include:
Suggested labels
scope:ormtype:featuretestsgood first issuestatus:accepted