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.

  • and @Transactional is, where necessary? - Nofate
  • There is no @Nofate, but I tried to install it. I never got into this part of the documentation, but in most cases when installing @Transactional spring crashes when I try to wrap the proxy with another proxy. - etki
  • Something is wrong. @Transactional just injects a JPA session into the called method (if you have transactional annotations included, of course, there). Maybe by stektraysu we read? - Nofate
  • @Nofate I understand that it is automatically injected into repository methods with @EnableTransactionManagement turned @EnableTransactionManagement . I can’t bring the stekreys right now, I need to roll back the crutch - etki
  • Oh, these newfangled things in the spring) @EnableTransactionManagement seems 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

0