All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.orm.jdbctemplate.JPOrmJdbcTemplate Maven / Gradle / Ivy

package com.jpattern.orm.jdbctemplate;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.PlatformTransactionManager;

import com.jpattern.orm.JPOrm;

/**
 * 
 * @author cinafr
 *
 */
public class JPOrmJdbcTemplate extends JPOrm{

	/**
	 * If the jporm instance has been created with this constructor the programmatic transaction management
	 * system will be disabled and the only way to manage transaction will be through the standard Spring
	 * TRANSACTIONAL annotation
	 * @param dataSource
	 */
	public JPOrmJdbcTemplate(DataSource dataSource) {
		this( new JdbcTemplate(dataSource), new NullPlatformTransactionManager() );
	}

	/**
	 * If the jporm instance has been created with this constructor the programmatic transaction management
	 * system will be disabled and the only way to manage transaction will be through the standard Spring
	 * TRANSACTIONAL annotation
	 * @param dataSource
	 */
	public JPOrmJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this( jdbcTemplate, new NullPlatformTransactionManager() );
	}

	/**
	 * A valid platformTransactionManager is needed to manage Transactions
	 * @param dataSource
	 * @param platformTransactionManager
	 */
	public JPOrmJdbcTemplate(DataSource dataSource, PlatformTransactionManager platformTransactionManager) {
		this( new JdbcTemplate(dataSource), platformTransactionManager );
	}

	/**
	 * A valid platformTransactionManager is needed to manage Transactions
	 * @param jdbcTemplate
	 * @param platformTransactionManager
	 */
	public JPOrmJdbcTemplate(JdbcTemplate jdbcTemplate, PlatformTransactionManager platformTransactionManager) {
		super(new JdbcTemplateSessionProvider(jdbcTemplate, platformTransactionManager));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy