Hi i’ve Created a Entity Listener:
package com.company.imgestion.listener;
import org.ocpsoft.prettytime.shade.net.fortuna.ical4j.model.Date;
import org.springframework.stereotype.Component;
import com.haulmont.cuba.core.listener.BeforeUpdateEntityListener;
import com.company.imgestion.entity.Articulos;
@Component("imgestion_BajaArticulos")
public class BajaArticulos implements BeforeUpdateEntityListener<Articulos> {
@Override
public void onBeforeUpdate(Articulos entity) {
if (entity.getBaja()){
entity.setFechabaja(new Date());
}
}
}
but when i set Baja to True i get the following error:
ConversionException:
Exception Description: The object [5/08/16 2:00], of class [class org.ocpsoft.prettytime.shade.net.fortuna.ical4j.model.Date], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[fechabaja-->IMGESTION_ARTICULOS.FECHABAJA]] with descriptor [RelationalDescriptor(com.company.imgestion.entity.Articulos --> [DatabaseTable(IMGESTION_ARTICULOS)])], could not be converted to [class java.sql.Date].
com.haulmont.cuba.core.global.RemoteException:
---
java.lang.RuntimeException: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.6.2.cuba6): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [5/08/16 2:00], of class [class org.ocpsoft.prettytime.shade.net.fortuna.ical4j.model.Date], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[fechabaja-->IMGESTION_ARTICULOS.FECHABAJA]] with descriptor [RelationalDescriptor(com.company.imgestion.entity.Articulos --> [DatabaseTable(IMGESTION_ARTICULOS)])], could not be converted to [class java.sql.Date].
---
org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.6.2.cuba6): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [5/08/16 2:00], of class [class org.ocpsoft.prettytime.shade.net.fortuna.ical4j.model.Date], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[fechabaja-->IMGESTION_ARTICULOS.FECHABAJA]] with descriptor [RelationalDescriptor(com.company.imgestion.entity.Articulos --> [DatabaseTable(IMGESTION_ARTICULOS)])], could not be converted to [class java.sql.Date].
---
javax.persistence.RollbackException: Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.6.2.cuba6): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [5/08/16 2:00], of class [class org.ocpsoft.prettytime.shade.net.fortuna.ical4j.model.Date], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[fechabaja-->IMGESTION_ARTICULOS.FECHABAJA]] with descriptor [RelationalDescriptor(com.company.imgestion.entity.Articulos --> [DatabaseTable(IMGESTION_ARTICULOS)])], could not be converted to [class java.sql.Date].
---
org.eclipse.persistence.exceptions.ConversionException:
Exception Description: The object [5/08/16 2:00], of class [class org.ocpsoft.prettytime.shade.net.fortuna.ical4j.model.Date], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[fechabaja-->IMGESTION_ARTICULOS.FECHABAJA]] with descriptor [RelationalDescriptor(com.company.imgestion.entity.Articulos --> [DatabaseTable(IMGESTION_ARTICULOS)])], could not be converted to [class java.sql.Date].
at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:83)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy148.commit(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:84)
at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:130)
at com.sun.proxy.$Proxy23.commit(Unknown Source)
at com.haulmont.cuba.client.sys.DataManagerClientImpl.commit(DataManagerClientImpl.java:95)
at com.haulmont.cuba.gui.data.impl.GenericDataSupplier.commit(GenericDataSupplier.java:88)
at com.haulmont.cuba.gui.data.impl.DsContextImpl.commit(DsContextImpl.java:164)
at com.haulmont.cuba.gui.components.EditorWindowDelegate.commit(EditorWindowDelegate.java:255)
at com.haulmont.cuba.web.gui.WebWindow$Editor.commitAndClose(WebWindow.java:1437)
at com.haulmont.cuba.gui.components.AbstractEditor.commitAndClose(AbstractEditor.java:110)
at com.haulmont.cuba.gui.components.EditorWindowDelegate$2.actionPerform(EditorWindowDelegate.java:93)
at com.haulmont.cuba.web.gui.components.WebButton.performAction(WebButton.java:48)
at com.haulmont.cuba.web.gui.components.WebButton$1.buttonClick(WebButton.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1030)
at com.vaadin.ui.Button.fireClick(Button.java:377)
at com.haulmont.cuba.web.toolkit.ui.CubaButton.fireClick(CubaButton.java:54)
at com.vaadin.ui.Button$1.click(Button.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:414)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:79)
at com.haulmont.cuba.web.sys.CubaVaadinServletService$CubaUidlRequestHandler.lambda$synchronizedHandleRequest$92(CubaVaadinServletService.java:307)
at com.haulmont.cuba.web.sys.CubaVaadinServletService.withUserSession(CubaVaadinServletService.java:189)
at com.haulmont.cuba.web.sys.CubaVaadinServletService$CubaUidlRequestHandler.synchronizedHandleRequest(CubaVaadinServletService.java:307)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1409)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:369)
at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:254)
at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)