BTW, I found that you must avoid recursion of the listener. In
SpecialCases.xpt you should use this instead of my previous suggestion:
«AROUND templates::DomainObject::jpaEntityListenersAnnotation FOR
DomainObject -»
«IF name == 'AuditRecord'-»
«targetDef.proceed()»
«ELSE -»
@javax.persistence.EntityListeners({
«formatAnnotationParameters({
getValidationEntityListener() != null, "",
getValidationEntityListener() +
".class",
true, "",
"org.fornax.cartridges.sculptor.examples.library.audit.domain.AuditRecordListener.class"
})»})
«ENDIF -»
«ENDAROUND»
Patrik Nordwall wrote:
>
> I can reproduce the "argument type mismatch" if I change the parameter
> type of the method
> void recordAuditInformation(Identifiable entity)
> in the AuditRecordListener
>
> Have you used correct import?
> org.fornax.cartridges.sculptor.framework.domain.Identifiable
>
> Are your domain objects implementing Identifiable? I think the generated
> code always does that.
>
> Your second question, AuditInterceptor.
> AuditInterceptor is a hibernate specific "listener" that we used before
> JPA.
> It is possible to do similar thing with it as I suggested with the JPA
> listener. I would recommend that you use the jpa listener way, to avoid
> dependency to hibernate specific features if not needed.
>
> fullauditable
>
> Define the following in sculptor-generator.properties
> generate.fullAuditable=true
>
> Then each setter method in the domain objects will keep track of the
> changes done since the instance was loaded. The domain objects will then
> also implement FullAuditLog interface, which makes it possible for you to
> get this information from the AuditRecordListener JPA listener, and save
> it to the AuditRecord. Maybe you should insert one AuditRecord row for
> each field change?
>
> /Patrik
>
>
> Narich wrote:
>>
>> Ok this is the full trace :
>>
>> org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException]:java.lang.IllegalArgumentException:
>> argument type mismatch
>> at
>> org.fornax.cartridges.sculptor.framework.errorhandling.BasicErrorHandlingAdvice.afterThrowing(BasicErrorHandlingAdvice.java:95)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at
>> org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invokeHandlerMethod(ThrowsAdviceInterceptor.java:146)
>> at
>> org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:131)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> at $Proxy25.createClientService(Unknown Source)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> at
>> org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> at $Proxy25.createClientService(Unknown Source)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at
>> org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)
>> at
>> org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)
>> at
>> org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
>> at
>> org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)
>> at
>> org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74)
>> at
>> org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
>> at
>> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
>> at
>> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
>> at
>> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
>> at
>> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>> at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>> at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
>> at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>> at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>> at java.lang.Thread.run(Unknown Source)
>> at
>> org.springframework.remoting.support.RemoteInvocationUtils.fillInClientStackTraceIfPossible(RemoteInvocationUtils.java:47)
>> at
>> org.springframework.remoting.support.RemoteInvocationResult.recreate(RemoteInvocationResult.java:115)
>> at
>> org.springframework.remoting.support.RemoteInvocationBasedAccessor.recreateRemoteInvocationResult(RemoteInvocationBasedAccessor.java:85)
>> at
>> org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:147)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> at $Proxy5.createClientService(Unknown Source)
>> at
>> com.test.TestBanqueService.testCreateBanqueService(TestBanqueService.java:41)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
>> at
>> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
>> at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
>> at
>> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
>> at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
>> at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
>> at
>> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
>> at
>> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>> at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
>> at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>
>>
>> I have also another question , I was trying to add my own treatment in
>> the class "AuditInterceptor" that exist in the sculptor framework . but
>> it had no effect !.
>> the same thing happen with JodaAuditInterceptor . did i miss some thing
>> ? Is there any way to activate those Interceptor?
>>
>> Thanks !
>>
>>
>> Patrik Nordwall wrote:
>>>
>>> Full stack trace would be useful.
>>> /Patrik
>>>
>>> Narich wrote:
>>>>
>>>> Thank you for answering me .
>>>>
>>>> I did what you tell me , but i get an exception when I try to insert a
>>>> new record
>>>>
>>>> org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException]:java.lang.IllegalArgumentException:
>>>> argument type mismatch
>>>>
>>>> If you want, i can give you the full trace .
>>>>
>>>> did I forgot something ?
>>>>
>>>> I am also interested in how to use fullauditable , can you give me more
>>>> information about this?
>>>>
>>>> thanks !
>>>>
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/Audit-in-a-separable-table-tp29356396s17564p29445483.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer