oasp / oasp4j

The Open Application Standard Platform for Java
Apache License 2.0
60 stars 303 forks source link

DB-Integration - Microsoft SQL Server #482

Open kiran-vadla opened 8 years ago

kiran-vadla commented 8 years ago

As part of this task , have to ensure OASP4J works well with Microsoft SQL Server 2008 , apart from the current integration with the H2 embedded database . Integration has to be identical to the way currently H2 is integrated (ie., including specific JPA configuration and Flyway migration.)

kiran-vadla commented 8 years ago

Hi All,

I was working on integrating Microsoft MSSQL Server 2008 with OASP4J. I have changed the flyway migration scripts accordingly and also have crated a 'mssql' spring profile for Database connection Url , driver details similar to application-h2mem.properties .

When I try to run 'mvn clean install', Junits for ProductImportJobTest and DrinkDaoTest are failing . Error is 'Incorrect syntax near the keyword 'user' . From the error , my understanding is that USER is a reserved keyword in MSSQL Server 2008 and hence we have to escape using square brackets .

I don't have a clue on how to proceed further since my understanding is that the SQL that is failing is being generated by Hibernate on the fly.

Attached is the complete trace of 'mvn clean install' for OASP4J project . It contains error as well.

Inputs and suggestions on overcoming this error are highly appreciated.

Thanks, Kiran DBIntegration-MSSQLServer2005-ErrorStackTrace.txt

jomora commented 8 years ago

@kiran-vadla did you find a solution / work around / hack already? If so, could you please describe how you proceeded? This allows us to discuss if there is a problem with the current solution. Thanks

kiran-vadla commented 8 years ago

@jomora , As a solution , I have added the annotation ' @Column(name = "[user]")' for user attribute of io.oasp.module.jpa.dataaccess.api.AdvancedRevisionEntity.java . Complete code is as follows :

/* @see #getUser() / /* Comment the following line completely (Column Annotation) in case of database other than MS SQL Server 2008 / @Column(name = "[user]") private String user;

If you the comments section , It is mentioned that the annotation has to be removed for Database other than MS SQL Server 2008.

Thanks, Kiran.

kiran-vadla commented 8 years ago

Attached is the guide that contains the instructions for the installation of Microsoft SQL Server 2008 and also the instructions to configure Microsoft SQL Ser DBIntegration - MSSQLServer - Guide.pdf ver 2008 with OASP4J.

https://github.com/kiran-vadla/oasp4j.git is fork Url and dbIntegration-MSSQL is the branch to get the source code for 'DBIntegration with MS SQL Server 2008'

Thanks, Kiran.

kiran-vadla commented 7 years ago

Attaching the updated Guide. DBIntegration - MSSQLServer - Guide.pdf