Revision 50753
Added by Claudio Atzori about 6 years ago
JdbcTemplateFactory.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.database.utils; |
2 | 2 |
|
3 |
import javax.sql.DataSource; |
|
4 |
|
|
3 |
import eu.dnetlib.enabling.database.DataSourceFactory; |
|
5 | 4 |
import org.springframework.beans.factory.annotation.Required; |
6 | 5 |
import org.springframework.jdbc.core.JdbcTemplate; |
7 | 6 |
|
8 |
import eu.dnetlib.enabling.database.DataSourceFactory; |
|
9 |
|
|
10 | 7 |
public class JdbcTemplateFactory { |
11 | 8 |
|
12 | 9 |
private int fetchSize = 100; |
... | ... | |
18 | 15 |
return jdbcTemplate; |
19 | 16 |
} |
20 | 17 |
|
21 |
public JdbcTemplate createJdbcTemplate(DataSource dataSource) { |
|
22 |
final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); |
|
23 |
jdbcTemplate.setFetchSize(getFetchSize()); |
|
24 |
return jdbcTemplate; |
|
25 |
} |
|
26 |
|
|
27 | 18 |
@Required |
28 | 19 |
public void setDataSourceFactory(DataSourceFactory dataSourceFactory) { |
29 | 20 |
this.dataSourceFactory = dataSourceFactory; |
Also available in: Unified diff
experimenting with BasicDatasource(s) from commons-dbcp2