-
Notifications
You must be signed in to change notification settings - Fork 1
JpoRm Configuration With Spring
Francesco edited this page Jul 12, 2015
·
1 revision
The most common configuration of JpoRm is the one with Spring. In this configuration all the Spring JDBC annotations (e.g. @Transaction) work transparently with Jpo.
import com.jporm.rm.JpoRm;
import com.jporm.rm.session.datasource.JPODataSourceBuilder;
import com.jporm.rm.spring.session.jdbctemplate.JPOrmJdbcTemplateBuilder;
// Your datasource and PlatformTransactionManager needed to build a Spring-aware instance of Jpo
public JpoRm newInstance(DataSource datasource, PlatformTransactionManager platformTransactionManager) {
//Use the JPOrmJdbcTemplateBuilder to create a new instance of JPO
return new JPOrmJdbcTemplateBuilder().build(datasource, platformTransactionManager);
}