Camnbios en PatrocinadorDaoJPA y ProyectoDaoJPA
This commit is contained in:
parent
12b301d8fb
commit
de0d013937
@ -48,15 +48,16 @@ public class PatrocinadorDaoJPA implements IPatrocinadorDAO {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actualizarEntidad(Patrocinador entidad) throws ProyectosIESException {
|
public void actualizarEntidad(Patrocinador entidad) throws ProyectosIESException {
|
||||||
Transaction transaccion = null;
|
EntityManager gestorEntidades = null;
|
||||||
Session sesion = null;
|
EntityTransaction transaccion = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sesion = GestorSesionesHibernate.getSession();
|
gestorEntidades = GestorEntityManagerJPA.getEntityManager();
|
||||||
transaccion = sesion.beginTransaction();
|
transaccion = gestorEntidades.getTransaction();
|
||||||
|
transaccion.begin();
|
||||||
|
|
||||||
if(sesion.contains(entidad))
|
if (gestorEntidades.contains(entidad))
|
||||||
sesion.merge(entidad);
|
gestorEntidades.merge(entidad);
|
||||||
|
|
||||||
transaccion.commit();
|
transaccion.commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -65,8 +66,8 @@ public class PatrocinadorDaoJPA implements IPatrocinadorDAO {
|
|||||||
}
|
}
|
||||||
throw new ProyectosIESException(e, this.getClass(), ProyectosIESException.ERROR_ACTUALIZACION);
|
throw new ProyectosIESException(e, this.getClass(), ProyectosIESException.ERROR_ACTUALIZACION);
|
||||||
} finally {
|
} finally {
|
||||||
if (sesion != null) {
|
if (gestorEntidades != null) {
|
||||||
sesion.close();
|
gestorEntidades.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,5 +107,4 @@ public class PatrocinadorDaoJPA implements IPatrocinadorDAO {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,15 +71,16 @@ public class ProyectoDaoJPA implements IProyectoDAO {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actualizarEntidad(Proyecto entidad) throws ProyectosIESException {
|
public void actualizarEntidad(Proyecto entidad) throws ProyectosIESException {
|
||||||
Transaction transaccion = null;
|
EntityManager gestorEntidades= null;
|
||||||
Session sesion = null;
|
EntityTransaction transaccion = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sesion = GestorSesionesHibernate.getSession();
|
gestorEntidades = GestorEntityManagerJPA.getEntityManager();
|
||||||
transaccion = sesion.beginTransaction();
|
transaccion = gestorEntidades.getTransaction();
|
||||||
|
transaccion .begin();
|
||||||
|
|
||||||
if (sesion.contains(entidad))
|
if (gestorEntidades.contains(entidad))
|
||||||
sesion.merge(entidad);
|
gestorEntidades.merge(entidad);
|
||||||
|
|
||||||
transaccion.commit();
|
transaccion.commit();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -88,8 +89,8 @@ public class ProyectoDaoJPA implements IProyectoDAO {
|
|||||||
}
|
}
|
||||||
throw new ProyectosIESException(e, this.getClass(), ProyectosIESException.ERROR_ACTUALIZACION);
|
throw new ProyectosIESException(e, this.getClass(), ProyectosIESException.ERROR_ACTUALIZACION);
|
||||||
} finally {
|
} finally {
|
||||||
if (sesion != null) {
|
if (gestorEntidades != null) {
|
||||||
sesion.close();
|
gestorEntidades.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user