I have such problem: i have a property at the class Test which should be not mapped to the column of the table (i use it after my Test object is loaded to determine should Test object be deleted or not). In my case this property is boolean delete:
@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;
....
How should i tell hibernate that my property delete is not mapped to the column?
You could annotate it with the @Transient annotation:
This tells Hibernate to skip this attribute and not to generate a column.