0
我在数据库中创建对象子对象后,使用JpaRepository。 我检索一个对象父对象,但新对象不存在于父对象中。 级联不刷新。在添加子对象后强制刷新对象父亲jpa
对于检索父对象,我使用方法findOne或getOne,但问题是相同的。我尝试使用,但问题是THA一样:
\t @Query("select u from User u where u.id=:x")
\t public User findUserById(@Param("x") String id);
的用户有PROFIL的收集和PROFIL有一个用户。在同一时间,我创建了一个PROFIL后,我试图获取用户,但新PROFIL添加它并没有这样做
In User Entity
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.FALSE)
private Collection<Profil> profils;
In profil entity
@ManyToOne(cascade = CascadeType.ALL)
private User user;
如何强制刷新JPA与新元素在DB? 感谢
你可以包括你的服务? –
为什么不附上这一切? –
附加,我不理解? – Pierre