[JBoss Seam] - Persisting Object from previous screen in one trasaction
by thejavafreak
Dear all,
Is there any guide I need to follow in order to be able to persist an object from a previous screen that is involved in a pageflow?
Since I get this stacktrace:
| Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: org.hireway.model.User at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:79)
| at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
| at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
| at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
| at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
| at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213)
| at org.jboss.ejb3.entity.ExtendedEntityManager.persist(ExtendedEntityManager.java:104)
| at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:128)
| at org.hireway.action.RegisterVendor.register(RegisterVendor.java:43)
| 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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
| at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
| 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.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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
| 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.invokeInCallerTx(TxPolicy.java:126)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201)
| 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.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| 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.stateful.StatefulContainer.localInvoke(StatefulContainer.java:189)
| at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
| at $Proxy52.register(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:20)
| 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:57)
| at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
| at org.javassist.tmp.java.lang.Object_$$_javassist_3.register(Object_$$_javassist_3.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 com.sun.el.parser.AstValue.invoke(AstValue.java:174)
| at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
| at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
| ... 35 more
| May 4, 2007 8:25:50 AM com.sun.faces.lifecycle.InvokeApplicationPhase execute
| WARNING: #{registerVendor.register}: org.hibernate.PersistentObjectException: detached entity passed to persist: org.hireway.model.User
| javax.faces.FacesException: #{registerVendor.register}: org.hibernate.PersistentObjectException: detached entity passed to persist: org.hireway.model.User
| at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
| at javax.faces.component.UICommand.broadcast(UICommand.java:383)
| at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
| at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
| at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
When I wanted to persist a Used object that is submitted from previous screen (1st screen).
When I looked into debug.seam while on the 2nd page, the object is there/instantiated but when I hit submit on that 2nd page I get this stacktrace.
Can anybody give a clue about this? I've tried looking the examples but I couldn't find the ones that uses two object from two different screen persisted on one transaction
Regards,
joshua
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043055#4043055
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043055
18 years, 12 months
[JBoss Seam] - Seam's Identity and Authenticator
by tonylmai
Can someone tell me the correlation between Seam's Identity and Authenticator?
It is my understanding that we can declare/override the RuleBasedIdentity as followed:
@Name("org.jboss.seam.security.identity")
| @Scope(ScopeType.SESSION)
| @Intercept(InterceptionType.AFTER_RESTORE_VIEW)
| public class MyIdentity extends RuleBasedIdentity {
| ...
| @Override
| public String login() {
| super.login(); /* Ignore outcome from super */
|
| ...
| return "nextPage";
| }
And use it in our web page as followed:
<h:commandButton value="Login" action="#{identity.login}"/>
|
Then I also see code using Authenticator as followed:
component.xml
<security:identity authenticate-method="#{authenticator.authenticate}" security-rules="#{securityRules}"/>
with
@Name("authenticator")
| public class Authenticator {
| @In
| Identity identity;
|
| public boolean authenticate() {
| ...
| return true;
| }
|
Is there an implicit correlation between these two component? Or are they mutually exclusive? Is one better than the other?
Thanks for your help.
-tony
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043050#4043050
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043050
18 years, 12 months
[JBoss Seam] - Re: Is seam-gen really a good idea to learn about seam?
by fperedo
Hi!
well a "transient POJOs to persistent POJOs to J2EE5 tutorial" would be:
-First, transient POJOs: show me what can be done in
SEAM without JPA or Hibernate. (a really simple in memory POJOs example with 1 page first, and then 2 or three) ¿this part needs the microcontainer?
-Second, persistent POJOs: evolve from the first tutorial and make some of its POJOs persistent (using just Hibernate, then show how to do it with JPA annotations) ¿this part needs the microcontainer?
-Third, full J2EE, add stuff like stateless & statefull POJOS that can only be done having a full J2EE5 stack (is there a difference between having a full J2EE5 stack and using the microcontainer?)
Currently, the documentation starts with a short example, but that doesn't make it simple, too much background is needed to understand how all the moving parts of SEAM interact to give life to that example... that is why I want a step by step example... I understand that once I am an expert in SEAM I will want to use the generator to save me from doing repetitive stuff, but, now that I am a beginner... I find it a little overwhelming... of course I can "just use it", but I am worried that after a while I find that I need to customize something "low level" and, if that happens... I am going to feel trapped in a dead end...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043041#4043041
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043041
18 years, 12 months