我有这样的问题:我在 Test 类中有一个属性,它不应该映射到表的列(我在加载我的 Test 对象后使用它来确定是否应该删除 Test 对象)。在我的情况下,这个属性是布尔删除:
@Entity
@Table(name = "[NewMVC].[dbo].[Tests]")
public class Test {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "testQuestion")
private String testQuestion;
@Column(name = "optionOne")
private String optionOne;
@Column(name = "optionTwo")
private String optionTwo;
@Column(name = "optionThree")
private String optionThree;
@Column(name = "subjectType")
private int subjectType;
@Column(name = "correctOptionNumber")
private int correctOptionNumber;
private boolean delete = false;
....
我应该如何告诉休眠我的属性删除未映射到列?