#@OneToMany and @ManyToOne

1 messages · Page 1 of 1 (latest)

molten dagger
#

Is this right I am just trying it out
I new to JPA (Well known with Relational DB concepts)cat_thumbs_up

stark sandalBOT
#

<@&987246841693360200> please have a look, thanks.

stark sandalBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

Yes, you are on the right track! In Java, the Spring framework provides support for working with databases using JPA (Java Persistence API). JPA is a specification that allows you to map Java objects to relational database tables.

The @OneToMany and @ManyToOne annotations are used to define relationships between entities in JPA.

  • @OneToMany is used to define a one-to-many relationship between two entities. For example, if you have an entity called "Author" and another entity called "Book", you can use @OneToMany on the Author entity to indicate that an author can have multiple books.

  • @ManyToOne is used to define a many-to-one relationship between two entities. Continuing with the previous example, you can use @ManyToOne on the Book entity to indicate that multiple books can belong to a single author.

These annotations help in mapping the relationships between entities in your application's data model. They allow you to navigate and query related entities easily.

It's great that you are familiar with relational database concepts as it will help you understand how these relationships are represented in the database schema.

Keep exploring and experimenting with JPA and Spring!

#

Changed the category to Database.

#

<@&987246584574140416> please have a look, thanks.

arctic plaza
molten dagger
molten dagger
#

how should I make a constructor for pathList?

drifting skiff
#

pathList is a field not a class

molten dagger
molten dagger
drifting skiff
#

Try to discuss to chatgpt

molten dagger