com.j256.ormlite.spring
Class TableCreator
java.lang.Object
com.j256.ormlite.spring.TableCreator
public class TableCreator
- extends Object
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.db.TableCreator" init-method="initialize">
<property name="databaseType" ref="databaseType" />
<property name="dataSource" ref="dataSource" />
<property name="configuredDaos">
<list>
<ref bean="accountDao" />
<ref bean="orderDao" />
</list>
</property>
</bean>
- Author:
- graywatson
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AUTO_CREATE_TABLES
public static final String AUTO_CREATE_TABLES
- See Also:
- Constant Field Values
AUTO_DROP_TABLES
public static final String AUTO_DROP_TABLES
- See Also:
- Constant Field Values
TableCreator
public TableCreator()
initialize
public void initialize()
throws Exception
- If you are using the Spring type wiring, this should be called after all of the set methods.
- Throws:
Exception
destroy
public void destroy()
throws Exception
- Throws:
Exception
setDatabaseType
public void setDatabaseType(DatabaseType databaseType)
setDataSource
public void setDataSource(DataSource dataSource)
setConfiguredDaos
public void setConfiguredDaos(List<BaseJdbcDao<?,?>> configuredDaos)
Copyright © 2010. All Rights Reserved.