Hi Dan ,

  Thanks for u info. Read document regarding transaction in javasoft.com
and i found out that what i done it in CMP is
  wrong.

  BTW , can i know why i must set the fetching key as RequiresNew ??

  Thanks wt.

Dan Christopherson wrote:
> 
> Hi, Ricky!
> You can do explicate commit and rollback, but not the way you're doing
> it. What you need to do is take a look at using Bean Managed
> Transactions, rather than the default container managed. This lets you do
> commit/rollback at the transaction level.
> 
> You could also look at putting your key fetching code in a stateless
> session bean whose methods are marked as 'RequiresNew' transaction. This
> will also make porting to a different database easier.
> 
> On Wed, 28 Mar 2001, Ricky wrote:
> 
> >
> > Hi all , i am using jboss2.1 , linux6.1 ,Tomcat 3.2.1 and jdk1.3.
> > Can implemented the code below in my stateless bean ???
> > Can i do commit and rollback explicit in EJB ??
> >
> >  Thanks wt.
> >
> >   try{
> >
> >     conn = this.getConnection() ;
> >     conn.setAutoCommit(false);
> >     ps = conn.prepareStatement("Select NEXTVAL('userprojectinfo_seq')
> > from userprojectinfo_seq");
> >     rs = ps.executeQuery();
> >     conn.commit()
> >
> >     if(rs.next()){
> >       projectinfojb.setProjectid(rs.getInt("nextval"));
> >      }
> >    }
> >    catch(Exception ce){
> >     ce.printStackTrace();
> >      try{
> >        conn.rollback();
> >      }
> >       catch(SQLException se){}
> >     }
> >     projectinfohome.create(projectinfojb);
> >    }
> >    else throw new UserException("Project no is already exist ");
> >   }
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> 
> --
> Dan Christopherson (danch)
> nVisia Technical Architect (www.nvisia.com)
> 
> Opinions expressed are mine and do not neccessarily reflect any
> position or opinion of nVISIA.
> 
> ---------------------------------------------------------------------------
> If you're a capitalist and you have the best goods and they're
> free, you don't have to proselytize, you just have to wait.
> -Eben Moglen
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to