I finally found the way to solve this problem. It looks like the hibernate data types should be forced in some cases (I'm not sure and what does it depend on...), and in my case all string and/or text columns coming from SQL Server should be forced to java.lang.String
, by adding type-mapping
to the hibernate.reveng.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<schema-selection match-catalog="DB_Name" match-schema="dbo"/>
<type-mapping>
<sql-type jdbc-type="VARCHAR" hibernate-type="java.lang.String" />
<sql-type jdbc-type="NVARCHAR" hibernate-type="java.lang.String" />
<sql-type jdbc-type="NCHAR" hibernate-type="java.lang.String" />
</type-mapping>
<table-filter match-name="Table1"/>
<table-filter match-name="Table2"/>
<table-filter match-name="TableN"/>
</hibernate-reverse-engineering>
Hope this helps to anybody else.