Условная загрузка @ManyToMany JPA ⇐ JAVA
-
Anonymous
Условная загрузка @ManyToMany JPA
I have a user Entity and Article Entity. The fetch type of articles is LAZY. I dont need to load articles all the time but I have a case in which I need to load the user favorites articles. How can I do it conditionally?
@ManyToMany(fetch = FetchType.LAZY) @JoinTable( name = "user_favorite_articles", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "userId", nullable = false), inverseJoinColumns = @JoinColumn(name = "article_id", referencedColumnName = "articleId") ) private List favoriteArticles;
Источник: https://stackoverflow.com/questions/780 ... tomany-jpa
I have a user Entity and Article Entity. The fetch type of articles is LAZY. I dont need to load articles all the time but I have a case in which I need to load the user favorites articles. How can I do it conditionally?
@ManyToMany(fetch = FetchType.LAZY) @JoinTable( name = "user_favorite_articles", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "userId", nullable = false), inverseJoinColumns = @JoinColumn(name = "article_id", referencedColumnName = "articleId") ) private List favoriteArticles;
Источник: https://stackoverflow.com/questions/780 ... tomany-jpa
Мобильная версия