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

org.skife.jdbi.v2.spring.package.html Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version




Classes here provide integration hooks for working with the Spring framework. DBI instances (IDBI interface instances, actually) may be obtained which will behave correctly with Spring managed transactions.

Using the Spring facilities entails configuring jDBI via the DBIFactoryBean class, and providing a DataSource with an associated transaction manager to that bean, such as:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="derby"/>
    </bean>

    <bean id="derby" class="org.apache.derby.jdbc.EmbeddedDataSource" destroy-method="close">
        <property name="databaseName" value="testing"/>
    </bean>

    <bean id="dbi" class="org.skife.jdbi.v2.spring.DBIFactoryBean">
        <property name="dataSource" ref="derby"/>
    </bean>

    <bean id="service" class="org.skife.jdbi.v2.spring.DummyService">
        <constructor-arg ref="dbi"/>
    </bean>
</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy