Portal intento arreglar batchUpdateException

This commit is contained in:
cruales 2023-02-13 12:44:59 -05:00
parent 435755380d
commit 7d50c36123
26 changed files with 101 additions and 95 deletions

View File

@ -1,5 +1,5 @@
#Generated by Maven
#Sun Feb 12 21:25:08 ECT 2023
#Mon Feb 13 12:18:59 ECT 2023
version=2.1
groupId=com.fp.armas
artifactId=portal-ear

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -48,9 +48,9 @@ public class GenericDaoImpl<T extends Serializable> implements GenericDao<T>{
public void create(T entity) throws DaoException {
// TODO Auto-generated method stub
try{
this.getEntityManager().clear();
//this.getEntityManager().clear();
this.getEntityManager().persist(entity);
this.getEntityManager().flush();
//this.getEntityManager().flush();
} catch(PersistenceException e){
throw transformDaoException(e);
} catch (Throwable e) {
@ -62,9 +62,9 @@ public class GenericDaoImpl<T extends Serializable> implements GenericDao<T>{
public void update(T entity) throws DaoException {
// TODO Auto-generated method stub
try {
this.getEntityManager().clear();
//this.getEntityManager().clear();
this.getEntityManager().merge(entity);
this.getEntityManager().flush();
//this.getEntityManager().flush();
} catch(PersistenceException e){
throw transformDaoException(e);
} catch (Throwable e) {
@ -76,9 +76,9 @@ public class GenericDaoImpl<T extends Serializable> implements GenericDao<T>{
public void delete(T entity) throws DaoException {
// TODO Auto-generated method stub
try{
this.getEntityManager().clear();
//this.getEntityManager().clear();
this.getEntityManager().remove(this.getEntityManager().contains(entity) ? entity : this.getEntityManager().merge(entity));
this.getEntityManager().flush();
//this.getEntityManager().flush();
} catch(PersistenceException e){
throw transformDaoException(e);
} catch (Throwable e) {

View File

@ -11,14 +11,13 @@ import java.util.Date;
* The persistent class for the TCUSTCOMPANY database table.
*
*/
@Entity(name = "Tcustcompany")
@Table(name = "TCUSTCOMPANY")
public class Tcustcompany implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private TcustcompanyPK id;
@Column(name = "BUSINESSCLASSCATALOG", nullable = true)
private String businessclasscatalog;
private String businessclasscatalogcode;

View File

@ -2,6 +2,7 @@ package com.fp.armas.portal.model;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import javax.persistence.*;
@ -15,7 +16,7 @@ public class TcustcompanyPK implements Serializable {
private static final long serialVersionUID = 1L;
@Column
private long personcode;
private Long personcode;
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date dateto;
@ -23,7 +24,7 @@ public class TcustcompanyPK implements Serializable {
public TcustcompanyPK() {
}
public TcustcompanyPK(long personcode, Date dateto) {
public TcustcompanyPK(Long personcode, Date dateto) {
super();
this.personcode = personcode;
this.dateto = dateto;
@ -31,10 +32,10 @@ public class TcustcompanyPK implements Serializable {
public long getPersoncode() {
public Long getPersoncode() {
return this.personcode;
}
public void setPersoncode(long personcode) {
public void setPersoncode(Long personcode) {
this.personcode = personcode;
}
public java.util.Date getDateto() {
@ -53,15 +54,15 @@ public class TcustcompanyPK implements Serializable {
}
TcustcompanyPK castOther = (TcustcompanyPK)other;
return
(this.personcode == castOther.personcode)
(Objects.equals(this.personcode, castOther.personcode))
&& this.dateto.equals(castOther.dateto);
}
public int hashCode() {
final int prime = 31;
int hash = 17;
hash = hash * prime + ((int) (this.personcode ^ (this.personcode >>> 32)));
hash = hash * prime + this.dateto.hashCode();
hash = hash * prime + ((int) (this.personcode ^ (this.personcode >>> 32)));
hash = hash * prime + this.dateto.hashCode();
return hash;
}

View File

@ -2,6 +2,7 @@ package com.fp.armas.portal.model;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import javax.persistence.*;
@ -15,7 +16,7 @@ public class TcustpersondetailPK implements Serializable {
private static final long serialVersionUID = 1L;
@Column
private long personcode;
private Long personcode;
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date dateto;
@ -23,7 +24,7 @@ public class TcustpersondetailPK implements Serializable {
public TcustpersondetailPK() {
}
public TcustpersondetailPK(long personcode, Date dateto) {
public TcustpersondetailPK(Long personcode, Date dateto) {
super();
this.personcode = personcode;
this.dateto = dateto;
@ -31,10 +32,10 @@ public class TcustpersondetailPK implements Serializable {
public long getPersoncode() {
public Long getPersoncode() {
return this.personcode;
}
public void setPersoncode(long personcode) {
public void setPersoncode(Long personcode) {
this.personcode = personcode;
}
public java.util.Date getDateto() {
@ -53,15 +54,16 @@ public class TcustpersondetailPK implements Serializable {
}
TcustpersondetailPK castOther = (TcustpersondetailPK)other;
return
(this.personcode == castOther.personcode)
(Objects.equals(this.personcode, castOther.personcode))
&& this.dateto.equals(castOther.dateto);
}
@Override
public int hashCode() {
final int prime = 31;
int hash = 17;
hash = hash * prime + ((int) (this.personcode ^ (this.personcode >>> 32)));
hash = hash * prime + this.dateto.hashCode();
hash = hash * prime + ((int) (this.personcode ^ (this.personcode >>> 32)));
hash = hash * prime + this.dateto.hashCode();
return hash;
}

View File

@ -2,7 +2,7 @@ package com.fp.armas.portal.model;
import java.io.Serializable;
import javax.persistence.*;
import java.util.Set;
import java.util.Set;
/**

View File

@ -324,7 +324,7 @@ public class RegistroBean {
Tcustpersonphone telefonoCelular, Tcustpeople adicionalPersona, Tcustcompany compania, Tgenefilesdetail foto) throws RegistroException {
try {
Tcustperson personaExistente = null;
if(persona.getId() != null && persona.getId().getPersoncode() != 0){
if(persona.getId() != null && persona.getId().getPersoncode() != 0 && persona.getId().getPersoncode() == null){
personaExistente = personaDao.buscarPorId(persona.getId().getPersoncode());
}
if(personaExistente == null){
@ -390,7 +390,8 @@ public class RegistroBean {
public Tcustcompany obtenerCompania(Integer personcode) throws RegistroException{
try {
TcustcompanyPK pk = new TcustcompanyPK();
pk.setPersoncode(personcode);
pk.setPersoncode(Long.valueOf(personcode.toString()));
pk.setDateto(FechaUtil.obtenerFecha(2999, 11, 31));
return companiaDao.buscarPorId(pk);
} catch (Throwable e) {
@ -737,7 +738,7 @@ public class RegistroBean {
if(!persona.getIdentificationcatalog().equals(PortalMessages.getInstancia().getString("catalogo.codigo.detalle.id.ruc"))){
return;
}
if(compania.getId() == null || compania.getId().getPersoncode() == 0){
if(compania.getId() == null || compania.getId().getPersoncode() == 0 || compania.getId().getPersoncode() == null){
compania.setId(new TcustcompanyPK());
compania.getId().setDateto(FechaUtil.obtenerFecha(2999, 11, 31));
compania.getId().setPersoncode(persona.getId().getPersoncode());
@ -745,7 +746,8 @@ public class RegistroBean {
compania.setLogo(guardaFoto(foto));
compania.setRecordversion(0L);
compania.setIngressuser(PortalMessages.getInstancia().getString("usuario.registro"));
companiaDao.create(compania);
companiaDao.create(compania);
} else{
Tcustcompany companiaAnterior = companiaDao.buscarPorId(new TcustcompanyPK(compania.getId().getPersoncode(), compania.getId().getDateto()));
if(companiaAnterior != null){

View File

@ -14,7 +14,7 @@
</attributes>
</entity>
<!--
<entity class="Tcustpersondetail" name="Tcustpersondetail" access="FIELD">
<table name="Tcustpersondetail"/>
<attributes>
@ -23,7 +23,7 @@
</basic>
</attributes>
</entity>-->
</entity>
<entity class="Tcustcompany" name="Tcustcompany" access="FIELD">
<table name="Tcustpersondetail"/>
<attributes>

View File

@ -1,42 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="portalPU">
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="portalPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for development and testing! -->
<!-- The datasource is deployed as <EAR>/META-INF/portal-ds.xml, you
can find it in the source at ear/src/main/application/META-INF/portal-ds.xml -->
<jta-data-source>java:jboss/datasources/FLIPDS1</jta-data-source>
<mapping-file>META-INF/ormPortal.xml</mapping-file>
<class>com.fp.armas.portal.model.Tgenecatalog</class>
<class>com.fp.armas.portal.model.Tgenecatalogdetail</class>
<class>com.fp.armas.portal.model.TgenecatalogdetailPK</class>
<class>com.fp.armas.portal.model.Tgeneactivity</class>
<class>com.fp.armas.portal.model.Tcustpeople</class>
<class>com.fp.armas.portal.model.TcustpeoplePK</class>
<class>com.fp.armas.portal.model.Tgenesequence</class>
<class>com.fp.armas.portal.model.Tcustcompany</class>
<class>com.fp.armas.portal.model.TcustcompanyPK</class>
<class>com.fp.armas.portal.model.Tgenefile</class>
<class>com.fp.armas.portal.model.Tgenefilesdetail</class>
<class>com.fp.armas.portal.model.TgenefilesdetailPK</class>
<class>com.fp.armas.portal.model.Tcustpersondetail</class>
<properties>
<mapping-file>META-INF/ormPortal.xml</mapping-file>
<class>com.fp.armas.portal.model.Tgenecatalog</class>
<class>com.fp.armas.portal.model.Tgenecatalogdetail</class>
<class>com.fp.armas.portal.model.TgenecatalogdetailPK</class>
<class>com.fp.armas.portal.model.Tgeneactivity</class>
<class>com.fp.armas.portal.model.Tcustpeople</class>
<class>com.fp.armas.portal.model.TcustpeoplePK</class>
<class>com.fp.armas.portal.model.Tgenesequence</class>
<class>com.fp.armas.portal.model.TcustcompanyPK</class>
<class>com.fp.armas.portal.model.Tgenefile</class>
<class>com.fp.armas.portal.model.Tgenefilesdetail</class>
<class>com.fp.armas.portal.model.TgenefilesdetailPK</class>
<class>com.fp.armas.portal.model.Tcustpersondetail</class>
<class>com.fp.armas.portal.model.Tcustcompany</class>
<properties>
<property name="hibernate.default_schema" value="comaco"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.connection.autocommit" value="false"/>
<property name="hibernate.jdbc.fetch_size" value="50"/>
<property name="hibernate.jdbc.batch_size" value="200"/>
<!-- Properties for Hibernate -->
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.id.new_generator_mappings" value="false" />
<!--property name="hibernate.ejb.cfgfile" value="hibernateFlipMapping.cfg.xml"/-->
<!-- Para hibernate 4 -->
<property name="hibernate.id.new_generator_mappings" value="false" />
<property name="hibernate.transaction.jta.platform" value = "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<!--hibernate 3.xx property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /-->
</properties>
</persistence-unit>
</persistence-unit>
</persistence>

View File

@ -14,7 +14,7 @@
</attributes>
</entity>
<!--
<entity class="Tcustpersondetail" name="Tcustpersondetail" access="FIELD">
<table name="Tcustpersondetail"/>
<attributes>
@ -23,7 +23,7 @@
</basic>
</attributes>
</entity>-->
</entity>
<entity class="Tcustcompany" name="Tcustcompany" access="FIELD">
<table name="Tcustpersondetail"/>
<attributes>

View File

@ -1,42 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="portalPU">
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="portalPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for development and testing! -->
<!-- The datasource is deployed as <EAR>/META-INF/portal-ds.xml, you
can find it in the source at ear/src/main/application/META-INF/portal-ds.xml -->
<jta-data-source>java:jboss/datasources/FLIPDS1</jta-data-source>
<mapping-file>META-INF/ormPortal.xml</mapping-file>
<class>com.fp.armas.portal.model.Tgenecatalog</class>
<class>com.fp.armas.portal.model.Tgenecatalogdetail</class>
<class>com.fp.armas.portal.model.TgenecatalogdetailPK</class>
<class>com.fp.armas.portal.model.Tgeneactivity</class>
<class>com.fp.armas.portal.model.Tcustpeople</class>
<class>com.fp.armas.portal.model.TcustpeoplePK</class>
<class>com.fp.armas.portal.model.Tgenesequence</class>
<class>com.fp.armas.portal.model.Tcustcompany</class>
<class>com.fp.armas.portal.model.TcustcompanyPK</class>
<class>com.fp.armas.portal.model.Tgenefile</class>
<class>com.fp.armas.portal.model.Tgenefilesdetail</class>
<class>com.fp.armas.portal.model.TgenefilesdetailPK</class>
<class>com.fp.armas.portal.model.Tcustpersondetail</class>
<properties>
<mapping-file>META-INF/ormPortal.xml</mapping-file>
<class>com.fp.armas.portal.model.Tgenecatalog</class>
<class>com.fp.armas.portal.model.Tgenecatalogdetail</class>
<class>com.fp.armas.portal.model.TgenecatalogdetailPK</class>
<class>com.fp.armas.portal.model.Tgeneactivity</class>
<class>com.fp.armas.portal.model.Tcustpeople</class>
<class>com.fp.armas.portal.model.TcustpeoplePK</class>
<class>com.fp.armas.portal.model.Tgenesequence</class>
<class>com.fp.armas.portal.model.TcustcompanyPK</class>
<class>com.fp.armas.portal.model.Tgenefile</class>
<class>com.fp.armas.portal.model.Tgenefilesdetail</class>
<class>com.fp.armas.portal.model.TgenefilesdetailPK</class>
<class>com.fp.armas.portal.model.Tcustpersondetail</class>
<class>com.fp.armas.portal.model.Tcustcompany</class>
<properties>
<property name="hibernate.default_schema" value="comaco"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.connection.autocommit" value="false"/>
<property name="hibernate.jdbc.fetch_size" value="50"/>
<property name="hibernate.jdbc.batch_size" value="200"/>
<!-- Properties for Hibernate -->
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.id.new_generator_mappings" value="false" />
<!--property name="hibernate.ejb.cfgfile" value="hibernateFlipMapping.cfg.xml"/-->
<!-- Para hibernate 4 -->
<property name="hibernate.id.new_generator_mappings" value="false" />
<property name="hibernate.transaction.jta.platform" value = "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<!--hibernate 3.xx property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /-->
</properties>
</persistence-unit>
</persistence-unit>
</persistence>

View File

@ -1,5 +1,5 @@
#Generated by Maven
#Sun Feb 12 21:25:06 ECT 2023
#Mon Feb 13 12:18:57 ECT 2023
version=2.1
groupId=com.fp.armas
artifactId=portal-ejb

Binary file not shown.

View File

@ -335,8 +335,8 @@ public class RegistroController extends BaseController implements Serializable {
* @param personaDetalle
*/
private void completaDatosCompania(Tcustpersondetail personaDetalle) {
if(personaDetalle.getId()!=null && personaDetalle.getId().getPersoncode()>0){
registroDataManager.setCompania(portalService.obtenerCompaniaPorId((int)personaDetalle.getId().getPersoncode()));
if(personaDetalle.getId()!=null && personaDetalle.getId().getPersoncode()>0 && personaDetalle.getId().getPersoncode()!= null){
registroDataManager.setCompania(portalService.obtenerCompaniaPorId(personaDetalle.getId().getPersoncode().intValue()));
if(registroDataManager.getCompania()!=null && registroDataManager.getCompania().getId()!=null && registroDataManager.getCompania().getId().getPersoncode()>0 && registroDataManager.getCompania().getLogo()!=null){
Tgenefilesdetail tgenefilesdetail= portalService.obtenerImagen(registroDataManager.getCompania().getLogo());
if(tgenefilesdetail!=null && tgenefilesdetail.getImage()!=null){
@ -354,8 +354,8 @@ public class RegistroController extends BaseController implements Serializable {
* @param personaDetalle
*/
private void completaDatosPersonaNatural(Tcustpersondetail personaDetalle){
if(personaDetalle.getId() != null && personaDetalle.getId().getPersoncode() != 0){
registroDataManager.setAdicionalPersona(portalService.obtenerPersonaNaturalPorId((int)personaDetalle.getId().getPersoncode()));
if(personaDetalle.getId() != null && personaDetalle.getId().getPersoncode() != 0 && personaDetalle.getId().getPersoncode() != null){
registroDataManager.setAdicionalPersona(portalService.obtenerPersonaNaturalPorId(personaDetalle.getId().getPersoncode().intValue()));
}
}
@ -392,21 +392,21 @@ public class RegistroController extends BaseController implements Serializable {
*/
private void completaDatosGenerales(Tcustpersondetail personaDetalle){
if(personaDetalle != null){
Tcustpersonaddress direccionPrincipal = portalService.obtenerDireccionPrincipal((int)personaDetalle.getId().getPersoncode());
Tcustpersonaddress direccionPrincipal = portalService.obtenerDireccionPrincipal((int)personaDetalle.getId().getPersoncode().intValue());
if(direccionPrincipal == null){
registroDataManager.setDireccionPersona(new Tcustpersonaddress());
registroDataManager.getDireccionPersona().setAddresstypecatalog(TIPO_DIRECCION);
} else{
registroDataManager.setDireccionPersona(direccionPrincipal);
}
Tcustpersonaddress mail = portalService.obtenerCorreo((int)personaDetalle.getId().getPersoncode());;
Tcustpersonaddress mail = portalService.obtenerCorreo((int)personaDetalle.getId().getPersoncode().intValue());
if(mail == null){
this.registroDataManager.getCorreoPersona().setAddresstypecatalogcode(TIPO_DIRECCION);
this.registroDataManager.getCorreoPersona().setAddresstypecatalog("3");
} else{
registroDataManager.setCorreoPersona(mail);
}
Tcustpersonphone telefonoFijo = portalService.obtenerTelefonoFijo((int)personaDetalle.getId().getPersoncode());
Tcustpersonphone telefonoFijo = portalService.obtenerTelefonoFijo(personaDetalle.getId().getPersoncode().intValue());
if(telefonoFijo == null){
this.registroDataManager.setTelefonoPersona(new Tcustpersonphone());
this.registroDataManager.getTelefonoPersona().setAddressnumber(1L);
@ -415,7 +415,7 @@ public class RegistroController extends BaseController implements Serializable {
} else{
registroDataManager.setTelefonoPersona(telefonoFijo);
}
Tcustpersonphone telefonoCelular = portalService.obtenerTelefonoCelular((int)personaDetalle.getId().getPersoncode());
Tcustpersonphone telefonoCelular = portalService.obtenerTelefonoCelular(personaDetalle.getId().getPersoncode().intValue());
if(telefonoCelular == null){
this.registroDataManager.setTelefonoCelular(new Tcustpersonphone());
this.registroDataManager.getTelefonoCelular().setAddressnumber(2L);

View File

@ -1,5 +1,5 @@
#Generated by Maven
#Sun Feb 12 21:25:07 ECT 2023
#Mon Feb 13 12:18:58 ECT 2023
version=2.1
groupId=com.fp.armas
artifactId=portal-web

Binary file not shown.