在使用springboot和springjpa的项目中,一个eninity functionconfiguration,其中包含一个整数目标设备列表
@Entity
@Table(name = "function_configuration")
public class FunctionConfigurationEntity {
@Id
@Column(name = "id_function_configuration")
@GeneratedValue(strategy = IDENTITY)
private Integer idFunctionConfiguration;
@ElementCollection
@CollectionTable(name = "target_device")
private List<Integer> targetDevice;
}
如果我尝试用functionconfiguration的id进行删除
@Transactional
@Modifying
@Query(value = "DELETE FROM FunctionConfigurationEntity fce WHERE fce.idFunctionConfiguration = idFunctionConfiguration")
void deleteByFunctionConfigurationId(@Param("idFunctionConfiguration") Integer functionConfigurationId);
我得到以下错误:
Caused by: org.postgresql.util.PSQLException: ERROR: UPDATE or DELETE statement on table "function_configuration" violates foreign key constraint "fk69tox326tcrs3wed1neufb0pv" on table "target_device"
我该怎么修?
暂无答案!
目前还没有任何答案,快来回答吧!