Removed duplication of common configuration option setting code.
This commit is contained in:
parent
203805bdae
commit
dc8587ba75
@ -35,19 +35,20 @@ public class HibernateDatabase implements IDatabase{
|
|||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
if (sessionFactory != null)
|
if (sessionFactory != null)
|
||||||
sessionFactory.close();
|
sessionFactory.close();
|
||||||
|
|
||||||
|
// Common properties
|
||||||
|
properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
|
||||||
|
properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbc.JDBCDriver");
|
||||||
|
properties.put("hibernate.enable_lazy_load_no_trans", "true");
|
||||||
|
|
||||||
if(testMode){
|
if(testMode){
|
||||||
properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
|
|
||||||
properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbc.JDBCDriver");
|
|
||||||
properties.put("hibernate.connection.url", "jdbc:hsqldb:mem:.");
|
properties.put("hibernate.connection.url", "jdbc:hsqldb:mem:.");
|
||||||
properties.put("hibernate.hbm2ddl.auto", "create-drop");
|
properties.put("hibernate.hbm2ddl.auto", "create-drop");
|
||||||
properties.put("hibernate.enable_lazy_load_no_trans", "true");
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
|
|
||||||
properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbc.JDBCDriver");
|
|
||||||
properties.put("hibernate.connection.url", ConfigManager.getDatabaseConnectionString());
|
properties.put("hibernate.connection.url", ConfigManager.getDatabaseConnectionString());
|
||||||
properties.put("hibernate.hbm2ddl.auto", "update");
|
properties.put("hibernate.hbm2ddl.auto", "update");
|
||||||
properties.put("hibernate.enable_lazy_load_no_trans", "true");
|
|
||||||
}
|
}
|
||||||
sessionFactory = new Configuration()
|
sessionFactory = new Configuration()
|
||||||
.addProperties(properties)
|
.addProperties(properties)
|
||||||
|
@ -24,6 +24,7 @@ import java.io.File;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ public class JTreeLibrary extends JPanel implements ILibrary, LibraryCallbackInt
|
|||||||
private final JXTextField librarySearchField = new JXTextField();
|
private final JXTextField librarySearchField = new JXTextField();
|
||||||
final JTree libraryTree = new JTree();
|
final JTree libraryTree = new JTree();
|
||||||
private final Map<String, Runnable> libraryDisplayVariants = createDisplayVariantMap();
|
private final Map<String, Runnable> libraryDisplayVariants = createDisplayVariantMap();
|
||||||
private final static Map<Long, ImageIcon> albumArt = new HashMap<>();
|
private final static Map<Long, ImageIcon> albumArt = new ConcurrentHashMap<>();
|
||||||
private Thread albumArtCollector;
|
private Thread albumArtCollector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user