diff --git a/.gitignore b/.gitignore
index fb890aa..f158037 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,5 @@
target/
demo*/
.idea/dictionaries/
-etunicorn.db
.idea/dataSources
!/src/main/java/etunicorn/NotEnoughtDataException.java
diff --git a/etunicorn-server.iml b/etunicorn-server.iml
index 9f776d0..5a41014 100644
--- a/etunicorn-server.iml
+++ b/etunicorn-server.iml
@@ -10,11 +10,8 @@
-
-
-
@@ -85,7 +82,10 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 3a3169a..dd92414 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,9 +32,8 @@
- org.xerial
- sqlite-jdbc
- 3.16.1
+ mysql
+ mysql-connector-java
@@ -42,6 +41,15 @@
commons-lang
2.3
+
+ com.h2database
+ h2
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ 1.4.4.RELEASE
+
diff --git a/src/main/java/etunicorn/Application.java b/src/main/java/etunicorn/Application.java
index 00c8eec..ece51bf 100644
--- a/src/main/java/etunicorn/Application.java
+++ b/src/main/java/etunicorn/Application.java
@@ -12,10 +12,9 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
-import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -25,6 +24,7 @@ import java.util.List;
* Copyright © 2017 Le Club Info Polytech Lille
* Tous droits réservés
*/
+@Configuration
@SpringBootApplication
@EnableAutoConfiguration
public class Application {
@@ -60,11 +60,21 @@ public class Application {
};
}
- @Bean
- public DataSource dataSource() {
- DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
- dataSourceBuilder.driverClassName("org.sqlite.JDBC");
- dataSourceBuilder.url("jdbc:sqlite:etunicorn.db");
- return dataSourceBuilder.build();
- }
+ // @Bean
+ // public DataSource dataSource() {
+ // DriverManagerDataSource dataSource = new DriverManagerDataSource();
+ // dataSource.setDriverClassName("com.mysql.jdbc.Driver");
+ // dataSource.setUrl("jdbc:mysql://localhost/etunicorn");
+ // dataSource.setUsername("etunicorn");
+ // dataSource.setPassword("etunicorn");
+ // return dataSource;
+ // }
+
+ // Properties additionalProperties() {
+ // Properties properties = new Properties();
+ // properties.setProperty("spring.jpa.hibernale.ddl-auto", "create-drop");
+ // properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
+ // return properties;
+ // }
+
}
diff --git a/src/main/java/etunicorn/controller/BaseController.java b/src/main/java/etunicorn/controller/BaseController.java
index f7f5d3c..e5e1372 100644
--- a/src/main/java/etunicorn/controller/BaseController.java
+++ b/src/main/java/etunicorn/controller/BaseController.java
@@ -6,7 +6,6 @@ import etunicorn.repository.PermissionRepository;
import etunicorn.service.SessionService;
import net.minidev.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.repository.Repository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
@@ -15,7 +14,6 @@ import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
-import java.util.Map;
/**
* etunicorn-server
@@ -25,9 +23,6 @@ import java.util.Map;
@RestController
public class BaseController {
- // Utilités pour merger un request dans une entity
- @Autowired
- Map repositories;
// Permettent la vérification de permissions dans les méthodes de controlleur
@Autowired
private HttpServletRequest request;
diff --git a/src/main/java/etunicorn/databaseConfiguration/SQLiteDialect.java b/src/main/java/etunicorn/databaseConfiguration/SQLiteDialect.java
deleted file mode 100644
index f10299b..0000000
--- a/src/main/java/etunicorn/databaseConfiguration/SQLiteDialect.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package etunicorn.databaseConfiguration;
-
-/**
- * etunicorn-server
- * Copyright © 2017 Le Club Info Polytech Lille
- * Tous droits réservés
- */
-
-import org.hibernate.dialect.Dialect;
-import org.hibernate.dialect.function.SQLFunctionTemplate;
-import org.hibernate.dialect.function.StandardSQLFunction;
-import org.hibernate.dialect.function.VarArgsSQLFunction;
-import org.hibernate.type.StringType;
-
-import java.sql.Types;
-
-public class SQLiteDialect extends Dialect {
- public SQLiteDialect() {
- registerColumnType(Types.BIT, "integer");
- registerColumnType(Types.TINYINT, "tinyint");
- registerColumnType(Types.SMALLINT, "smallint");
- registerColumnType(Types.INTEGER, "integer");
- registerColumnType(Types.BIGINT, "bigint");
- registerColumnType(Types.FLOAT, "float");
- registerColumnType(Types.REAL, "real");
- registerColumnType(Types.DOUBLE, "double");
- registerColumnType(Types.NUMERIC, "numeric");
- registerColumnType(Types.DECIMAL, "decimal");
- registerColumnType(Types.CHAR, "char");
- registerColumnType(Types.VARCHAR, "varchar");
- registerColumnType(Types.LONGVARCHAR, "longvarchar");
- registerColumnType(Types.DATE, "date");
- registerColumnType(Types.TIME, "time");
- registerColumnType(Types.TIMESTAMP, "timestamp");
- registerColumnType(Types.BINARY, "blob");
- registerColumnType(Types.VARBINARY, "blob");
- registerColumnType(Types.LONGVARBINARY, "blob");
- // registerColumnType(Types.NULL, "null");
- registerColumnType(Types.BLOB, "blob");
- registerColumnType(Types.CLOB, "clob");
- registerColumnType(Types.BOOLEAN, "integer");
-
- registerFunction( "concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "") );
- registerFunction( "mod", new SQLFunctionTemplate( StringType.INSTANCE, "?1 % ?2" ) );
- registerFunction( "substr", new StandardSQLFunction("substr", StringType.INSTANCE) );
- registerFunction( "substring", new StandardSQLFunction( "substr", StringType.INSTANCE) );
- }
-
- public boolean supportsIdentityColumns() {
- return true;
- }
-
- /*
- public boolean supportsInsertSelectIdentity() {
- return true; // As specify in NHibernate dialect
- }
- */
-
- public boolean hasDataTypeInIdentityColumn() {
- return false; // As specify in NHibernate dialect
- }
-
- /*
- public String appendIdentitySelectToInsert(String insertString) {
- return new StringBuffer(insertString.length()+30). // As specify in NHibernate dialect
- append(insertString).
- append("; ").append(getIdentitySelectString()).
- toString();
- }
- */
-
- public String getIdentityColumnString() {
- // return "integer primary key autoincrement";
- return "integer";
- }
-
- public String getIdentitySelectString() {
- return "select last_insert_rowid()";
- }
-
- public boolean supportsLimit() {
- return true;
- }
-
- protected String getLimitString(String query, boolean hasOffset) {
- return new StringBuffer(query.length()+20).
- append(query).
- append(hasOffset ? " limit ? offset ?" : " limit ?").
- toString();
- }
-
- public boolean supportsTemporaryTables() {
- return true;
- }
-
- public String getCreateTemporaryTableString() {
- return "create temporary table if not exists";
- }
-
- public boolean dropTemporaryTableAfterUse() {
- return false;
- }
-
- public boolean supportsCurrentTimestampSelection() {
- return true;
- }
-
- public boolean isCurrentTimestampSelectStringCallable() {
- return false;
- }
-
- public String getCurrentTimestampSelectString() {
- return "select current_timestamp";
- }
-
- public boolean supportsUnionAll() {
- return true;
- }
-
- public boolean hasAlterTable() {
- return false; // As specify in NHibernate dialect
- }
-
- public boolean dropConstraints() {
- return false;
- }
-
- public String getAddColumnString() {
- return "add column";
- }
-
- public String getForUpdateString() {
- return "";
- }
-
- public boolean supportsOuterJoinForUpdate() {
- return false;
- }
-
- public String getDropForeignKeyString() {
- throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect");
- }
-
- public String getAddForeignKeyConstraintString(String constraintName,
- String[] foreignKey, String referencedTable, String[] primaryKey,
- boolean referencesPrimaryKey) {
- throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect");
- }
-
- public String getAddPrimaryKeyConstraintString(String constraintName) {
- throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect");
- }
-
- public boolean supportsIfExistsBeforeTableName() {
- return true;
- }
-
- public boolean supportsCascadeDelete() {
- return false;
- }
-}
\ No newline at end of file
diff --git a/src/main/ressources/application.yml b/src/main/ressources/application.yml
deleted file mode 100644
index 9fe5a39..0000000
--- a/src/main/ressources/application.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-spring:
- jpa:
- database-platform: etunicorn.databaseConfiguration.SQLiteDialect
- hibernate:
- ddl-auto: create-drop
\ No newline at end of file
--
libgit2 0.21.2