I am doing an application in play framework in which I need to store the same instance of a non-Entity object into a JPA Entity without persisting it into the database, I want to know if it s possible to achieve that or not using annotations. A sample code of what I am looking for is:
public class anEntity extends Model {
@ManyToOne
public User user;
@ManyToOne
public Question question;
//Encrypted candidate name for the answer
@Column(columnDefinition = "text")
public BigInteger candidateName;
//I want that field not to be inserted into the database
TestObject p= new TestObject();
I tried @Embedded annotation but its supposed to embed the object fields into the entity table. Is there anyway to use @Embedded while keeping the object column hidden in the entity table?