in my web app on spring boot 2 i have an entity with ralations onetomany. I do not want to receive these entities. but i get them. i switched of spring.jpa.open-in-view=false. in dao layer i use spring data jpa and methods getById(), getAll() .
my entity class:
@Entity
@Table(name = "project", schema = "ci_crm")
@Data
@NoArgsConstructor
public class ProjectEntity {`
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@ManyToOne
@JoinColumn(name = "company_id")
private CompanyEntity company;
@ManyToOne
@JoinColumn(name = "user_id")
private UserEntity user;
@OneToMany(mappedBy = "project")
private List<MilestoneEntity> milestoneList;
@OneToMany(mappedBy = "project")
private List<NotificationEntity> notificationList;
@OneToMany(mappedBy = "project")
private List<CommentEntity> commentList;
So, how fix it?
the problem is solved: the problem was in service layaer. there was an annotation @Transactional throughout the class.