Reputation: 1151
I am trying to persist an entity class here
@Entity
@Table(name="team")
public class Team {
@Id
protected String teamId;
protected String teamName;
protected String teamDescription;
protected Date createdOn;
protected String teamLeader;
// all getter setter methodes
}
The problem is teamLeader in not a field in the team table. I am just using it just to get its value from the form and using it somewhere else. how can i avoid persisting it as it is getting persisted like all other members. Please help. Thanks.
Upvotes: 1
Views: 37
Reputation: 9548
You can annotate a field with the @Transient
annotation to denote to the JPA implementation that it should not be persisted in the database.
@Transient
protected String teamLeader;
Upvotes: 2