InitialValue of transient attribute in a persistent object?

299 views Asked by At

Even though I use a specific ORM framework, Bold for Delphi, I'm more interested in framework agnostic theoretical view on the problem.

So the question is about having a persistent object and a transient attribute with initial value tag.

The initial tag specifies the value attribute will get when instance of owning object is created.

However when subsequently loading this object from persistence, what should be the value of transient attribute?

Should initial value tag be applied again? Logically, it should, otherwise it will be left unassigned (null).

I couldn't find any specs on this particular case in any of the docs.

1

There are 1 answers

4
Gangnus On

We can't create object up to the DB record only - because we would lose all transient attributes. So, when you are loading a persistent object, it can be done only into the already created instance. And there is no other way of instantiating without using the base object constructor, which sets the initial values. Of course, some language could make a workaround about it, but why?