简体   繁体   中英

Spring Boot JPA/Hibernate PostgreSQL

so I'm trying to implement da db I found online for a school project.I have experience with ASP.NET Core and Enitty Framework Core but I had never worked before with spring. This is how the db looks like: 在此处输入图像描述

So my question is the following: How my movieCast entity would look like if i want to save in it an List of Actors not just an actor?

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "actorId", insertable=false, updatable=false)
Actor actor;

@Column(name = "actorId", nullable=false)
Long actorId;

Hope this will help.

You can use Many-To-Many Relationship

You have differents ways to reach your goal

More informations check the link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM