I have a CRUD app for
<DomainObject>s. They are persisted in a database.
There is a new requirement: keep track of the
<DomainObject>s that have been created since the app was opened, so that the user can see what he/she has done.
I see three ways to implement this:
- every time the app is opened, create a new sessionid (for lack of a better name) and store it in the database. Store the sessionid as a foreign key for each
<DomainObject>. Use a custom query to access the data (i.e.
select * from DomainObject where sessionid = "currentSessionId")
- same as 1., except perform the filtering in the business layer
- don't keep track of this data in the database. Instead, have the model keep track of the new
The problem: I don't have enough experience to understand the consequences of each approach. For example, it seems like 1. puts business logic in the database. But 3. doesn't persist some of the data.
What are the pros and cons of each approach?