Timeline for Is there an elegant way to check unique constraints on domain object attributes without moving business logic into service layer?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 23 at 12:26 | comment | added | Arad | @tchelidze Not if all the product SKUs are collected into one aggregate (with optimistic concurrency control) saved with the individual product aggregate within the same transaction. | |
| Oct 16, 2020 at 17:18 | comment | added | tchelidze | Loading all producs SKUs out of db is not even a solution. In a concurrent scenario, when two service are trying to create new product with the same SKU, both might read all product, validate uniqueness and insert duplicate SKUs. | |
| May 19, 2016 at 14:04 | comment | added | VoiceOfUnreason | Perhaps a Bloom filter (see edit). | |
| May 19, 2016 at 14:03 | history | edited | VoiceOfUnreason | CC BY-SA 3.0 | added 880 characters in body |
| May 17, 2016 at 18:41 | history | edited | VoiceOfUnreason | CC BY-SA 3.0 | added 241 characters in body |
| May 17, 2016 at 15:23 | comment | added | Andy | I don't like the need to pull all product SKUs out of the database to do the operation in-memory. It's the obvious solution I suggested in the initial question and questioned its performance. Also, IMO, relying on the constraint in your DB, to be responsible for the uniqueness, is bad. If you were to switch to a new database engine and somehow the unique constraint got lost during a transformation, you have broken code, because the database information that were there before are no longer there. Anyway thank you for the link, interesting read. | |
| May 17, 2016 at 15:00 | history | answered | VoiceOfUnreason | CC BY-SA 3.0 |