Dne četrtek 05 julij 2001 09:40 ste napisali:
> Jure,
>
> As I understand it you are not meant to directly access con.commit() or
> con.rollback() methods from
> within an EJB. If you want to do Bean demarcated transactions, then you
> should use an external (to postgres) transaction manager
> via the javax.transaction.UserTransaction interface and use its commit()
> and rollback() methods.
>
> see section 11 of the EJB spec - specifically section 11.3.3
>
> cheers
> Perryn
I don't know. I you read Sun's J2EE Developers Guide, it says there are two
options with Bean demarcated transcations: One is known as JDBC transactions,
the other one is JTA (JAva Transaction API ).
So I think both should work, depending on context. I guess the JDBC stuff
can't span multiple data sources because it's using the transaction manager
of the DB, but JTA should do that using an external transcation manager
And I may be wrong about it....
Jure
>
> -----Original Message-----
> From: Jure Lodrant [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 5 July 2001 14:58
> To: [EMAIL PROTECTED]
> Subject: [JBoss-user] rollback jdbc transaction
>
>
> Hi,
>
> here is my problem:
>
> I have a sample session bean connecting to a postgres datasource (Using
> JBOSS
> 2.2.2 here). A bussiness
> method goes like this:
>
> try {
> con.setAutoCommit(false);
> updateOrderItem(productId, orderId);
> updateInventory(productId, quantity);
> con.commit();
> } catch (Exception ex) {
> try {
>
> con.rollback();
> throw new EJBException("Transaction failed: " +
> ex.getMessage());
> } catch (Throwable sqx) {
> throw new EJBException("Rollback failed: " +
> sqx.getMessage());
> }
> }
> }
>
>
> if transaction is committed, all is OK. When an application exception
> occurs
>
> (e.g. updateInventory throws an exception) and con.rollback() is called,
> the
>
> client gets an exception:
>
> RemoteException occurred in server thread; ne
> sted exception
> is:
> java.rmi.ServerException: Transaction rolled back
> java.rmi.ServerException: RemoteException occurred in server thread; nested
> exception is:
> java.rmi.ServerException: Transaction rolled back
> java.rmi.ServerException: Transaction rolled back
> at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemote
>C all.java:248)
> at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128)
> at
> org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invoke(Unknown
> Source)
> at
> org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(Stateles
>s SessionProxy.java:188)
> at $Proxy1.ship(Unknown Source)
> at warehouse.test.WarehouseClient.main(WarehouseClient.java:37)
>
> The server log is empty, like nothing happened.
>
> The rollback is only supposed to throw an SQLException in case of db
> backend
>
> problems. What am I doing wrong here?
>
>
> Jure
>
> _______________________________________________
> 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
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user