Hello

I am using SQL server for my application and H2 for my test unit, 

The problem is that the syntax in MSSQL use double quote " and simple quote 
' in H2


In my entity I have a column like this :

@Formula("DATEDIFF(\"DAY\", GETDATE(), contract_date_end)")
private String difference;

this works in MSSQL but not in H2  :

2014-07-18 09:25:28,606: ERROR 
[org.hibernate.util.JDBCExceptionReporter](?:?)  - Column "CONTRACT0_.DAY" 
not found; SQL statement:
select ... DATEDIFF(contract18_."DAY", GETDATE(), 
contract18_.contract_date_end) as formula4_17_ .... from ....
It considers "DAY" as a column...

@Formula("DATEDIFF('DAY', GETDATE(), contract_date_end)")
private String difference;

this works in H2 and not MSSQL.


But I am using H2 in MSSQL mode  :

<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" 
id="dataSourceH2">
    <property name="driverClassName" value="org.h2.Driver"/>
   <property name="url" value="jdbc:h2:mem:unittest;MODE=MSSQLServer"/>
</bean>


So isn't it suppossed to work ?

thanks for help !





-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to