I have an entity with the following fields:
public class P_TABLE2 {
...................
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "P_TABLE1",
joinColumns = {@JoinColumn(name = "P_ID", referencedColumnName = "P_ID",
foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))}
)
@MapKeyColumn(name="P_KEY")
@Column(name = "P_VALUE")
private Map<String, String> bookmarks;
}
Hibernate creates the table P_TABLE1 with following column names:
P_ID | P_KEY | P_VALUE
bigint | varchar(255) | varchar(255)
I would like to change the data type of P_VALUE from varchar(255) to LONGTEXT. I tried everything, but nothing works.
@Column(name="P_VALUE", columnDefinition="CLOB")
@Column(name="P_VALUE", columnDefinition="TEXT")
@Lob @Column(name="P_VALUE", columnDefinition="TEXT") ====> ERROR
Any suggestions? Pls help me.
PS: I see this question JPA how to set column type to be BLOB for ElementCollection table but if I change the column @Column(name="P_VALUE") to @Column(name="P_VALUE", columnDefinition="BLOB"), it does not work. I deleted the table P_TABLE1 in the datbase, and tried to regenerate the table, but no table is created.