Hi Thierry,
Thanks for quick response.
Actually I need an EntityManager to create my custom queries.
Using of nativeQuery will change the way I'm accessing logs (via
EntitiyManager.createQuery() call).
Is there an easier way to fetch EntityManager for logs, or I have to
change my query builder?
Thanks again for help.
Regards,
Stefan.
Thierry Delprat wrote:
Hi,
The method you are calling is not part of the ejb3 interface, that's
why you get a tx error: you are using the pojo service interface that
does not use the entitymanager of the container.
Basically, you should call getService on either:
- Logs.class
- AuditReader.class
- AuditLogger.class
- AuditAdmin.class
You are not supposed to accec directly an cast the underlying pojo
service.
Using AuditReader nativeQuery method should give you access to what
you need.
Hope this helps.
Tiry
On 21 Nov 2009 10:04, <[email protected]
<mailto:[email protected]>> wrote:
Hi,
I'm trying to migrate our sources from 5.2.0 to 5.3.0. Everything is
going fine by now without some special problems.
The problem is in using of NXAuditEventsService. We are wrapping it,
because we need to do more complex searches in the audit logs.
Now when I'm trying to search for something I have an exception. I
removed everything from the code and try with simple calls to the
service.
May be I have to configure something more or the way I'm using the
service is wrong?
Next code fragment is part of my code:
NXAuditEventsService auditService = null;
try {
auditService =
(NXAuditEventsService)Framework.getService(NXAuditEvents.class);
} catch (Exception e) {
throw ClientException.wrap(e);
}
return auditService.getEventsCount("sss");
Exception is thrown when I'm going to call getEventsCount.
Part of full stacktrace is:
Caused by: javax.persistence.PersistenceException:
org.hibernate.HibernateException: The chosen transaction strategy
requires access to the JTA TransactionManager
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:691)
at
org.nuxeo.ecm.core.persistence.HibernateConfiguration.getFactory(HibernateConfiguration.java:114)
at
org.nuxeo.ecm.core.persistence.HibernateConfiguration.getFactory(HibernateConfiguration.java:118)
at
org.nuxeo.ecm.core.persistence.PersistenceProvider.openPersistenceUnit(PersistenceProvider.java:49)
at
org.nuxeo.ecm.core.persistence.PersistenceProvider.doAcquireEntityManager(PersistenceProvider.java:67)
at
org.nuxeo.ecm.core.persistence.PersistenceProvider.run(PersistenceProvider.java:144)
at
org.nuxeo.ecm.platform.audit.service.NXAuditEventsService.getEventsCount(NXAuditEventsService.java:519)
at
com.setelis.nuxeo.audit.impl.SetelisAuditSearchImpl.countSearchLogs(SetelisAuditSearchImpl.java:170)
at
com.setelis.nuxeo.audit.web.SetelisAuditServiceBean.init(SetelisAuditServiceBean.java:68)
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:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at
org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
at
com.setelis.nuxeo.audit.web.SetelisAuditServiceBean_$$_javassist_52.init(SetelisAuditServiceBean_$$_javassist_52.java)
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:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at
org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
at
org.jboss.seam.Component.callComponentMethod(Component.java:2178)
at org.jboss.seam.Component.callCreateMethod(Component.java:2101)
at org.jboss.seam.Component.newInstance(Component.java:2062)
I'm using 2 datasources - one for repository and one for the other
services. Both of them are configured as XA.
Regards,
Stefan
--
Posted by "[email protected] <mailto:[email protected]>" at Nuxeo
Discussions <http://nuxeo.org/discussions>
View the complete thread:
<http://www.nuxeo.org/discussions/thread.jspa?threadID=3037#8943>
_______________________________________________
ECM mailing list
[email protected] <mailto:[email protected]>
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm
------------------------------------------------------------------------
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm