I have a CHAR-field in my database, this field has a fixed lenght:
@Column(nullable = false, insertable = true, updatable = true, length = 10, columnDefinition = "char(10)")
public
String getName() {return name.trim(); }
I use the trim-method to get always the trimmed version of my name (that means all blanks will be deleted), when I retrieve this field from the database.
Should I do the trim in the getter or setter?
The problem is, when I do the trim in the getter, then JPA/Hibernate wants to update all these trimmed fields. I do not want that. I only want avoid to call everytime the trim-method from my session-Bean when I get char-fields. Any suggestions?
[ December 04, 2008: Message edited by: nimo frey ]