Я получаю JTA EntityManager не может использовать ошибку getTransaction () при попытке вызвать API DELETE. Не уверен, что мне не хватает конфигураций, связанных с JPA.
Questionnarie.java #
@Entity
@Table(name = "questionnaries")
public class Questionnarie {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_seq")
@SequenceGenerator(name = "id_seq", sequenceName="questionnaries_id_seq")
@Column(name = "id")
private Long id;
@Column(name = "personname")
@NotNull
private String personname;
@Column(name = "question")
@NotNull
private String question;
@Column(name = "response")
@NotNull
private String response;
public Questionnarie() {}
public Questionnarie(@NotNull String personname, @NotNull String question, @NotNull String response) {
super();
this.personname = personname;
this.question = question;
this.response = response;
}
/* Not including GETTERS AND SETTERS for brevity */
QuestionnarieController.java #
@RequestMapping(method=RequestMethod.DELETE, value="/questionnaries/{id}")
public void deleteQuestionnarie(@PathVariable Long id){
questionnarieService.deleteQuestionnarie(id);
}
QuestionnarieService.java
public void deleteQuestionnarie(Long id) {
questionnarieRepository.deleteById(id);
}
QuestionnarieRepository.java #
public void deleteById(Long id);
application.properties
spring.datasource.jndi-name=java:jboss/datasources/testDS
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect