Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.j256.ormlite.spring;
 
 
Spring bean that can be used to create Dao's of certain classes without needing their own Dao class.

Here is an example of spring wiring. See the Spring example in the documentation for more info.

  <bean id="accountDao" class="com.j256.ormlite.spring.DaoFactory" factory-method="createDao">
   <constructor-arg index="0" ref="connectionSource" />
   <constructor-arg index="1" value="com.j256.ormlite.examples.spring.Account" />
  </bean>
 

Author(s):
graywatson
public class DaoFactory {

Create and return a Dao based on the arguments.
	public static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSourceClass<T> clazzthrows SQLException {
		return DaoManager.createDao(connectionSourceclazz);
	}

Create and return a Dao based on the arguments.
	public static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSourceDatabaseTableConfig<T> tableConfig)
			throws SQLException {
		return DaoManager.createDao(connectionSourcetableConfig);
	}
New to GrepCode? Check out our FAQ X