I have this code:
public class Item {
@Column(name = "serialNo", length = 12)
public String getSerialNo() {
return this.serialNo;
}
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
}
However, the database schema defines the column to be lenght 13. When the item is retrieved via:
List<Item> items = getEntityManager().createNamedQuery(SQL).getResultList();
The data that has serialNo
characters equal to 13
(since db table schema allows 13) are still being displayed as 13, not truncated. What is the use of the @Column
length
then?