Reputation: 151
I have a database table in which there is a field which I do not want to map to my model class while making a get call. Is there any annotation to handle this use case?
Upvotes: 1
Views: 663
Reputation: 1316
When persisting Java objects into database records using an Object-Relational Mapping (ORM) framework, we can ignore fields by adding the @Transient
annotation to those fields.
@Entity
@Table(name = "Users")
public class User {
@Id
private Integer id;
private String email;
private String password;
@Transient
private Date loginTime;
// getters and setters
}
Upvotes: 1