com.j256.ormlite.spring
Class TableCreator

java.lang.Object
  extended by 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

Field Summary
static String AUTO_CREATE_TABLES
           
static String AUTO_DROP_TABLES
           
 
Constructor Summary
TableCreator()
           
 
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 setConfiguredDaos(List<BaseJdbcDao<?,?>> configuredDaos)
           
 void setDatabaseType(DatabaseType databaseType)
           
 void setDataSource(DataSource dataSource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

TableCreator

public TableCreator()
Method Detail

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.