spring-projects / spring-data-jpa

Simplifies the development of creating a JPA-based data access layer.
https://spring.io/projects/spring-data-jpa/
Apache License 2.0
2.93k stars 1.39k forks source link

@Query("delete from xxxxx") SQLGrammarException: could not execute statement #3459

Closed chenygs closed 2 months ago

chenygs commented 2 months ago

package com.medtion.core.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonView; import com.medtion.core.view.View; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

@Getter @Setter @Entity @Table(name = "test_dict") @JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"}) public class TestDict { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @JsonView(value = View.UserView.class) private Integer id;

@Column(name = "name")
@JsonView(value = View.UserView.class)
private String name;

@JoinColumn(name = "pid")
@ManyToOne(fetch = FetchType.LAZY)
@NotFound(action = NotFoundAction.IGNORE)
private TestDict parent;

@Column(name = "weight")
@JsonView(value = View.UserView.class)
private Integer weight;

@JoinColumn(name = "group_id")
@ManyToOne(fetch = FetchType.LAZY)
@NotFound(action = NotFoundAction.IGNORE)
@JsonView(value = View.UserView.class)
private TestDictGroup group;

}

christophstrobl commented 2 months ago

duplicate of #3458