I do not want to perform delete operations in my webapp. Therefore, I save the state of the column in all tables, which is equal to P if the record is deleted. By default, I want to receive records; objects with status = P should not be selected; that is, additional where the condition must be met ... where status = A; or status! = P.
What is the best way to achieve this using annotations? I can, of course, write a manual request ..
For example: the My User class may have several children. How can we implement so that user.getChilds () does not return children with a status like P
User.java @OneToMany( mappedBy = "usr", targetEntity = Child.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL ) @OrderBy( "fullName ASC" ) List<Child> childs; Child.java: @ManyToOne @JoinColumn User usr;
source share