Hi,
you r right Jens, I had missed out on two things...

1) Resource-ref entry in the <entity> tag.
 
                       <resource-ref>
                                <description>description</description>
                               
<res-ref-name>jdbc/DefaultEJBHello</res-ref-name>
                               
<res-type>javax.sql.DataSource</res-type>
                                <res-auth>Container</res-auth>
                        </resource-ref>      

2) <container-transaction>.... tag for the same bean.

Now I have removed the connection.commit() and it works fine.

Now, since I have not specified the field with constraint .. primary key
in the database, it adds a duplicate entry in the database... despite of
showing DuplicateKeyException....
I think I'd have to set context.setRollbackOnly() after I catch this
exception.

Thanks,
Ishpal...


Jens Stutte wrote:
> 
> Hi.
> 
> It should not be neccessary to commit the changes yourself if you are using
> the right datasource (the ejb-location). One clue of EJB is that the
> container manages the transactions and the commit is part of the
> transaction. So check your code (you may not gather an own pure JDBC
> connection but should retrieve a datasource from the ejb server).
> 
> Regards,
> 
> Jens Stutte
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Ishpal [mailto:[EMAIL PROTECTED]]
> > Gesendet am: Freitag, 15. September 2000 06:08
> > An: Orion-Interest
> > Betreff: Re: BMP Problem
> >
> > Hi ,
> >
> > May be u've seen my mail regarding the BMP Problem...
> >
> > Well, my problem has been solved. I was not committing the changes to
> > the database before closing the connection...
> > In the finally block I included con.commit() and now it works fine...
> >
> > Thanks,
> > Ishpal.
> >

Reply via email to