package com.evecentral

import net.noerd.prequel.DatabaseConfig

import org.postgresql.Driver

object Database {

	private[this] var hasInited = false

	private[this] def dummyTx {
		dbconfig.transaction { tx =>
			tx.execute("SELECT 1 = 1")
		}
		hasInited = true
	}

	def coreDb : DatabaseConfig = {
		dbconfig.synchronized {
			if (!hasInited)
				dummyTx
			dbconfig
		}
	}

	private[this] val dbconfig = DatabaseConfig(
    driver = "org.postgresql.Driver",
    jdbcURL = "jdbc:postgresql://localhost/evec",
    username = "evec",
    password =  "evec"
  )

  def concatQuery(fieldName: String, items: Seq[Any]): String = {
    if (items.length == 0) "1=1"
    else
      items.map({
        fieldName + " = " + _.toString
      }).mkString(" OR ")
  }
}

package com.evecentral

import net.noerd.prequel.DatabaseConfig

import org.postgresql.Driver

object Database {


  lazy val coreDb = DatabaseConfig(
    driver = "org.postgresql.Driver",
    jdbcURL = "jdbc:postgresql://localhost/evec",
    username = "evec",
    password =  "evec"
  )

  def concatQuery(fieldName: String, items: Seq[Any]): String = {
    if (items.length == 0) "1=1"
    else
      items.map({
        fieldName + " = " + _.toString
      }).mkString(" OR ")
  }
}

--- 
+++ 
@@ -6,8 +6,24 @@
 
 object Database {
 
+	private[this] var hasInited = false
 
-  lazy val coreDb = DatabaseConfig(
+	private[this] def dummyTx {
+		dbconfig.transaction { tx =>
+			tx.execute("SELECT 1 = 1")
+		}
+		hasInited = true
+	}
+
+	def coreDb : DatabaseConfig = {
+		dbconfig.synchronized {
+			if (!hasInited)
+				dummyTx
+			dbconfig
+		}
+	}
+
+	private[this] val dbconfig = DatabaseConfig(
     driver = "org.postgresql.Driver",
     jdbcURL = "jdbc:postgresql://localhost/evec",
     username = "evec",
Make the database have a pre-init lock to a non-thread-safe pool map (:-/)
