5
我有一個GWT的Spring Roo應用程序。在服務器端從來就得到了簡單JpaRepository接口,像所有的實體:嵌套的對象還沒有被保存Spring JpaRepository
@Repository
public interface MyEntityRepository extends JpaSpecificationExecutor<MyEntity>, JpaRepository<MyEntity, Long> {
}
有具有一對一關係到MyOtherEntity類myEntity所類。 當我打電話給我的實體服務persist方法
public void saveMyEntity (MyEntity myEntity) {
myEntityRepository.save(myEntity);
}
只有myEntity所的對象將被保存。 MyEntity的所有子對象都被忽略。將myEntity對象與myOtherEntity對象一起保存的唯一方法是在上述代碼之前調用
myOtherEntityRepository.save(myOtherEntity);
。那麼有沒有更好的方法來自動保存JpaRepository接口的子對象?
這對我的作品!謝謝 –