From fa976e7de43b95e7e435c46092e06862defbe57f Mon Sep 17 00:00:00 2001 From: "lucas.taia" Date: Sat, 14 Jan 2023 15:43:20 -0300 Subject: [PATCH] melhoria enum --- .../ventaboletos/constantes/CustomEnumTypeHibernate.java | 6 +++++- .../rjconsultores/ventaboletos/entidad/TipoEventoExtra.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java b/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java index 76b503693..452e745f9 100644 --- a/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java +++ b/src/com/rjconsultores/ventaboletos/constantes/CustomEnumTypeHibernate.java @@ -61,7 +61,11 @@ public class CustomEnumTypeHibernate implements UserType, ParameterizedType { @Override public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { - + if (value == null) { + st.setNull(index, Types.VARCHAR); + } else { + st.setObject(index, value.toString(), Types.VARCHAR); + } } @Override diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java index f69b22f44..bb8e2f217 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java @@ -105,7 +105,7 @@ 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.class"), }) + @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.constantes.TipoEventoExtra"), }) @Column(name = "CVETIPOEVENTO") private com.rjconsultores.ventaboletos.constantes.TipoEventoExtra cvetipoevento;