Jean-Francois Leveque

Population de la base avec exemple des pays.

...@@ -100,14 +100,14 @@ ...@@ -100,14 +100,14 @@
100 <version>${assertj-core.version}</version> 100 <version>${assertj-core.version}</version>
101 <scope>test</scope> 101 <scope>test</scope>
102 </dependency> 102 </dependency>
103 - 103 +<!--
104 <dependency> 104 <dependency>
105 <groupId>org.apache.openjpa</groupId> 105 <groupId>org.apache.openjpa</groupId>
106 <artifactId>openjpa</artifactId> 106 <artifactId>openjpa</artifactId>
107 <version>${openjpa.version}</version> 107 <version>${openjpa.version}</version>
108 <scope>test</scope> 108 <scope>test</scope>
109 </dependency> 109 </dependency>
110 - 110 +-->
111 <!-- to test with TomEE and Arquillian 111 <!-- to test with TomEE and Arquillian
112 <dependency> 112 <dependency>
113 <groupId>org.apache.tomee</groupId> 113 <groupId>org.apache.tomee</groupId>
...@@ -149,6 +149,58 @@ ...@@ -149,6 +149,58 @@
149 <scope>test</scope> 149 <scope>test</scope>
150 </dependency> 150 </dependency>
151 --> 151 -->
152 + <!-- Hibernate -->
153 + <dependency>
154 + <groupId>antlr</groupId>
155 + <artifactId>antlr</artifactId>
156 + <version>2.7.7</version>
157 + </dependency>
158 + <dependency>
159 + <groupId>dom4j</groupId>
160 + <artifactId>dom4j</artifactId>
161 + <version>1.6.1</version>
162 + </dependency>
163 + <dependency>
164 + <groupId>org.hibernate.common</groupId>
165 + <artifactId>hibernate-commons-annotations</artifactId>
166 + <version>5.0.1.Final</version>
167 + </dependency>
168 + <dependency>
169 + <groupId>org.hibernate.javax.persistence</groupId>
170 + <artifactId>hibernate-jpa-2.1-api</artifactId>
171 + <version>1.0.0.Final</version>
172 + <scope>compile</scope>
173 + </dependency>
174 + <dependency>
175 + <groupId>org.hibernate</groupId>
176 + <artifactId>hibernate-core</artifactId>
177 + <version>5.2.3.Final</version>
178 + </dependency>
179 + <dependency>
180 + <groupId>org.hibernate</groupId>
181 + <artifactId>hibernate-ehcache</artifactId>
182 + <version>5.2.3.Final</version>
183 + </dependency>
184 + <dependency>
185 + <groupId>org.hibernate</groupId>
186 + <artifactId>hibernate-entitymanager</artifactId>
187 + <version>5.2.3.Final</version>
188 + </dependency>
189 + <dependency>
190 + <groupId>org.hibernate</groupId>
191 + <artifactId>hibernate-validator</artifactId>
192 + <version>5.2.3.Final</version>
193 + </dependency>
194 + <dependency>
195 + <groupId>org.jboss.logging</groupId>
196 + <artifactId>jboss-logging</artifactId>
197 + <version>3.3.0.Final</version>
198 + </dependency>
199 + <dependency>
200 + <groupId>org.javassist</groupId>
201 + <artifactId>javassist</artifactId>
202 + <version>3.20.0-GA</version>
203 + </dependency>
152 </dependencies> 204 </dependencies>
153 205
154 <build> 206 <build>
...@@ -179,6 +231,7 @@ ...@@ -179,6 +231,7 @@
179 <context>ROOT</context> 231 <context>ROOT</context>
180 </configuration> 232 </configuration>
181 </plugin> 233 </plugin>
234 + <!--
182 <plugin> 235 <plugin>
183 <groupId>org.apache.openjpa</groupId> 236 <groupId>org.apache.openjpa</groupId>
184 <artifactId>openjpa-maven-plugin</artifactId> 237 <artifactId>openjpa-maven-plugin</artifactId>
...@@ -202,11 +255,12 @@ ...@@ -202,11 +255,12 @@
202 <dependency> 255 <dependency>
203 <groupId>org.apache.openjpa</groupId> 256 <groupId>org.apache.openjpa</groupId>
204 <artifactId>openjpa</artifactId> 257 <artifactId>openjpa</artifactId>
205 - <!-- set the version to be the same as the level in your runtime --> 258 + <- set the version to be the same as the level in your runtime
206 <version>${openjpa.version}</version> 259 <version>${openjpa.version}</version>
207 </dependency> 260 </dependency>
208 </dependencies> 261 </dependencies>
209 </plugin> 262 </plugin>
263 + -->
210 </plugins> 264 </plugins>
211 </build> 265 </build>
212 266
......
...@@ -425,6 +425,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di ...@@ -425,6 +425,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
425 /** 425 /**
426 * The list of attributes / properties for this user. 426 * The list of attributes / properties for this user.
427 */ 427 */
428 + @OneToMany
428 private List<UserAttribute> userAttributes; 429 private List<UserAttribute> userAttributes;
429 430
430 /** 431 /**
......
...@@ -3,10 +3,13 @@ ...@@ -3,10 +3,13 @@
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 4 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
5 <persistence-unit name="book-pu" transaction-type="JTA"> 5 <persistence-unit name="book-pu" transaction-type="JTA">
6 + <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
6 <jta-data-source>bookDatabase</jta-data-source> 7 <jta-data-source>bookDatabase</jta-data-source>
7 <exclude-unlisted-classes>false</exclude-unlisted-classes> 8 <exclude-unlisted-classes>false</exclude-unlisted-classes>
8 <properties> 9 <properties>
9 - <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> 10 + <property name="hibernate.hbm2ddl.auto" value="create-drop" />
11 + <property name="hibernate.hbm2ddl.import_files" value="import.sql"/>
12 +<!-- <property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />-->
10 </properties> 13 </properties>
11 </persistence-unit> 14 </persistence-unit>
12 15
......
1 +INSERT INTO Country VALUES (1, 'France');
2 +INSERT INTO Country VALUES (2, 'Suisse');
3 +INSERT INTO Country VALUES (4, 'Belgique');
4 +INSERT INTO Country VALUES (5, 'Canada');
5 +INSERT INTO Country VALUES (6, 'États-Unis d''Amérique');
6 +INSERT INTO Country VALUES (7, 'Australie');
7 +INSERT INTO Country VALUES (8, 'Espagne');
8 +INSERT INTO Country VALUES (9, 'Portugal');
9 +INSERT INTO Country VALUES (10, 'Royaume-Uni');
10 +INSERT INTO Country VALUES (11, 'Allemagne');
11 +INSERT INTO Country VALUES (12, 'Pologne');
...\ No newline at end of file ...\ No newline at end of file