Skip to content

Instantly share code, notes, and snippets.

@andrewconner
Created February 11, 2013 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewconner/4757307 to your computer and use it in GitHub Desktop.
Save andrewconner/4757307 to your computer and use it in GitHub Desktop.
trait DbConnection {
def readOnly(): Connection
def readWrite(): Connection
}
class PostgresDbConnection extends DbConnection {
def readOnly() = PostgresDbHandler.getReadOnlyConnection()
def readWrite() = PostgresDbHandler.getReadWriteConnection()
}
class InMemoryDbConnection extends DbConnection {
def readOnly() = H2DbHandler.getReadOnlyConnection()
def readWrite() = H2DbHandler.getReadWriteConnection()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment