[Persistence, JBoss/CMP, Hibernate, Database] - Set Criteria.DISTINCT_ROOT_ENTITY with EntityManager
by jfrankman
Is it possible to set the Criteria.DISTINCT_ROOT_ENTITY with my EntityManager object?
I am having the problem of my HQL query returning duplicate objects. I tried the distinct keyword as follows:
select distinct client from ClientVO client " +
| "left join fetch client.policies policy " +
| "left join fetch client.entityLocations entityLocation " +
| "left join fetch entityLocation.locationType locationType " +
| "left join fetch entityLocation.location location " +
| "left join fetch client.clientMembers clientMember " +
| "where (client.id = :id)
But I still get the duplicate object returned. I know it has to do with the recursive join I have: "left join fetch client.clientMembers clientMember ". I came across this article: http://www.hibernate.org/117.html#A12 that seems to identify my problem. I want to be able to try the solution that uses Criteria.DISTINCT_ROOT_ENTITY but cannot figure out how to setResultTransformer from my EntityManager object.
Another thing that is confusing me is why the distinct keyword does not return distinct objects. I understand why in the SQL results there are duplicate records returned, but I thought the HQL distinct keyword refers to the objects returned, not the sql results.
Any thoughts would be appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058958#4058958
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058958
18Â years, 9Â months
[JBoss Seam] - Asynchronous seam mail can not get the base URL dynamically
by milli
Hi,
While creating a user account, I'm trying to invoke an asynchronous method in my SLSB to send the activation mail. In my activation mail template, I'm trying to resolve the activation URL dynamically instead of having a static one.
I tried the following methods and none of them gets the correct URL:
<s:link> - resolves to /project/activation.seam - I don't know where the project is coming from 'cause that is not my application context path
#{facesContext.externalContext.requestContextPath} - resolves to null
defined a factory variable and try to use #{basePath} - resolves to null
<factory name="basePath" scope="APPLICATION" value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}/"/>
finally tried to inject facesContext in the SLSB that renders the mail template, and it fails to inject.
Finally concluded that it is 'cause of asynchronous method. I think it looses all the contexts when it is run. If I make it synchronous, everything works fine.
Has anyone come across this problem? Is there a way to set contexts for asynchronous methods?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058956#4058956
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058956
18Â years, 9Â months
[JBoss Seam] - Component with @WebRemote methods can no longer use @Request
by jazir1979
Hi again,
I have a seam component with two @WebRemote methods and one standard method. The standard method uses a @RequestParameter.
This worked fine in 1.2.1.GA but is breaking now on 2.0.0 (stacktrace below). I'm going to try and split this into two seperate components which I hope will fix it. But it's another annoying regression. Perhaps @RequestParameter injection could be skipped when calling a @WebRemote method?
| java.lang.NullPointerException
| at org.apache.catalina.connector.Request.parseParameters(Request.java:2409)
| at org.apache.catalina.connector.Request.getParameterValues(Request.java:1089)
| at org.apache.catalina.connector.RequestFacade.getParameterValues(RequestFacade.java:396)
| at com.sun.faces.context.RequestParameterValuesMap.get(ExternalContextImpl.java:1195)
| at com.sun.faces.context.RequestParameterValuesMap.get(ExternalContextImpl.java:1180)
| at java.util.Collections$UnmodifiableMap.get(Collections.java:1283)
| at org.jboss.seam.web.Parameters.convertMultiValueRequestParameter(Parameters.java:49)
| at org.jboss.seam.Component.injectParameters(Component.java:1337)
| at org.jboss.seam.Component.inject(Component.java:1304)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
| 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:106)
| at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
| at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
| at com.synyati.spurwing.base.interceptor.SpurwingExceptionHandler.handleException(SpurwingExceptionHandler.java:69)
| at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
| at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
| at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
| at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
| at $Proxy223.validateLookup(Unknown Source)
| 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.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
| at org.javassist.tmp.java.lang.Object_$$_javassist_65.validateLookup(Object_$$_javassist_65.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.remoting.Call.execute(Call.java:148)
| at org.jboss.seam.remoting.ExecutionHandler$1.process(ExecutionHandler.java:71)
| at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:46)
| at org.jboss.seam.remoting.ExecutionHandler.handle(ExecutionHandler.java:60)
| at org.jboss.seam.remoting.Remoting.getResource(Remoting.java:113)
| at org.jboss.seam.servlet.SeamResourceServlet.doGet(SeamResourceServlet.java:69)
| at org.jboss.seam.servlet.SeamResourceServlet.doPost(SeamResourceServlet.java:78)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058952#4058952
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058952
18Â years, 9Â months
[JBoss Seam] - Re: When and where to use jBPM in Seam app ?
by pete.muirï¼ jboss.org
"dkane" wrote : Let's assume we are using jBPM. One question is unanswered, I will ask it again. When we expose stateful bean as Seam component with scope = business process, it's persistence may be longer than session and continue across sessions/users , right ?
An object can stay in the BUSINESS PROCESS scope for longer than a session, yes. I would avoid the word persistence, as it has a specific meaning in Seam/JPA.
anonymous wrote : If we don't need this object when process ends, then we don't need it to be entity bean and stay in database afterwards. We don't care how Seam/jBPM saves state in context (maybe using the same database), maps table names, fields, etc. Is it good practice to use process-wide stateful bean in such manner, or Entity bean is still recommended ?
If you don't need to persist your object using JPA, then it doesn't need to be a JPA entity (you may still need to map it to a database for JPBM to persist between server restarts, but thats another matter...)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058946#4058946
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058946
18Â years, 9Â months