fixes bug #8989
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@68550 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
b0314dacce
commit
673100c432
|
@ -42,6 +42,7 @@ import com.rjconsultores.ventaboletos.entidad.LogConferencia;
|
|||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
|
||||
|
@ -63,6 +64,9 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
@Autowired
|
||||
private DataSource dataSourceRead;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Autowired
|
||||
public ConferenciaComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
|
@ -73,7 +77,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException {
|
||||
Connection con = null;
|
||||
try {
|
||||
con = dataSourceRead.getConnection();
|
||||
con = getConnection();
|
||||
|
||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
||||
|
||||
|
@ -1057,4 +1061,18 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera a conexão conforme parametrização em application.properties
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Connection getConnection() throws SQLException {
|
||||
if(ApplicationProperties.getInstance().isDataSourceComissaoBancoProducao()) {
|
||||
return dataSource.getConnection();
|
||||
} else {
|
||||
return dataSourceRead.getConnection();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -215,4 +215,9 @@ public class ApplicationProperties {
|
|||
return property.equals("1");
|
||||
}
|
||||
|
||||
public boolean isDataSourceComissaoBancoProducao() {
|
||||
String property = p.getProperty("datasource.conferencia.comissao", "0");
|
||||
return property.equals("0");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue