diff --git a/pom.xml b/pom.xml
index 200af275d..9b6936c1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
br.com.rjconsultores
ModelWeb
- 1.0.28
+ 1.0.29
rj-releases
diff --git a/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java b/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java
index 452e745f9..b202c5748 100644
--- a/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java
+++ b/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java
@@ -7,6 +7,7 @@ import java.sql.SQLException;
import java.sql.Types;
import java.util.Properties;
+import org.apache.commons.lang.StringUtils;
import org.hibernate.HibernateException;
import org.hibernate.usertype.ParameterizedType;
import org.hibernate.usertype.UserType;
@@ -60,11 +61,15 @@ public class CustomEnumTypeHibernate implements UserType, ParameterizedType {
}
@Override
+ @SuppressWarnings("rawtypes")
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
- if (value == null) {
- st.setNull(index, Types.VARCHAR);
+ int sqlType = Integer.valueOf(parameters.get("sqlType").toString()) ;
+ boolean enumName = Boolean.valueOf(parameters.get("enumName").toString()) ;
+ if (value == null || StringUtils.isEmpty(value.toString())) {
+ st.setNull(index, sqlType);
} else {
- st.setObject(index, value.toString(), Types.VARCHAR);
+ Enum enumerator = (Enum) value;
+ st.setObject(index, enumName ? enumerator.name() : enumerator.ordinal(), sqlType);
}
}
diff --git a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java
index 0b46d7de6..7ba76e99a 100644
--- a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java
+++ b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java
@@ -1,104 +1,40 @@
package com.rjconsultores.ventaboletos.constantes;
public enum TipoEventoExtra {
- NAO_ESPECIFICADO{
- public String toString() {
- return " ";
- }
- },
- OUTRO{
- public String toString() {
- return "OUTRO";
- }
- },
- SEGURO_OPCIONAL{
- public String toString() {
- return "SEGURO_OPCIONAL";
- }
- },
- EXCESSO_BAGAGEM{
- public String toString() {
- return "EXCESSO_BAGAGEM";
- }
- },
- TAXA_EMBARQUE{
- public String toString() {
- return "TAXA_EMBARQUE";
- }
- },
- SEGURO_RESSARCIMENTO{
- public String toString() {
- return "SEGURO_RESSARCIMENTO";
- }
- },
- TAXA_EMBARQUE_RESSARCIMENTO{
- public String toString() {
- return "TAXA_EMBARQUE_RESSARCIMENTO";
- }
- },
- MULTA{
- public String toString() {
- return "MULTA";
- }
- },
- DIF_MAIOR{
- public String toString() {
- return "DIF_MAIOR";
- }
- },
- DIF_MENOR{
- public String toString() {
- return "DIF_MENOR";
- }
- },
- SUPRIMENTO{
- public String toString() {
- return "SUPRIMENTO";
- }
- },
- SANGRIA{
- public String toString() {
- return "SANGRIA";
- }
- },
- RECARGA_CELULAR{
- public String toString() {
- return "RECARGA_CELULAR";
- }
- },
- RECARGA_TV{
- public String toString() {
- return "RECARGA_TV";
- }
- },
- RECARGA_PIN{
- public String toString() {
- return "RECARGA_PIN";
- }
- },
- PACOTE{
- public String toString() {
- return "PACOTE";
- }
- },
- SMART_CARD{
- public String toString() {
- return "SMART_CARD";
- }
- },
- TAXA_CONVENIENCIA_SVI{
- public String toString() {
- return "TAXA_CONVENIENCIA_SVI";
- }
- },
- TARIFA_SAFER{
- public String toString() {
- return "TARIFA_SAFER";
- }
- },
- JUROS_CARTAO_CREDITO{
- public String toString() {
- return "JUROS_CARTAO_CREDITO";
- }
- };
+
+ OUTRO("OUTRO"),
+ SEGURO_OPCIONAL("SEGURO_OPCIONAL"),
+ EXCESSO_BAGAGEM("EXCESSO_BAGAGEM"),
+ TAXA_EMBARQUE("TAXA_EMBARQUE"),
+ SEGURO_RESSARCIMENTO("SEGURO_RESSARCIMENTO"),
+ TAXA_EMBARQUE_RESSARCIMENTO("TAXA_EMBARQUE_RESSARCIMENTO"),
+ MULTA("MULTA"),
+ DIF_MAIOR("DIF_MAIOR"),
+ DIF_MENOR("DIF_MENOR"),
+ SUPRIMENTO("SUPRIMENTO"),
+ SANGRIA("SANGRIA"),
+ RECARGA_CELULAR("RECARGA_CELULAR"),
+ RECARGA_TV("RECARGA_TV"),
+ RECARGA_PIN("RECARGA_PIN"),
+ PACOTE("PACOTE"),
+ SMART_CARD("SMART_CARD"),
+ TAXA_CONVENIENCIA_SVI("TAXA_CONVENIENCIA_SVI"),
+ TARIFA_SAFER("TARIFA_SAFER"),
+ JUROS_CARTAO_CREDITO("JUROS_CARTAO_CREDITO"),
+ ;
+
+ private String descricao;
+
+ private TipoEventoExtra(String descricao) {
+ this.descricao = descricao;
+ }
+
+ public String getDescricao() {
+ return descricao;
+ }
+
+ @Override
+ public String toString() {
+ return getDescricao();
+ }
}
diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java
index 0adc92aa3..511c7d62b 100644
--- a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java
+++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java
@@ -25,8 +25,6 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
-import org.apache.commons.lang.BooleanUtils;
-
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
@@ -104,13 +102,17 @@ public class Categoria implements Serializable, Auditavel{
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip.class"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip"),
+ @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
+ @Parameter(name = "enumName", value = "true")})
@Column(name = "desconto_monitrip")
private com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip tipoDescontoMonitrip;
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoDescontoBPe.class"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoDescontoBPe"),
+ @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
+ @Parameter(name = "enumName", value = "true")})
@Column(name = "DESCONTOBPE")
private com.rjconsultores.ventaboletos.enums.TipoDescontoBPe tipoDescontoBPe;
diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java
index 5052cee33..d73d487d8 100644
--- a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java
+++ b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java
@@ -86,7 +86,9 @@ public class ClaseServicio implements Serializable, Auditavel {
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe.class"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe"),
+ @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
+ @Parameter(name = "enumName", value = "true")})
@Column(name = "desconto_monitrip")
private com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe tipoDescontoMonitrip;
diff --git a/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java
index 08d37c077..8dabf164e 100644
--- a/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java
+++ b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java
@@ -66,7 +66,9 @@ public class EstacionSitef implements Serializable {
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF.class"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF"),
+ @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
+ @Parameter(name = "enumName", value = "true")})
@Column(name = "TIPO_INTEGRACAO")
private com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF tipoIntegracao;
diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java
index d190c1114..317f1a3ef 100644
--- a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java
+++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java
@@ -80,7 +80,9 @@ public class FormaPago implements Serializable, Auditavel {
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoFormapago.class"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoFormapago"),
+ @Parameter(name = "sqlType", value = "4")/*Types.INTEGER*/,
+ @Parameter(name = "enumName", value = "false")})
@Column(name = "TIPO_PAGO")
private com.rjconsultores.ventaboletos.enums.TipoFormapago tipoFormapago;
@Column(name = "CVESISTEMA")
@@ -98,7 +100,9 @@ public class FormaPago implements Serializable, Auditavel {
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital.class"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital"),
+ @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
+ @Parameter(name = "enumName", value = "true")})
@Column(name = "TIPO_CARTEIRA_DIGITAL")
private com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital tipoCarteiraDigital;
diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java
index bb8e2f217..1fadc85a6 100644
--- a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java
+++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java
@@ -105,7 +105,9 @@ public class TipoEventoExtra implements Serializable {
@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
- @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.constantes.TipoEventoExtra"), })
+ @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.constantes.TipoEventoExtra"),
+ @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/,
+ @Parameter(name = "enumName", value = "true")})
@Column(name = "CVETIPOEVENTO")
private com.rjconsultores.ventaboletos.constantes.TipoEventoExtra cvetipoevento;