Closed EotT123 closed 7 months ago
I understand the desire to have those directly on the entity interface, but the separation of entity stuff and tx related stuff is intentional. In my view film.getBindings().isForDelete()
is more suitable, but this is subjective for sure.
Anyhow, there are several ways to customize entity interfaces to have the methods directly as you prefer.
customBaseInterface
dbconfig option to customize the base interface for all entitiesCustomEntity
to selectively customize entity interfaces
Objects can be deleted (e.g.
film.delete()
) and undeleted (e.g.film.undelete()
).Internally, a flag is set to keep track of the deleted status. The
TxBindings
interface defines a getter method for this flag. However, this is not (directly) accessible on the object, but it can be accessed using((TxBindings) film.bindings).isForDelete()
. Would it be possible to expose this method directly on the object e.g.film.isForDelete()
?It might also be useful to expose the two other methods (i.e.
isForInsert()
andisForUpdate()
).My use case is the following: I fetch all objects I needs, which are visualized in a GUI. It's a one-to-many mapping from type A to type B, using an intermediate mapping AB. When another A is selected, the correct B's should be displayed (using the intermediate AB mapping). Objects and mappings can be changed (added, deleted). Changes are persisted when the users clicks the OK button. But as long as the changes are not yet persisted, I should still be able to display the correct, possible changed, objects and mappings. Checking the deleted status would be ideal for this.
Edit: when using the
isBindings()
getter, a cast toTxBindings
isn't needed, so it becomes:film.getBindings().isForDelete()
. Another way could be to define a common interface, where I can define the needed methods. So maybe it's not worth to implement this.Edit2: I'm not sure if this has enough added value, as it can be done adding a little bit of code. Feel free to close this.