Ver Mensaje Individual
  #21 (permalink)  
Antiguo 12/11/2013, 07:29
Avatar de lozanoguido
lozanoguido
 
Fecha de Ingreso: junio-2011
Mensajes: 33
Antigüedad: 13 años, 6 meses
Puntos: 0
Sonrisa Respuesta: Hibernate - Consulta sobre

root cause

java.lang.IllegalArgumentException: object is not an instance of declaring class
sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.hibernate.property.BasicPropertyAccessor$Basic Getter.get(BasicPropertyAccessor.java:164)
org.hibernate.tuple.entity.AbstractEntityTuplizer. getIdentifier(AbstractEntityTuplizer.java:341)
org.hibernate.persister.entity.AbstractEntityPersi ster.getIdentifier(AbstractEntityPersister.java:43 23)
org.hibernate.persister.entity.AbstractEntityPersi ster.isTransient(AbstractEntityPersister.java:4045 )
org.hibernate.engine.internal.ForeignKeys.isTransi ent(ForeignKeys.java:209)
org.hibernate.engine.internal.ForeignKeys$Nullifie r.isNullifiable(ForeignKeys.java:165)
org.hibernate.engine.internal.ForeignKeys$Nullifie r.access$000(ForeignKeys.java:50)
org.hibernate.engine.internal.ForeignKeys.collectN onNullableTransientEntities(ForeignKeys.java:318)
org.hibernate.engine.internal.ForeignKeys.findNonN ullableTransientEntities(ForeignKeys.java:290)
org.hibernate.action.internal.AbstractEntityInsert Action.findNonNullableTransientEntities(AbstractEn tityInsertAction.java:105)
org.hibernate.engine.spi.ActionQueue.addInsertActi on(ActionQueue.java:180)
org.hibernate.engine.spi.ActionQueue.addAction(Act ionQueue.java:167)
org.hibernate.event.internal.AbstractSaveEventList ener.addInsertAction(AbstractSaveEventListener.jav a:320)
org.hibernate.event.internal.AbstractSaveEventList ener.performSaveOrReplicate(AbstractSaveEventListe ner.java:287)
org.hibernate.event.internal.AbstractSaveEventList ener.performSave(AbstractSaveEventListener.java:19 3)
org.hibernate.event.internal.AbstractSaveEventList ener.saveWithGeneratedId(AbstractSaveEventListener .java:126)
org.hibernate.event.internal.DefaultSaveOrUpdateEv entListener.saveWithGeneratedOrRequestedId(Default SaveOrUpdateEventListener.java:204)
org.hibernate.event.internal.DefaultSaveEventListe ner.saveWithGeneratedOrRequestedId(DefaultSaveEven tListener.java:55)
org.hibernate.event.internal.DefaultSaveOrUpdateEv entListener.entityIsTransient(DefaultSaveOrUpdateE ventListener.java:189)
org.hibernate.event.internal.DefaultSaveEventListe ner.performSaveOrUpdate(DefaultSaveEventListener.j ava:49)
org.hibernate.event.internal.DefaultSaveOrUpdateEv entListener.onSaveOrUpdate(DefaultSaveOrUpdateEven tListener.java:90)
org.hibernate.internal.SessionImpl.fireSave(Sessio nImpl.java:757)
org.hibernate.internal.SessionImpl.save(SessionImp l.java:749)
org.hibernate.internal.SessionImpl.save(SessionImp l.java:745)
local.dao.ProductoFormDao.save(ProductoFormDao.jav a:32)
local.dao.ProductoFormDao$$FastClassByCGLIB$$52749 2f.invoke(<generated>)
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy. java:191)
org.springframework.aop.framework.Cglib2AopProxy$C glibMethodInvocation.invokeJoinpoint(Cglib2AopProx y.java:689)
org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :150)
org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:110)
org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:622)
local.dao.ProductoFormDao$$EnhancerByCGLIB$$99dc6e 9c_2.save(<generated>)
local.controller.PedidoController.finishP(PedidoCo ntroller.java:262)
sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.method.support.InvocableHa ndlerMethod.invoke(InvocableHandlerMethod.java:213 )
org.springframework.web.method.support.InvocableHa ndlerMethod.invokeForRequest(InvocableHandlerMetho d.java:126)
org.springframework.web.servlet.mvc.method.annotat ion.ServletInvocableHandlerMethod.invokeAndHandle( ServletInvocableHandlerMethod.java:96)
org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.invokeHandlerMeth od(RequestMappingHandlerAdapter.java:617)
org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.handleInternal(Re questMappingHandlerAdapter.java:578)
org.springframework.web.servlet.mvc.method.Abstrac tHandlerMethodAdapter.handle(AbstractHandlerMethod Adapter.java:80)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
javax.servlet.http.HttpServlet.service(HttpServlet .java:723)


Y ya he cambiado el tipo de dato:

public class Pedido {
private Integer codigo;
private Cliente cliente;
private String estado;
private Set <ProductoForm> listadodeproductos;

public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public Integer getCodigo() {
return codigo;
}


Base de datos:

- codigo bigint(20)
- codigo_cliente bigint(20)
- estado varchar(20)

mapeo:

<class name="local.model.Pedido" table="pedidos">
<id column="codigo" name="codigo">
<generator class="native"/>
</id>
<many-to-one name="cliente" column="codigo_cliente" class="local.model.Cliente" not-null="true"/>
<property column="estado" name="estado" />
<set name="listadodeproductos" table="detalle_pedidos" inverse="true" fetch="select">
<key>
<column name="codigo_pedido" not-null="true" />
</key>
<one-to-many class="local.model.ProductoForm" />
</set>
</class>