Hello folks,
i have to read in a Navision database (SQL-Server 2008). Doing so i have to get around the sql-variant-Datatype that is not supported anymore by the official JDBC driver.
So i added the following annotation to my attribute (its read only):
Code:
@Column(name="Hausnr_", length=30, nullable=false)
@ColumnTransformer(read="CAST([Hausnr_] AS NVARCHAR(30))")
private String hausnr = "";
in this case it works very well, hibernate produced following statement:
"CAST(vu_person0_.[Hausnr_] AS NVARCHAR(30)) as Hausnr11_201_"...
but i think there is a deep flaw in it:
CONVERT and
CAST did not work in this case, because hibernate tries to replace some words in the inner braces with entity-attributes:
Code:
@Column(name="timestamp", nullable=false)
@ColumnTransformer(read="CAST([timestamp] AS INT)")
private int crc;
this results in following:
"CAST(vu_person0_.[timestamp] AS
vu_person0_.INT) as timestamp6_201_"...
which of course will result in a database error, because there is no database type like xyz.INT.
Beside that i think it's a general error, anyone knows
how to get around this?Chris