Skip to main content
9 votes
Accepted

How are account balances persisted

Most commercial accounting software store the account balance, sometimes with the account, but most often in periodic tables (per year or per month). The technical point of view There are several ...
Christophe's user avatar
  • 82.2k
9 votes

Can a Domain Object always be "completely ignorant of persistence" and yet still possible to persist?

Does a Domain Object being "completely ignorant of persistence" conflict with it always being possible to persist? It conflicts with the domain object managing its persistence. It does not ...
candied_orange's user avatar
8 votes
Accepted

How to deal with an event if the domain aggregate was not yet persisted?

The problem you've encountered has a lot to do with messaging implementation. The solution of the problem you're describing depends on many variables and it is very difficult to reliably take into ...
Andy's user avatar
  • 10.4k
7 votes

How do you alleviate stale data in a multi-user web application?

There are two issues here: You don't want a overwrite changes made by one user with changes and old data from another user. You don't want users viewing and making decision based on old data. The ...
JimmyJames's user avatar
  • 30.9k
6 votes

What is data persistence in the context of software engineering?

Computing devices have memory hierarchies with varied power failure considerations. Volatile storage technologies like main memory, aka RAM, loses their value on power failure, while non-volatile ...
Erik Eidt's user avatar
  • 34.8k
6 votes
Accepted

Is domain/persistence model isolation usually this awkward?

Your basic understanding is correct and the architecture you sketch out is good and works well. Reading between the lines it seems like you are coming from a more database-centric active record style ...
Ewan's user avatar
  • 84.4k
6 votes
Accepted

How to prevent concurrency problems when using the repository pattern?

The repository pattern does not intend to solve concurrency issues. It only provides a convenient way to work with persistent entities. In principle you'd use your repository pattern in ...
Christophe's user avatar
  • 82.2k
6 votes

Should the Model be able to persist itself? When?

No, it should not. Especially these days, a model will have multiple persistence locations (DB, cache, backup) and a few other forms that are useful to be decoupled from the store (human readable, ...
Telastyn's user avatar
  • 110k
5 votes
Accepted

Ways to mark the parts of a JSON that need to be updated ("dirty bit")

Sounds like you want to use the JSON Merge Patch algorithm. From the abstract: This specification defines the JSON merge patch format and processing rules. The merge patch format is primarily ...
Blake's user avatar
  • 391
5 votes

Clean Architecture and Persistence Annotations

You basically answer your own question. Strictly following the "clean architecture" dogma leads to "many new classes and boilerplate code (...) this option may do more harm than good." If ...
JacquesB's user avatar
  • 62.3k
5 votes

Can a Domain Object always be "completely ignorant of persistence" and yet still possible to persist?

to me, a straight up reading of "doesn't know how to be persisted and even if it will be persisted" means to me it should not be designed at all with persistence in mind. Though I ...
Joris Timmermans's user avatar
4 votes
Accepted

Is storing configurations in memory more performance and maintenance efficient?

I'm not talking about which code will be better, rather I want to know if one way is more efficient than the other. Then you are talking about the wrong thing. The performance of this is not going ...
Michael Borgwardt's user avatar
4 votes
Accepted

Using a domain model to persist metrics

The easiest way to handle it depends on whether the web app directly calls for EntityA or whether it calls an API layer of yours that happens to call the third party API for EntityA. If you have no ...
Michael's user avatar
  • 6,487
4 votes
Accepted

Should the Model be able to persist itself? When?

It depends. There can be scenarios where this is suitable: When you don't implement a larger "enterprise system" or real business software, but something smaller, maybe something like a ...
Doc Brown's user avatar
  • 220k
4 votes

Do Domain Objects Have To Be Persisted?

I would say that the domain object has no relation to the persistence model you use in your application. It's true that some of the web frameworks (like Rails for instance) would assume that every ...
rxn1d's user avatar
  • 149
4 votes
Accepted

How to Access the Private State of an Entity in the Save Method of its Repository

The problem here is that several guidelines which can be argued to be good advice (individually) simply contradict one another when combined. This isn't a failing of the individual guidelines, it's ...
Flater's user avatar
  • 59.5k
3 votes

Which database strategy should I choose?

Consider writing to a log file instead of a database. While a database is great if you intend to regularly query the log for other application purposes, logging for the sake of logging is often ...
jleach's user avatar
  • 2,692
3 votes

Best approach to persist settings in files

Have you tried SQLite? It's a self contained embedded lightweight SQL database. A lot of applications use it to store user settings and other persistence use cases in Desktop Apps - all the major ...
Gaurav Ramanan's user avatar
3 votes
Accepted

Achieving "Persistence Ignorance" by having a persistence model separate from the domain model

I think perhaps part of what you are struggling with here is that ORMs are designed to sit in the same spot in the design where the persistence layer would decouple the storage and the domain model. ...
JimmyJames's user avatar
  • 30.9k
3 votes

How are account balances persisted

If by "persisted" you mean "stored into a (not necessarily relational) database", then in general you shouldn't store derived values along with the primary values. This is called denormalization and ...
Kilian Foth's user avatar
3 votes

Can I use the memento pattern with multiple relationships and persistence?

You actually have two problems: You need to implement a rollback mechanism You need to store each edit in the database These require two different solutions. If you have a traditional web application ...
Greg Burghardt's user avatar
3 votes

Cache vs DB design decision?

You may consider the following: While Redis can persist data, this was not its original goal. It was originally designed as a cache solution, not a database. This is especially important if you expect ...
Arseni Mourzenko's user avatar
3 votes

Ways to mark the parts of a JSON that need to be updated ("dirty bit")

One possibility is computing a hash of the data and storing that as well. When if comes time to save, compute the hash of the incoming data and compare it with the hash that is stored for that object....
Jon Raynor's user avatar
  • 11.8k
3 votes

Is putting an Id to a value object a bad id?

An address object (which refers to a street address) can be modeled either as a value object or as an entity. The trade-off lies mostly in the database/storage layer. If you design your storage to ...
Bart van Ingen Schenau's user avatar
3 votes

Is putting an Id to a value object a bad id?

Having multiple value objects of the same type relate to an Entity is a common use-case. What I usually do is to model my value objects differently, and try to understand if it's better to have a ...
kekko12's user avatar
  • 131
3 votes

How to correctly translate UML Association, Aggregation and Composition to a Hibernate mapping?

Aggregations and compositions are specialized associations that carry some additional semantic (i.e. meaning): UML doesn't specify the semantic of aggregation ("Precise semantics of shared ...
Christophe's user avatar
  • 82.2k
3 votes

Bulk Update of DDD Aggregate Roots

The application uses JPA/Hibernate for persistence. The current behavior is that all aggregate roots are fetched from the database, updated by the application and then written back to the database ...
Robert Bräutigam's user avatar
3 votes

BPMN - How to handle "under the hood" data change

One way of doing this would be to verify the version of the row the underlying table has. Alternative would be to use a timestamp. You can pass the timestamp as input from one activity to another ...
Alexander Petrov's user avatar
3 votes

Importance of loading/saving complete aggregates at once in DDD

There may not be a direct and detailed answer, because DDD itself is not a well defined thing. I just wanted to draw your attention to the fact, that not all interpretations of DDD end up loading/...
Robert Bräutigam's user avatar
3 votes
Accepted

Should repositories return self persisting entities?

In domain driven design... I'm with @Flater on this one. DDD is mainly about the domain as ubiquitous language, i.e. used everywhere, including in the code. It is less about these entity-value-...
Robert Bräutigam's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible