[jboss-user] [EJB 3.0] - Re: ManyToMany relationship do not work properly
fla83tn
do-not-reply at jboss.com
Fri Nov 23 11:45:25 EST 2007
Now I'm able to see the Exception..the problem occurs when I try to register a user to a source that does not exist yet. The Exception throwed is:
| javax.ejb.EJBTransactionRolledbackException: org.hibernate.HibernateException: this instance does not yet exist as a row in the database
| [java] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
| [java] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
| [java] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
| [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| [java] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| [java] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| [java] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| [java] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| [java] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| [java] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| [java] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
| [java] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
| [java] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
| [java] at $Proxy203.createSources(Unknown Source)
| [java] at nc.session.facade.admin.AdminSessionFacadeBean.addSourceToUser(AdminSessionFacadeBean.java:191)
|
I also found a patch to this...I entered this lines in the code:
logger.debug("New Source (not found in Db): adding user to it");
| src=SourceAssembler.createSource(s);
| logger.debug("Source created: "+src.getSourceId()+", "+src.getUrl());
| manager.persist(src);
| manager.flush();
| list = new ArrayList<User>();
| list.add(user);
| src.setUsers(list);
| manager.persist(src);
|
However, why do I need to make the source persistent and synching with the database before adding user to it?? In all examples the persist method is called only once and without any flush!!
Any suggest?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107397#4107397
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107397
More information about the jboss-user
mailing list