我使用Spring数据和Hibernate,并得到一个错误,当我试图保存集ID实体: org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist: com.snp.cm.persistency.contact.Contact; nested exception is or
public interface AreaRepository extends JpaRepository<Area, Integer>, JpaSpecificationExecutor<Area>{
@Query("from Area where sup is null")
List<Area> findProvinces();
@Query("from Ar
在应用程序中使用Spring Data JPA时,通常需要定义实体(@Entity)并编写一个存储库接口(它扩展了CrudRepository)并执行超出范围的其他配置这个问题。 例如, @Entity
public class Product {
// code removed for brevity
}
public interface ProductRepository e
我正在采取第一次服务/存储库方法并且遇到问题。基本上我想在我的服务中做的是坚持我的实体,然后在相同的服务方法中使用它的ID。 本来我打算使用@GeneratedValue和Sequences,但放弃了手动刷新实体并获取ID,我认为这会更容易。 My Repository是一个使用Spring Data的接口,所以它支持手动刷新。据我了解,它也被注释@Transactional。我的服务方法也用@T