Skip to content

Instantly share code, notes, and snippets.

@galderz
Created May 25, 2012 09:11
Show Gist options
  • Save galderz/2786865 to your computer and use it in GitHub Desktop.
Save galderz/2786865 to your computer and use it in GitHub Desktop.
GlobalConfiguration glob = new GlobalConfigurationBuilder()
.nonClusteredDefault().build();
Configuration loc = new ConfigurationBuilder()
.clustering().cacheMode(CacheMode.LOCAL)
.transaction().transactionMode(TransactionMode.TRANSACTIONAL)
.autoCommit(false)
.transactionManagerLookup(new GenericTransactionManagerLookup())
.loaders().passivation(false).preload(false).shared(false)
.addCacheLoader().cacheLoader(new JdbcStringBasedCacheStore())
.fetchPersistentState(false).purgeOnStartup(true)
.addProperty("stringsTableNamePrefix", "carmart_table")
.addProperty("idColumnName", "ID_COLUMN")
.addProperty("dataColumnName", "DATA_COLUMN")
.addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
.addProperty("timestampColumnType", "BIGINT")
.addProperty("connectionFactoryClass",
"org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
.addProperty("connectionUrl", "jdbc:mysql://localhost:3306/carmartdb")
.addProperty("userName", "carmart") //we do not have a managed datasource
-> specify credentials here
.addProperty("password", "carmart")
.addProperty("driverClass", "com.mysql.jdbc.Driver")
.addProperty("idColumnType", "VARCHAR(255)")
.addProperty("dataColumnType", "VARBINARY(1000)")
.addProperty("dropTableOnExit", "false")
.addProperty("createTableOnStart", "true")
.addProperty("databaseType", "MYSQL")
//.addProperty("datasourceJndiLocation", "java:jboss/datasources/ExampleDS")
//oh, yes, we do not use JNDI now
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment