org.postgresql.util.PSQLException: ERROR: value too long for type character varying(255)
You try to save a string value more than 255 chars length. Just increase a column length
@Column(name = "xxx", length = 1024)
you need to alter a column length in the database too.
When you use
@Column(name = "xxx")
Hibernate uses a default column length.
You can use @Lob
for a really large text data.
Please, use xxx_users
in place of tblusers
.
Use User
in place of Users
.
Use CascadeType.ALL
on the @OneToMany
part of the association.
Use a lazy loading on the @ManyToOne
part of the association.
@ManyToOne(fetch = FetchType.Lazy)
pravate User user;
For String with more than 255 chars length you can increase column length :
@Column(length = 2048)
private String column;
For large size :
@Lob
private String column;
For unlimited size :
@Column(columnDefinition="text")
private String column;