Один ко многим в Java: когда коллекция в родителе оправдана, а когда — нет

Реляционная модель хранит FK на стороне дочерней таблицы. В Java у нас два способа отразить эту связь: коллекция в родительской сущности ( @OneToMany / List) или ссылка в дочерней ( @ManyToOne / long parentId). Выбор между ними влияет на поведение при записи — и именно здесь большинство решений принимаются без достаточного обоснования. Тест, который даёт однозначный ответ Влад Михалча формулирует так: ассоциация @ManyToOne является наиболее естественным способом отображения связи «один ко многим» в базе данных и, как правило, наиболее эффективной альтернативой. Практический критерий: если убрать коллекцию и заменить её отдельным запросом, какое бизнес-правило перестанет работать? Если ответ — «никакое, просто список будет получаться отдельным запросом» — коллекция не нужна как часть модели. Если ответ — «нарушится инвариант» — коллекция оправдана. Типичные случаи:

https://habr.com/ru/articles/1050776/

#java #jpa #hibernate #spring #spring_data #jdbc #onetomany #manytoone #ddd #aggregate

Один ко многим в Java: когда коллекция в родителе оправдана, а когда — нет

Реляционная модель хранит FK на стороне дочерней таблицы. В Java у нас два способа отразить эту связь: коллекция в родительской сущности ( @OneToMany / List) или ссылка в дочерней ( @ManyToOne / long...

Хабр

🚨 NEWS: Domain Driven Design: Bounded Context, Aggregate e Ubiquitous Language nella Pratica

Ecco i punti chiave in breve:
💡 Hai microservizi, ma i tuoi team litigano ancora su cosa sia un 'cliente'. Il database è condiviso, le API si parlano con modelli diversi, e il codice assomiglia a un colabrodo di concetti mescolati....

🚀 LINK: https://meteoraweb.com/analisi-dei-dati-e-metriche/domain-driven-design-bounded-context-aggregate-e-ubiquitous-language-nella-pratica

#microservizi #boundedContext #domainDrivenDesign #aggregate #ubiquitousLanguage

Defining robust aggregate boundaries in DDD is crucial but tricky. Missteps affect consistency and performance. Kim Kao's talk presented her 'Aggregate Canvas,' offering a structured, visual approach to map out invariants and consistency rules for clearer aggregate design.

Watch: https://virtualddd.com/sessions/ddddd-20-aggregate-canvas-by-kim-kao/

#DDD #Aggregate #Modeling

[DDDDD-20] Aggregate Canvas by Kim Kao

Aggregate Canvas: A fluent way to walk through Strategical modeling to tactical design As DDD topics become popular in Asia, more and more people still encounter obstacles in their domain model design, unable to move smoothly from domain concepts to code implementation, although there are already a lot of method has been proven to be valid, but still full of uncertainty. In this conference, I will introduce to you a solid approach - Aggregate Canvas. This Aggregate Canvas is created by KuoChao Chang, the co-organizer of DDD Taiwan Community. We would like to guide you to understand how to engage in a conversation with a team by a clear and complete mind to bring domain concepts into implementation, where a lot of elements mentioned in EventStorming are used to guide development teams through design.

Virtual Domain-Driven Design
Rural Oshawa residents call for more information from province about imports at aggregate pit
Residents in rural North Oshawa say they want the province to provide more information about an aggregate pit on the Oak Ridges Moraine, after the Ministry of Natural Resources (MNR) told them fill was being imported there without authorization.
https://www.cbc.ca/news/canada/toronto/oshawa-residents-harmony-road-aggregate-pit-9.7139127?cmp=rss

RE: https://scicomm.xyz/@dantheclamman/116196703399022292

How do #animals #aggregate?#Mites can find each other based on #pheromones, while #sight is important for herd-forming #mammals. In #marine #habitats, #hearing plays a major role. D.McAfee et al.(2022) showed that #oyster #larvae react to the #soundscape of a healthy #reef via #statocysts in front of their bodies, thus finding their adult conspecifics for #reefformation. Reef formation can be artificially #stimulated via artificial #soundwaves.
©#StefanFWirth 2026
Ref
https://doi.org/10.1111/1365-2664.14307

Bayer Leverkusen secured a 0‑0 draw against Olympiacos Piraeus, successfully defending the 2‑0 advantage they held from the first leg and earning a place in the... https://news.osna.fm/?p=35781 | #news #aggregate #champions #last16 #league
Leverkusen Secure Champions League Last‑16 Spot with 2‑0 Aggregate Victory Over Olympiacos - Osna.FM

Leverkusen secure Champions League last‑16 spot after a 0‑0 draw and 2‑0 win, dominating the playoff against Olympiacos.

Osna.FM

COUNT(*) vs COUNT(column) Are DIFFERENT?!

COUNT(*) and COUNT(column) behave completely differently with NULLs! One counts NULLs, one doesn't. This breaks aggregate logic! Watch!

#sql #sqltricks #database #sqltutorial #count #aggregate #sqlquiz #codingchallenge #sqlshorts #sqlbugs #nullhandling #sqlwtf

https://www.youtube.com/watch?v=lCeAps3FTGg

COUNT vs COUNTcolumn Are DIFFERENT?! #count

YouTube

SUM - AVG With Zero Rows Returns WHAT?!

Aggregate functions with zero rows return NULL, not zero! SUM of nothing is NULL, not 0. This breaks aggregate logic! Watch!

#sql #sqltricks #database #sqltutorial #aggregate #zerorows #sqlquiz #codingchallenge #sqlshorts #sqlbugs #aggregatefunctions #sqlwtf

https://www.youtube.com/watch?v=fPdWHWUDZDs

SUMAVG With Zero Rows Returns WHAT?! #sqlquiz

YouTube

SUM Of Empty Set Returns WHAT?!

SUM of an empty set or all NULLs returns something unexpected! This breaks all math assumptions. Your mind will explode! Watch now!

#sql #sqltricks #database #sqltutorial #sum #aggregate #sqlquiz #codingchallenge #sqlshorts #sqlbugs #nullhandling #sqlwtf

https://www.youtube.com/watch?v=Z-94Yr5vElY

SUM Of Empty Set Returns WHAT?! #sqltutorial

YouTube