Hibernate exception setting property value with CGLIB

Pessoal tenho uma classe chamada Empresa:

public class Empresa implements Serializable {
	private Long codigoEmpresa = null;
	private String razaoSocial = null;
	private String nomeFantasia = null;
	private Moeda moeda = null;
                // metodos get e set
}

Fiz o meu meu DynaAction da seguinte maneira:

        <form-bean name="empresaForm" type="org.apache.struts.action.DynaActionForm">
            <form-property name="codigoEmpresa" type="java.lang.Long"/>
            <form-property name="razaoSocial"   type="java.lang.String"/>
            <form-property name="nomeFantasia"  type="java.lang.String"/>
            <form-property name="moeda"         type="java.lang.String"/>			
       </form-bean>	   

Mais quando tento fazer um simples Select ele me da esse erro:

HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of br.com.farots.eco.bean.Empresa.setMoeda
	org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

br.com.farots.eco.uteis.DAOException: net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of br.com.farots.eco.bean.Empresa.setMoeda
	br.com.farots.eco.uteis.BaseDAO.listaTodos(BaseDAO.java:28)
	br.com.farots.eco.dao.EmpresaDAO.listaTodos(EmpresaDAO.java:26)
	br.com.farots.eco.action.EmpresaAction.lista(EmpresaAction.java:23)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:585)
	org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
	org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

o campo moeda deve ser um tipo primitivo… caso o campo na tabela esteja null, o hibernate não consegue carregar o objeto da base…

para isso o attribute moeda deve ser uma classe do tipo Integer, Long… nao um tipo primitivo…

foda ne? eheheh