Problema com Hibernate e Enum

1 resposta
A

Pessoal,
estou realizando uma migração do hibernate 2 para o 3.

Tenho uma classe do tipo SimNaoEnum e outra SimNaoEnumType.
Segue o codigo da SimNaoEnumType

public class SimNaoEnumType implements  UserType, Serializable {

		public Class returnedClass() {
			return SimNaoEnum.class;
		}

		public int[] sqlTypes() {
			return new int[] { Types.VARCHAR };
		}

		public boolean equals(Object arg0, Object arg1) throws HibernateException {
			Enum enum0 = (Enum) arg0;
			Enum enum1 = (Enum) arg1;
			if (enum0 == null || enum1 == null) {
				return false;
			}
			return enum0.getName().equals(enum1.getName());
		}

		public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {

			String enumName = rs.getString(names[0]);
			String value = null;
			if (enumName != null) {
				value = enumName.trim();
			}
			return EnumUtils.getEnum(returnedClass(), value);
		}

		public void nullSafeSet(PreparedStatement pstmt, Object value, int index) throws HibernateException, SQLException {

			String setValue = null;
			if (value != null) {
				setValue = ((Enum) value).getName();
				pstmt.setString(index, setValue);
			} else {
				pstmt.setNull(index, Types.CHAR);
			}
		}

		public Object deepCopy(Object obj) throws HibernateException {
			if (obj == null)
				return null;
			return EnumUtils.getEnum(obj.getClass(), ((Enum) obj).getName());
		}

		public boolean isMutable() {
			return false;
		}

		
		
				
		public Object assemble(Serializable cached, Object arg1)
			throws HibernateException {
		// TODO Auto-generated method stub
			return cached;
		}
			
		public Serializable disassemble(Object value) throws HibernateException {
			// TODO Auto-generated method stub
			 return (Serializable)value; 
		}
		
		public int hashCode(Object arg0) throws HibernateException {
			// TODO Auto-generated method stub
			return arg0.hashCode();
		}
		
		public Object replace(Object original, Object arg1, Object arg2)
			throws HibernateException {
			// TODO Auto-generated method stub
			return original;
		}

	}

Quando tenho fazer o deploy da aplicação no Jboss tenho o seguinte erro:

Alguém tem ideia do que está acontecendo?

1 Resposta

A

tirei a lib jboss-hibernate.jar deu certo.

Criado 5 de janeiro de 2011
Ultima resposta 7 de jan. de 2011
Respostas 1
Participantes 1