---
title: "Discussion on \"Think twice before using @OneToMany\" | Hashnode"
description: "Discussion on \"Think twice before using @OneToMany\". @OneToMany is one of the most often used annotations in #JPA. Whenever a Parent Entity can have multiple Childs we use a Collection with the @OneToMany annotation.\nimport javax.persistence.*;\nimport java.util.HashSet;\nimport java.util.Set;\nimport org..."
url: "https://hashnode.com/posts/think-twice-before-using-onetomany/6684fa7c6229df0dc847d990"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Think twice before using @OneToMany](https://robertniestroj.hashnode.dev/think-twice-before-using-onetomany?utm_source=hashnode&utm_medium=feed)

@OneToMany is one of the most often used annotations in #JPA. Whenever a Parent Entity can have multiple Childs we use a Collection with the @OneToMany annotation. import javax.persistence.\*; import java.util.HashSet; import java.util.Set; import org...

Jul 3, 2024 · 3 min read · robertniestroj.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#jpa](https://hashnode.com/tag/jpa)
-   [#hibernate](https://hashnode.com/tag/hibernate)
-   [#databases](https://hashnode.com/tag/databases)
-   [#orm](https://hashnode.com/tag/orm)

## Written by

[Robert Niestroj](https://hashnode.com/@rniestroj)

@rniestroj · Poland

  
[View profile](https://hashnode.com/@rniestroj)

Software Developer doing Java, JavaScript for over 10 years. Working in Polish and German projects.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
