|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j256.ormlite.spring.TableCreator
public class TableCreator
Spring bean that auto-creates any tables that it finds DAOs for if the property name in TableCreator.AUTO_CREATE_TABLES property has been set to true. It will also auto-drop any tables that were auto-created if the property name in TableCreator.AUTO_DROP_TABLES property has been set to true.
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>
Field Summary | |
---|---|
static String |
AUTO_CREATE_TABLES
|
static String |
AUTO_DROP_TABLES
|
Constructor Summary | |
---|---|
TableCreator()
|
|
TableCreator(com.j256.ormlite.support.ConnectionSource connectionSource,
List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos)
|
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String AUTO_CREATE_TABLES
public static final String AUTO_DROP_TABLES
Constructor Detail |
---|
public TableCreator()
public TableCreator(com.j256.ormlite.support.ConnectionSource connectionSource, List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos)
Method Detail |
---|
public void maybeCreateTables() throws SQLException
AUTO_CREATE_TABLES
system property is set to "true".
SQLException
public void initialize() throws SQLException
SQLException
public void maybeDropTables() throws SQLException
AUTO_DROP_TABLES
system property is set to
"true".
SQLException
public void destroy() throws SQLException
SQLException
public void setConnectionSource(com.j256.ormlite.support.ConnectionSource dataSource)
public void setConfiguredDaos(List<com.j256.ormlite.dao.Dao<?,?>> configuredDaos)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |