Connexion BDD v1
This commit is contained in:
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
@Repository
|
||||
@Primary
|
||||
public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ArticleRepositoryImpl.class);
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
private NamedParameterJdbcTemplate namedJdbcTemplate;
|
||||
@@ -37,17 +38,16 @@ public class ArticleRepositoryImpl implements ArticleRepository {
|
||||
return article;
|
||||
}
|
||||
}
|
||||
|
||||
public ArticleRepositoryImpl(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.namedJdbcTemplate = namedJdbcTemplate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Article> findAllArticle() {
|
||||
String sql = "SELECT * FROM ARTICLES_VENDUS";
|
||||
List<Article> articles = jdbcTemplate.query(sql, new ArticleRowMapper());
|
||||
|
||||
return articles;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package fr.eni.enchere.dal;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
@@ -12,10 +13,12 @@ import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@Primary
|
||||
public class UserRepositoryImpl implements UserRepository {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public UserRepositoryImpl(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
|
||||
Reference in New Issue
Block a user