leonardo 2015-04-07 21:09:00 +00:00
parent b45843d5c4
commit 3c0ba14bdd
4 changed files with 18 additions and 0 deletions

View File

@ -12,12 +12,16 @@ import com.rjconsultores.ventaboletos.entidad.Usuario;
import java.util.List; import java.util.List;
import org.hibernate.Session;
/** /**
* *
* @author Administrador * @author Administrador
*/ */
public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> { public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> {
public Session getDBSession();
public List<PuntoVenta> buscaLike(String strEstacion); public List<PuntoVenta> buscaLike(String strEstacion);
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta); public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta);

View File

@ -8,6 +8,7 @@ import java.util.List;
import org.hibernate.Criteria; import org.hibernate.Criteria;
import org.hibernate.FetchMode; import org.hibernate.FetchMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.MatchMode;
@ -42,6 +43,10 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
setSessionFactory(factory); setSessionFactory(factory);
} }
public Session getDBSession(){
return getSession();
}
@Override @Override
public List<PuntoVenta> obtenerTodos() { public List<PuntoVenta> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());

View File

@ -6,6 +6,8 @@ package com.rjconsultores.ventaboletos.service;
import java.util.List; import java.util.List;
import org.hibernate.Session;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
@ -18,6 +20,8 @@ import com.rjconsultores.ventaboletos.exception.IntegracionException;
*/ */
public interface PuntoVentaService { public interface PuntoVentaService {
public Session getDBSession();
public List<PuntoVenta> obtenerTodos(); public List<PuntoVenta> obtenerTodos();
public PuntoVenta obtenerID(Integer id); public PuntoVenta obtenerID(Integer id);

View File

@ -8,6 +8,7 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.hibernate.Session;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -72,6 +73,10 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
return puntoVentaDAO.obtenerID(id); return puntoVentaDAO.obtenerID(id);
} }
public Session getDBSession(){
return puntoVentaDAO.getDBSession();
}
@Transactional(noRollbackFor = { IntegracionException.class }) @Transactional(noRollbackFor = { IntegracionException.class })
public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException { public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());