Commit 609f29a9d022fb943d76e4b22306f5d1a42303b7

Authored by Geoffrey PREUD'HOMME
1 parent 474776a8

Test Hibernate & Postgres

Ne fonctionne pas, c'est pour vérifier
Showing 20 changed files with 170 additions and 265 deletions   Show diff stats
etunicorn-server.iml
... ... @@ -10,7 +10,6 @@
10 10 </content>
11 11 <orderEntry type="inheritedJdk" />
12 12 <orderEntry type="sourceFolder" forTests="false" />
13   - <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.3" level="project" />
14 13 <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-rest:1.4.4.RELEASE" level="project" />
15 14 <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.4.RELEASE" level="project" />
16 15 <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" />
... ... @@ -50,15 +49,8 @@
50 49 <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.11" level="project" />
51 50 <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.6.RELEASE" level="project" />
52 51 <orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.0.11.Final" level="project" />
53   - <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
54   - <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
55   - <orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
56 52 <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
57 53 <orderEntry type="library" name="Maven: org.jboss:jandex:2.0.0.Final" level="project" />
58   - <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
59   - <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
60   - <orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
61   - <orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.0.11.Final" level="project" />
62 54 <orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.2" level="project" />
63 55 <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.10.7.RELEASE" level="project" />
64 56 <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.12.7.RELEASE" level="project" />
... ... @@ -85,7 +77,15 @@
85 77 <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" />
86 78 <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" />
87 79 <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" />
88   - <orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.16.1" level="project" />
89 80 <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.3" level="project" />
  81 + <orderEntry type="library" scope="RUNTIME" name="Maven: org.hibernate:hibernate-entitymanager:5.0.11.Final" level="project" />
  82 + <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
  83 + <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
  84 + <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
  85 + <orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
  86 + <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
  87 + <orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
  88 + <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1" level="project" />
  89 + <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.40" level="project" />
90 90 </component>
91 91 </module>
92 92 \ No newline at end of file
... ...
... ... @@ -32,17 +32,22 @@
32 32 </dependency>
33 33  
34 34 <dependency>
35   - <groupId>org.xerial</groupId>
36   - <artifactId>sqlite-jdbc</artifactId>
37   - <version>3.16.1</version>
38   - </dependency>
39   -
40   - <dependency>
41 35 <groupId>commons-lang</groupId>
42 36 <artifactId>commons-lang</artifactId>
43 37 <version>2.3</version>
44 38 </dependency>
45 39  
  40 + <dependency>
  41 + <groupId>org.hibernate</groupId>
  42 + <artifactId>hibernate-entitymanager</artifactId>
  43 + <scope>runtime</scope>
  44 + </dependency>
  45 +
  46 + <dependency>
  47 + <groupId>mysql</groupId>
  48 + <artifactId>mysql-connector-java</artifactId>
  49 + <scope>runtime</scope>
  50 + </dependency>
46 51  
47 52 </dependencies>
48 53  
... ...
src/main/java/etunicorn/Application.java
1 1 package etunicorn;
2 2  
3   -import etunicorn.entity.Permission;
4   -import etunicorn.entity.Personne;
5   -import etunicorn.entity.Role;
6   -import etunicorn.entity.Session;
7   -import etunicorn.repository.PermissionRepository;
8   -import etunicorn.repository.PersonneRepository;
9   -import etunicorn.repository.RoleRepository;
10   -import etunicorn.repository.SessionRepository;
  3 +import etunicorn.domain.Permission;
  4 +import etunicorn.domain.Personne;
  5 +import etunicorn.domain.Role;
  6 +import etunicorn.domain.Session;
  7 +import etunicorn.spring.jpa.repository.PermissionRepository;
  8 +import etunicorn.spring.jpa.repository.PersonneRepository;
  9 +import etunicorn.spring.jpa.repository.RoleRepository;
  10 +import etunicorn.spring.jpa.repository.SessionRepository;
11 11 import org.springframework.boot.CommandLineRunner;
12 12 import org.springframework.boot.SpringApplication;
13 13 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
14 14 import org.springframework.boot.autoconfigure.SpringBootApplication;
15   -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
16 15 import org.springframework.context.annotation.Bean;
17 16  
18   -import javax.sql.DataSource;
19 17 import java.util.ArrayList;
20 18 import java.util.Date;
21 19 import java.util.List;
... ... @@ -59,12 +57,4 @@ public class Application {
59 57  
60 58 };
61 59 }
62   -
63   - @Bean
64   - public DataSource dataSource() {
65   - DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
66   - dataSourceBuilder.driverClassName("org.sqlite.JDBC");
67   - dataSourceBuilder.url("jdbc:sqlite:etunicorn.db");
68   - return dataSourceBuilder.build();
69   - }
70 60 }
... ...
src/main/java/etunicorn/SecurityInterceptor.java
1 1 package etunicorn;
2 2  
3   -import etunicorn.controller.BaseController;
4   -import etunicorn.entity.Permission;
5   -import etunicorn.entity.Session;
6   -import etunicorn.repository.PermissionRepository;
7   -import etunicorn.service.SessionService;
  3 +import etunicorn.domain.Permission;
  4 +import etunicorn.domain.Session;
  5 +import etunicorn.domain.service.impl.SessionService;
  6 +import etunicorn.spring.jpa.repository.PermissionRepository;
8 7 import org.springframework.beans.factory.annotation.Autowired;
9 8 import org.springframework.http.HttpHeaders;
10 9 import org.springframework.http.HttpStatus;
... ... @@ -58,21 +57,22 @@ public class SecurityInterceptor extends HandlerInterceptorAdapter {
58 57 return false;
59 58 }
60 59  
61   - if (annotation.authentifie()) {
62   - BaseController baseController = new BaseController();
63   - baseController.setRequest(request);
64   - if (session == null) {
65   - ResponseEntity responseEntity = baseController.generateError(HttpStatus.UNAUTHORIZED);
66   - responseEntityToServletResponse(responseEntity, response);
67   - return false;
68   - } else {
69   - if (!session.hasPermission(requiredPermission)) {
70   - ResponseEntity responseEntity = baseController.generateError(HttpStatus.FORBIDDEN);
71   - responseEntityToServletResponse(responseEntity, response);
72   - return false;
73   - }
74   - }
75   - }
  60 + // TODO Remettre bien
  61 + // if (annotation.authentifie()) {
  62 + // BaseController baseController = new BaseController();
  63 + // baseController.setRequest(request);
  64 + // if (session == null) {
  65 + // ResponseEntity responseEntity = baseController.generateError(HttpStatus.UNAUTHORIZED);
  66 + // responseEntityToServletResponse(responseEntity, response);
  67 + // return false;
  68 + // } else {
  69 + // if (!session.hasPermission(requiredPermission)) {
  70 + // ResponseEntity responseEntity = baseController.generateError(HttpStatus.FORBIDDEN);
  71 + // responseEntityToServletResponse(responseEntity, response);
  72 + // return false;
  73 + // }
  74 + // }
  75 + // }
76 76 }
77 77 return super.preHandle(request, response, handler);
78 78 }
... ...
src/main/java/etunicorn/common/PersistenceJPAConfig.java 0 → 100644
... ... @@ -0,0 +1,76 @@
  1 +package etunicorn.common;
  2 +
  3 +import org.springframework.boot.autoconfigure.domain.EntityScan;
  4 +import org.springframework.context.annotation.Bean;
  5 +import org.springframework.context.annotation.ComponentScan;
  6 +import org.springframework.context.annotation.Configuration;
  7 +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
  8 +import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  9 +import org.springframework.jdbc.datasource.DriverManagerDataSource;
  10 +import org.springframework.orm.jpa.JpaTransactionManager;
  11 +import org.springframework.orm.jpa.JpaVendorAdapter;
  12 +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
  13 +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
  14 +import org.springframework.transaction.PlatformTransactionManager;
  15 +import org.springframework.transaction.annotation.EnableTransactionManagement;
  16 +
  17 +import javax.persistence.EntityManagerFactory;
  18 +import javax.sql.DataSource;
  19 +import java.util.Properties;
  20 +
  21 +/**
  22 + * etunicorn-server
  23 + * Copyright © 2017 Le Club Info Polytech Lille
  24 + * Tous droits réservés
  25 + */
  26 +@Configuration
  27 +@EnableTransactionManagement
  28 +@EnableJpaRepositories("etunicorn.*")
  29 +@ComponentScan(basePackages = {"etunicorn.*"})
  30 +@EntityScan("etunicorn.*")
  31 +
  32 +public class PersistenceJPAConfig {
  33 +
  34 + @Bean
  35 + public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
  36 + LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
  37 + em.setDataSource(dataSource());
  38 + em.setPackagesToScan("org.baeldung.persistence.model");
  39 +
  40 + JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
  41 + em.setJpaVendorAdapter(vendorAdapter);
  42 + em.setJpaProperties(additionalProperties());
  43 +
  44 + return em;
  45 + }
  46 +
  47 + @Bean
  48 + public DataSource dataSource() {
  49 + DriverManagerDataSource dataSource = new DriverManagerDataSource();
  50 + dataSource.setDriverClassName("com.mysql.jdbc.Driver");
  51 + dataSource.setUrl("jdbc:mysql://localhost:3306/etunicorn");
  52 + dataSource.setUsername("etunicorn");
  53 + dataSource.setPassword("etunicorn");
  54 + return dataSource;
  55 + }
  56 +
  57 + @Bean
  58 + public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
  59 + JpaTransactionManager transactionManager = new JpaTransactionManager();
  60 + transactionManager.setEntityManagerFactory(emf);
  61 +
  62 + return transactionManager;
  63 + }
  64 +
  65 + @Bean
  66 + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
  67 + return new PersistenceExceptionTranslationPostProcessor();
  68 + }
  69 +
  70 + Properties additionalProperties() {
  71 + Properties properties = new Properties();
  72 + properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
  73 + properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
  74 + return properties;
  75 + }
  76 +}
... ...
src/main/java/etunicorn/databaseConfiguration/SQLiteDialect.java deleted
... ... @@ -1,161 +0,0 @@
1   -package etunicorn.databaseConfiguration;
2   -
3   -/**
4   - * etunicorn-server
5   - * Copyright © 2017 Le Club Info Polytech Lille
6   - * Tous droits réservés
7   - */
8   -
9   -import org.hibernate.dialect.Dialect;
10   -import org.hibernate.dialect.function.SQLFunctionTemplate;
11   -import org.hibernate.dialect.function.StandardSQLFunction;
12   -import org.hibernate.dialect.function.VarArgsSQLFunction;
13   -import org.hibernate.type.StringType;
14   -
15   -import java.sql.Types;
16   -
17   -public class SQLiteDialect extends Dialect {
18   - public SQLiteDialect() {
19   - registerColumnType(Types.BIT, "integer");
20   - registerColumnType(Types.TINYINT, "tinyint");
21   - registerColumnType(Types.SMALLINT, "smallint");
22   - registerColumnType(Types.INTEGER, "integer");
23   - registerColumnType(Types.BIGINT, "bigint");
24   - registerColumnType(Types.FLOAT, "float");
25   - registerColumnType(Types.REAL, "real");
26   - registerColumnType(Types.DOUBLE, "double");
27   - registerColumnType(Types.NUMERIC, "numeric");
28   - registerColumnType(Types.DECIMAL, "decimal");
29   - registerColumnType(Types.CHAR, "char");
30   - registerColumnType(Types.VARCHAR, "varchar");
31   - registerColumnType(Types.LONGVARCHAR, "longvarchar");
32   - registerColumnType(Types.DATE, "date");
33   - registerColumnType(Types.TIME, "time");
34   - registerColumnType(Types.TIMESTAMP, "timestamp");
35   - registerColumnType(Types.BINARY, "blob");
36   - registerColumnType(Types.VARBINARY, "blob");
37   - registerColumnType(Types.LONGVARBINARY, "blob");
38   - // registerColumnType(Types.NULL, "null");
39   - registerColumnType(Types.BLOB, "blob");
40   - registerColumnType(Types.CLOB, "clob");
41   - registerColumnType(Types.BOOLEAN, "integer");
42   -
43   - registerFunction( "concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "") );
44   - registerFunction( "mod", new SQLFunctionTemplate( StringType.INSTANCE, "?1 % ?2" ) );
45   - registerFunction( "substr", new StandardSQLFunction("substr", StringType.INSTANCE) );
46   - registerFunction( "substring", new StandardSQLFunction( "substr", StringType.INSTANCE) );
47   - }
48   -
49   - public boolean supportsIdentityColumns() {
50   - return true;
51   - }
52   -
53   - /*
54   - public boolean supportsInsertSelectIdentity() {
55   - return true; // As specify in NHibernate dialect
56   - }
57   - */
58   -
59   - public boolean hasDataTypeInIdentityColumn() {
60   - return false; // As specify in NHibernate dialect
61   - }
62   -
63   - /*
64   - public String appendIdentitySelectToInsert(String insertString) {
65   - return new StringBuffer(insertString.length()+30). // As specify in NHibernate dialect
66   - append(insertString).
67   - append("; ").append(getIdentitySelectString()).
68   - toString();
69   - }
70   - */
71   -
72   - public String getIdentityColumnString() {
73   - // return "integer primary key autoincrement";
74   - return "integer";
75   - }
76   -
77   - public String getIdentitySelectString() {
78   - return "select last_insert_rowid()";
79   - }
80   -
81   - public boolean supportsLimit() {
82   - return true;
83   - }
84   -
85   - protected String getLimitString(String query, boolean hasOffset) {
86   - return new StringBuffer(query.length()+20).
87   - append(query).
88   - append(hasOffset ? " limit ? offset ?" : " limit ?").
89   - toString();
90   - }
91   -
92   - public boolean supportsTemporaryTables() {
93   - return true;
94   - }
95   -
96   - public String getCreateTemporaryTableString() {
97   - return "create temporary table if not exists";
98   - }
99   -
100   - public boolean dropTemporaryTableAfterUse() {
101   - return false;
102   - }
103   -
104   - public boolean supportsCurrentTimestampSelection() {
105   - return true;
106   - }
107   -
108   - public boolean isCurrentTimestampSelectStringCallable() {
109   - return false;
110   - }
111   -
112   - public String getCurrentTimestampSelectString() {
113   - return "select current_timestamp";
114   - }
115   -
116   - public boolean supportsUnionAll() {
117   - return true;
118   - }
119   -
120   - public boolean hasAlterTable() {
121   - return false; // As specify in NHibernate dialect
122   - }
123   -
124   - public boolean dropConstraints() {
125   - return false;
126   - }
127   -
128   - public String getAddColumnString() {
129   - return "add column";
130   - }
131   -
132   - public String getForUpdateString() {
133   - return "";
134   - }
135   -
136   - public boolean supportsOuterJoinForUpdate() {
137   - return false;
138   - }
139   -
140   - public String getDropForeignKeyString() {
141   - throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect");
142   - }
143   -
144   - public String getAddForeignKeyConstraintString(String constraintName,
145   - String[] foreignKey, String referencedTable, String[] primaryKey,
146   - boolean referencesPrimaryKey) {
147   - throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect");
148   - }
149   -
150   - public String getAddPrimaryKeyConstraintString(String constraintName) {
151   - throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect");
152   - }
153   -
154   - public boolean supportsIfExistsBeforeTableName() {
155   - return true;
156   - }
157   -
158   - public boolean supportsCascadeDelete() {
159   - return false;
160   - }
161   -}
162 0 \ No newline at end of file
src/main/java/etunicorn/entity/Permission.java renamed to src/main/java/etunicorn/domain/Permission.java
1   -package etunicorn.entity;
  1 +package etunicorn.domain;
2 2  
3 3 import javax.persistence.Entity;
4 4 import javax.persistence.Id;
... ...
src/main/java/etunicorn/entity/Personne.java renamed to src/main/java/etunicorn/domain/Personne.java
1   -package etunicorn.entity;
  1 +package etunicorn.domain;
2 2  
3 3 import javax.persistence.*;
4 4 import java.util.Date;
... ... @@ -14,12 +14,16 @@ public class Personne {
14 14  
15 15 @ManyToOne
16 16 public Role role;
  17 +
17 18 @Id
18 19 @GeneratedValue(strategy = GenerationType.AUTO)
19 20 private int id;
  21 +
20 22 @Column(unique = true)
21 23 private String carte;
  24 +
22 25 private Date naissance;
  26 +
23 27 @Column(unique = true)
24 28 private String login;
25 29  
... ...
src/main/java/etunicorn/entity/Role.java renamed to src/main/java/etunicorn/domain/Role.java
1   -package etunicorn.entity;
  1 +package etunicorn.domain;
2 2  
3   -import javax.persistence.Column;
4 3 import javax.persistence.Entity;
5 4 import javax.persistence.Id;
6 5 import javax.persistence.OneToMany;
... ... @@ -16,7 +15,6 @@ import java.util.List;
16 15 @Entity
17 16 public class Role {
18 17 @Id
19   - @Column(unique = true)
20 18 private String nom = "etudiant";
21 19  
22 20 @OneToMany
... ...
src/main/java/etunicorn/entity/Session.java renamed to src/main/java/etunicorn/domain/Session.java
1   -package etunicorn.entity;
  1 +package etunicorn.domain;
2 2  
3 3 import javax.persistence.Entity;
4 4 import javax.persistence.Id;
... ... @@ -19,10 +19,13 @@ public class Session {
19 19 private static final int SESSION_DURATION = 10 * 60;
20 20 private static SecureRandom random = new SecureRandom();
21 21 // TODO Vérifier si c'est bien initialisé qu'une seule fois par éxecution car c'est lourd à initialiser
  22 +
22 23 @ManyToOne
23 24 private Personne personne;
  25 +
24 26 @Id
25 27 private String token;
  28 +
26 29 private Date validity;
27 30  
28 31  
... ...
src/main/java/etunicorn/service/SessionService.java renamed to src/main/java/etunicorn/domain/service/impl/SessionService.java
1   -package etunicorn.service;
  1 +package etunicorn.domain.service.impl;
2 2  
3   -import etunicorn.entity.Personne;
4   -import etunicorn.entity.Session;
5   -import etunicorn.repository.PersonneRepository;
6   -import etunicorn.repository.SessionRepository;
  3 +import etunicorn.domain.Personne;
  4 +import etunicorn.domain.Session;
  5 +import etunicorn.spring.jpa.repository.PersonneRepository;
  6 +import etunicorn.spring.jpa.repository.SessionRepository;
7 7 import org.springframework.beans.factory.annotation.Autowired;
8 8 import org.springframework.stereotype.Service;
9 9  
... ...
src/main/java/etunicorn/controller/BaseController.java renamed to src/main/java/etunicorn/spring/controller/BaseController.java
1   -package etunicorn.controller;
  1 +package etunicorn.spring.controller;
2 2  
3   -import etunicorn.entity.Permission;
4   -import etunicorn.entity.Session;
5   -import etunicorn.repository.PermissionRepository;
6   -import etunicorn.service.SessionService;
  3 +import etunicorn.domain.Permission;
  4 +import etunicorn.domain.Session;
  5 +import etunicorn.domain.service.impl.SessionService;
  6 +import etunicorn.spring.jpa.repository.PermissionRepository;
7 7 import net.minidev.json.JSONObject;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9   -import org.springframework.data.repository.Repository;
10 9 import org.springframework.http.HttpStatus;
11 10 import org.springframework.http.ResponseEntity;
12   -import org.springframework.web.bind.annotation.RestController;
13 11  
14 12 import javax.servlet.http.HttpServletRequest;
15 13 import java.io.PrintWriter;
16 14 import java.io.StringWriter;
17 15 import java.util.Date;
18   -import java.util.Map;
19 16  
20 17 /**
21 18 * etunicorn-server
22 19 * Copyright © 2017 Le Club Info Polytech Lille
23 20 * Tous droits réservés
24 21 */
25   -@RestController
26 22 public class BaseController {
27 23  
28   - // Utilités pour merger un request dans une entity
29   - @Autowired
30   - Map<String, Repository> repositories;
31 24 // Permettent la vérification de permissions dans les méthodes de controlleur
32 25 @Autowired
33 26 private HttpServletRequest request;
  27 +
34 28 @Autowired
35 29 private SessionService sessionService;
  30 +
36 31 @Autowired
37 32 private PermissionRepository permissionRepository;
38 33  
... ...
src/main/java/etunicorn/controller/LoginController.java renamed to src/main/java/etunicorn/spring/controller/LoginController.java
1   -package etunicorn.controller;
  1 +package etunicorn.spring.controller;
2 2  
3 3 import etunicorn.RestrictedTo;
4   -import etunicorn.entity.Personne;
5   -import etunicorn.entity.Session;
  4 +import etunicorn.domain.Personne;
  5 +import etunicorn.domain.Session;
  6 +import etunicorn.domain.service.impl.SessionService;
6 7 import etunicorn.generated.model.UpdateLoginRequest;
7   -import etunicorn.repository.PersonneRepository;
8   -import etunicorn.service.SessionService;
  8 +import etunicorn.spring.jpa.repository.PersonneRepository;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.http.HttpStatus;
11 11 import org.springframework.http.ResponseEntity;
... ...
src/main/java/etunicorn/controller/PersonneController.java renamed to src/main/java/etunicorn/spring/controller/PersonneController.java
1   -package etunicorn.controller;
  1 +package etunicorn.spring.controller;
2 2  
3 3 import etunicorn.RestrictedTo;
4   -import etunicorn.entity.Personne;
5   -import etunicorn.entity.Role;
  4 +import etunicorn.domain.Personne;
  5 +import etunicorn.domain.Role;
6 6 import etunicorn.generated.model.UpdatePersonneByIdRequest;
7 7 import etunicorn.generated.model.UpdatePersonneRequest;
8   -import etunicorn.repository.PersonneRepository;
9   -import etunicorn.repository.RoleRepository;
  8 +import etunicorn.spring.jpa.repository.PersonneRepository;
  9 +import etunicorn.spring.jpa.repository.RoleRepository;
10 10 import org.springframework.beans.factory.annotation.Autowired;
11 11 import org.springframework.dao.DataIntegrityViolationException;
12 12 import org.springframework.http.HttpStatus;
... ...
src/main/java/etunicorn/controller/RoleController.java renamed to src/main/java/etunicorn/spring/controller/RoleController.java
1   -package etunicorn.controller;
  1 +package etunicorn.spring.controller;
2 2  
3 3  
4 4 import etunicorn.RestrictedTo;
5   -import etunicorn.entity.Permission;
6   -import etunicorn.entity.Role;
  5 +import etunicorn.domain.Permission;
  6 +import etunicorn.domain.Role;
7 7 import etunicorn.generated.model.UpdateRoleByIdRequest;
8 8 import etunicorn.generated.model.UpdateRoleRequest;
9   -import etunicorn.repository.PermissionRepository;
10   -import etunicorn.repository.RoleRepository;
  9 +import etunicorn.spring.jpa.repository.PermissionRepository;
  10 +import etunicorn.spring.jpa.repository.RoleRepository;
11 11 import org.springframework.beans.factory.annotation.Autowired;
12 12 import org.springframework.dao.DataIntegrityViolationException;
13 13 import org.springframework.http.HttpStatus;
... ...
src/main/java/etunicorn/repository/PermissionRepository.java renamed to src/main/java/etunicorn/spring/jpa/repository/PermissionRepository.java
1   -package etunicorn.repository;
  1 +package etunicorn.spring.jpa.repository;
2 2  
3   -import etunicorn.entity.Permission;
  3 +import etunicorn.domain.Permission;
4 4 import org.springframework.data.repository.CrudRepository;
5 5  
6 6 /**
... ...
src/main/java/etunicorn/repository/PersonneRepository.java renamed to src/main/java/etunicorn/spring/jpa/repository/PersonneRepository.java
1   -package etunicorn.repository;
  1 +package etunicorn.spring.jpa.repository;
2 2  
3   -import etunicorn.entity.Personne;
  3 +import etunicorn.domain.Personne;
4 4 import org.springframework.data.repository.CrudRepository;
5 5  
6 6 /**
... ...
src/main/java/etunicorn/repository/RoleRepository.java renamed to src/main/java/etunicorn/spring/jpa/repository/RoleRepository.java
1   -package etunicorn.repository;
  1 +package etunicorn.spring.jpa.repository;
2 2  
3   -import etunicorn.entity.Role;
  3 +import etunicorn.domain.Role;
4 4 import org.springframework.data.repository.CrudRepository;
5 5  
6 6 /**
... ...
src/main/java/etunicorn/repository/SessionRepository.java renamed to src/main/java/etunicorn/spring/jpa/repository/SessionRepository.java
1   -package etunicorn.repository;
  1 +package etunicorn.spring.jpa.repository;
2 2  
3   -import etunicorn.entity.Session;
  3 +import etunicorn.domain.Session;
4 4 import org.springframework.data.repository.CrudRepository;
5 5  
6 6 /**
... ...
src/main/ressources/application.yml deleted
... ... @@ -1,5 +0,0 @@
1   -spring:
2   - jpa:
3   - database-platform: etunicorn.databaseConfiguration.SQLiteDialect
4   - hibernate:
5   - ddl-auto: create-drop
6 0 \ No newline at end of file