public class TableCreator extends Object
NOTE: If you are using the Spring type wiring in Java, initialize()
should be called after all of the
set methods. In Spring XML, init-method="initialize" should be used.
Here is an example of spring wiring.
<!-- our database type factory-bean --> <bean id="tableCreator" class="com.j256.ormlite.spring.TableCreator" init-method="initialize"> <property name="connectionSource" ref="connectionSource" /> <property name="configuredDaos"> <list> <ref bean="accountDao" /> <ref bean="orderDao" /> </list> </property> </bean>
Modifier and Type | Field and Description |
---|---|
static String |
AUTO_CREATE_TABLES |
static String |
AUTO_DROP_TABLES |
Constructor and Description |
---|
TableCreator() |
TableCreator(com.j256.ormlite.support.ConnectionSource connectionSource,
List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
initialize()
If you are using the Spring type wiring, this should be called after all of the set methods.
|
void |
maybeCreateTables()
Possibly create the tables is the
AUTO_CREATE_TABLES system property is set to "true". |
void |
maybeDropTables()
Possibly drop the tables that were previously created if the
AUTO_DROP_TABLES system property is set to
"true". |
void |
setConfiguredDaos(List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos) |
void |
setConnectionSource(com.j256.ormlite.support.ConnectionSource dataSource) |
public static final String AUTO_CREATE_TABLES
public static final String AUTO_DROP_TABLES
public TableCreator()
public TableCreator(com.j256.ormlite.support.ConnectionSource connectionSource, List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos)
public void maybeCreateTables() throws SQLException
AUTO_CREATE_TABLES
system property is set to "true".SQLException
public void initialize() throws SQLException
SQLException
public void maybeDropTables()
AUTO_DROP_TABLES
system property is set to
"true".public void destroy()
public void setConnectionSource(com.j256.ormlite.support.ConnectionSource dataSource)
public void setConfiguredDaos(List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos)
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.