Skip to content
Snippets Groups Projects
Commit 6245aa1a authored by Yvan Peter's avatar Yvan Peter
Browse files

correction SQLite/JDBI foreign key

parent 1563b291
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties;
import org.jdbi.v3.core.Handle;
import org.jdbi.v3.core.Jdbi;
......@@ -22,7 +23,10 @@ public class BDDFactory {
public static Jdbi getJdbi() {
if ( jdbi == null ) {
jdbi = Jdbi.create(dbPath + "pizzas.db")
Properties properties = new Properties();
properties.setProperty("foreign_keys", "true");
jdbi = Jdbi.create(dbPath + "pizzas.db", properties)
.installPlugin(new SQLitePlugin())
.installPlugin(new SqlObjectPlugin()).registerArgument(new UUIDArgumentFactory());
}
......@@ -31,7 +35,10 @@ public class BDDFactory {
public static void setJdbiForTests() {
if ( jdbi == null ) {
jdbi = Jdbi.create(dbPath + "pizza_test.db")
Properties properties = new Properties();
properties.setProperty("foreign_keys", "true");
jdbi = Jdbi.create(dbPath + "pizza_test.db", properties)
.installPlugin(new SQLitePlugin())
.installPlugin(new SqlObjectPlugin());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment