Commit 56e7ca33d628e444401c46bf5a7da1f40744c0f9

Authored by Thomas Ziemer
1 parent 1cb5cf7d

feature: Data Bootstrapping eingebaut

src/main/resources/META-INF/persistence.xml
... ... @@ -6,8 +6,8 @@
6 6 <jta-data-source>java:jboss/datasources/swXerciseDS</jta-data-source>
7 7 <properties>
8 8 <property name="wildfly.jpa.default-unit" value="true"/>
9   - <!-- property name="hibernate.hbm2ddl.auto" value="create-drop" / -->
10   - <property name="hibernate.hbm2ddl.auto" value="update" />
  9 + <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
  10 + <property name="hibernate.hbm2ddl.import_files" value="/bootstrap_data.sql"/>
11 11 </properties>
12 12 </persistence-unit>
13 13  
... ...
src/main/resources/bootstrap_data.sql 0 → 100644
  1 +INSERT INTO Profile (id, username, hashAlgorithm, passwordHash, salt) VALUES (2, "admin", "SHA512", "JeuPx1++vnOSp/rdDwjnPwNIldN49UhtJEwUcKr3ksTvu/3s6nmnWbh+mkjfsw41w1LE8VJJAukn+LpfnUybzg==", "wwUVuetAfN1dtaXk0zWOMmb1nIw=");
  2 +INSERT INTO User (id, firstname, lastname, profile_id) VALUES (1, "Chuck", "Norris", 2);
  3 +UPDATE hibernate_sequence SET next_val = 3;
0 4 \ No newline at end of file
... ...