Make hibernate ignore class variables that are not mapped
JPA will use all properties of the class, unless you specifically mark them with @Transient
:
@Transient
private String agencyName;
The @Column
annotation is purely optional, and is there to let you override the auto-generated column name. Furthermore, the length
attribute of @Column
is only used when auto-generating table definitions, it has no effect on the runtime.
For folks who find this posting through the search engines, another possible cause of this problem is from importing the wrong package version of @Transient
. Make sure that you import javax.persistence.transient
and not some other package.
Placing @Transient
on getter with private field worked for me.
private String name;
@Transient
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}