We have a schema in Microsoft SQL Server 2008 (already created) where is a table with a column of type char(32)
.
We would like to map this to an entity property but it fails with a message:
org.hibernate.HibernateException: Wrong column type in myTable for column myColumn. Found: char, expected: varchar(255)
The dialect used is org.hibernate.dialect.SQLServer2008Dialect
and the property is annotated with just
@Column(name = "my_Column")
public String getMyColumn() {
return myColumn;
}
The application won't be writing into database - it will be used read-only.
How can this be set to work? We tried @Type
annotation with various values but without success.
EDIT:
It turned out that my real problem was hibernate.globally_quoted_identifiers=true
property which made columnDefinition
unusable and I thought that it isn't the right way to do the things. After being pointed to columnDefinition
solution again I put more effort into finding out why it does not work for us and removing this property made it work for us as advised.