I have a Spring Roo application with GWT. On server-side I´ve got simple JpaRepository interfaces for all entities like:
@Repository
public interface MyEntityRepository extends JpaSpecificationExecutor<MyEntity>, JpaRepository<MyEntity, Long> {
}
There is a MyEntity class that has a One-To-One relationship to a MyOtherEntity class. When I call my entity-service persist method
public void saveMyEntity (MyEntity myEntity) {
myEntityRepository.save(myEntity);
}
only the myEntity object will be saved. All sub objects of MyEntity are ignored. The only way to save the myEntity object along with the myOtherEntity object is calling
myOtherEntityRepository.save(myOtherEntity);
before the above code. So is there a more elegant way to automatically save sub objects with JpaRepository interface?