Spring Data JPA方法名称

时间:2015-02-02 16:01:40

标签: java spring repository

我需要帮助Spring Data JPA的存储库中的方法名称,我有这样的实体:

  public class User {

    @Id
    @Column(name = "user_id", unique = true, nullable = false)
    private Integer userId;

    @Size(min = 3, message = "Login must be at least 3 characters!")
    @Column(name = "login", length = 50, updatable = false, unique = true)
    private String login;

    @Size(min = 5, message = "Password must be at least 5 characters!")
    @JsonIgnore
    @Column(name = "password", length = 70)
    private String password;

    @Size(min = 3, message = "Name must be at least 3 characters!")
    @Column(name = "firstName", length = 70)
    private String firstName;

    @Size(min = 3, message = "Name must be at least 3 characters!")
    @Column(name = "lastName", length = 70)
    private String lastName;

       /**
     * Contains images uploaded by this user
     */
    @JsonIgnore
    @OneToMany(mappedBy = "user", fetch = FetchType.EAGER, orphanRemoval = true)
    private Set<Image> images = new HashSet<Image>();

       * Contains requests submitted by this user
     */
    @JsonIgnore
    @OneToMany(mappedBy = "author", orphanRemoval = true, fetch = FetchType.LAZY)
    private Set<Request> requests = new HashSet<Request>();

    /**
     * Contains feedbackas provided by this user to hosters
     */
    @JsonIgnore
    @OneToMany(mappedBy = "author", orphanRemoval = true, fetch = FetchType.LAZY)
    private Set<Feedback> feedbacks = new HashSet<Feedback>();

    @JsonIgnore
    @OneToMany(mappedBy = "owner", fetch = FetchType.EAGER, orphanRemoval = true)
    private Set<Place> places;

    @OneToMany
    @JsonIgnore
    private Set<Place> bookedPlaces;

    @ManyToMany(fetch = FetchType.EAGER)
    @Cascade({ CascadeType.DELETE, CascadeType.PERSIST })
    @JsonIgnore
    @JoinTable(name = "user_place", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "place_id"))
    private Set<Place> attendee;

我使用的是Spring Data JPA,我需要编写将返回给我私人Set参与者的方法; 应如何调用此方法??

0 个答案:

没有答案