I have one Pojo class in which I create one field which is not mapped with DataBase Table.
So i have to declare the field Declaration and setter and getter method @Transient, otherwise it would have shown an error.
@Transient
private String docHistoryString="";
@Transient
public String getDocHistoryString() {
return docHistoryString;
}
@Transient
public void setDocHistoryString(String docHistoryString) {
this.docHistoryString = docHistoryString;
}
Now, my problem is in the controller. I have set some value in this transient field but when I try to access this variable using EL in view(JSP) it is not giving value. I think this is becouse I used the @transient annotation in get method.
All Hibernate annotations, including
@Transientmust be applied according to access type. By default it will be the same way as@Idapplied. That is if you place@Idon a field you must apply@Transientto the field. And if you apply@Idto getter method, you must apply@Transientmethod. Setter methods are always ignored.It can be customized, though (per documentation), so make sure that someone didn’t do something strange with access types.