title: Persistent data with transient information depending on context
body: <p>let's say I have a class <code>User</code> which has data about the given user, for example the name. This data is meant to be persisted into a database, this works flawlessly.</p>
  
  <p>I currently have two projects in which I need to access the user data. The first is a web interface, in which I can see and manipulate the data of the user. The second project uses this data but also has some additional session-dependent data which shouldn't be persisted. This data somehow needs to be associated with the user.</p>
  
  <p>Now the question is: How do I do this?</p>
  
  <p>I thought about extending the base class and add the transient fields only in the sub class, but then storing it in the database will result in another type, which isn't available in the web interface.</p>
  
  <p>Another idea I had would be making a Map for transient data directly inside the base class, but this seems strange as I don't have any guarantee of type, as one could simply replace the metadata with something completely different.</p>
  
  <p>A wrapper or something similar might be another alternative, but I don't know how creation could be done easily, as I would need multiple calls to get my object created and the persisted data loaded.</p>
  
  <p>How should one handle such situations?</p>