I am using hbm2ddl
to autocreate the schema by including this line in configuration:
<prop key="hibernate.hbm2ddl.auto">create</prop>
I have a entity bean defined as:
@Entity
@Table(name = "user")
public class User {
@Column(name = "firstname")
private String firstName;
@Column(name = "lastname")
private String lastName;
private String fullName;
}
There are 3 attributes and I like the first two to be saved in database table and like to compute the third one. When I run hbm2ddl
with option as create
it's creating all 3 columns although I don't have @Column
annotation on the third one.
How can I prevent Hibernate from creating the last attribute as a column?
@Transient
would definitely stop it.