public void createTable(Connection conn) throws PersistenceException {
if (cacheName == null || cacheName.trim().length() == 0)
throw new PersistenceException("cacheName needed in order to create table");
String ddl;
if (metaData.isSegmentedDisabled()) {
ddl = String.format("CREATE TABLE %1$s (%2$s %3$s NOT NULL, %4$s %5$s NOT NULL, %6$s %7$s NOT NULL, PRIMARY KEY (%2$s))",
getTableName(), config.idColumnName(), config.idColumnType(), config.dataColumnName(),
config.dataColumnType(), config.timestampColumnName(), config.timestampColumnType());
} else {
ddl = String.format("CREATE TABLE %1$s (%2$s %3$s NOT NULL, %4$s %5$s NOT NULL, %6$s %7$s NOT NULL, %8$s %9$s NOT NULL, PRIMARY KEY (%2$s))",
getTableName(), config.idColumnName(), config.idColumnType(), config.dataColumnName(),
config.dataColumnType(), config.timestampColumnName(), config.timestampColumnType(),
config.segmentColumnName(), config.segmentColumnType());
}
if (log.isTraceEnabled()) {
log.tracef("Creating table with following DDL: '%s'.", ddl);
}
executeUpdateSql(conn, ddl);
}