The following errors appeared in the project when deleting an entity with a composite key:
No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call In this case, this happens only when you try to call the repository method of this entity, with others everything is in order:
public interface RecordAttributeRepository extends PagingAndSortingRepository<RecordAttribute, RecordAttributePrimaryKey> { @Modifying // наличие или отсутствие аннотации не влияет ни на что void deleteByIdEntityNameAndIdEntityId(String idEntityName, String idEntityId); } the entity itself and its PK look like this:
public class RecordAttribute { @EmbeddedId private RecordAttributePrimaryKey id; @Column(name = "attribute_value", nullable = false) private String value; ... } public class RecordAttributePrimaryKey implements Serializable { private static final long serialVersionUID = 1L; @Column(name = "entity_name", nullable = false) private String entityName; @Column(name = "entity_id", nullable = false) private String entityId; @Column(name = "attribute_name", nullable = false) private String attribute; ... } Chyadt? JpaTransactionManager , PersistenceExceptionTranslationPostProcessor are created and exist inside the container, with the rest of the entities everything is OK, the version of the spring and orms is 4.2.0.
@Transactionalis, where necessary? - Nofate ♦@Transactionalspring crashes when I try to wrap the proxy with another proxy. - etki@EnableTransactionManagementturned@EnableTransactionManagement. I can’t bring the stekreys right now, I need to roll back the crutch - etki@EnableTransactionManagementseems to be tantamount to<tx:annotation-driven/>. That is, you need to declare transactions through @Transactional. I think you need to smoke 16. Transaction Management - Nofate ♦