[JBoss-user] [EJB 3.0] - Re: transactions and distributed transactions in ejb3

2006-07-10 Thread grdzeli_kaci

[EMAIL PROTECTED]

did u mean JBoss Transactions API named ArjunaTA ?


i removed this code from my program 

  | manager.getTransaction().begin();   
  | manager.getTransaction().commit();
  | manager.getTransaction().rollback();
  | 
but i get en error again :(
error 

  | javax.persistence.TransactionRequiredException: EntityManager must be 
access within a transaction
  | 23:19:47,281 ERROR [STDERR] at 
org.jboss.ejb3.entity.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:149)
  | 23:19:47,281 ERROR [STDERR] at 
org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:174)
  | 

my bean looks like :



  | import [...]
  | @TransactionManagement(value = TransactionManagementType.BEAN)
  | @Remote(StudentFasade.class)
  | public @Stateless
  | class StudentFasadeBean implements StudentFasade {
  | 
  | @PersistenceContext
  | private EntityManager manager;
  | 
  | @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  | public Long addStudent(Student stbean)
  | throws MagtiException {  
  | try {
  | System.out.println(= Adding Student 
=);   
  | manager.persist(stbean);
  | return _student.getId();
  | 
  | } catch (Exception e) {
  | e.printStackTrace();
  | return 0L;
  | }
  | }
  | }
  | 
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3956517#3956517

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3956517


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: transactions and distributed transactions in ejb3

2006-07-10 Thread grdzeli_kaci
ok thanks u're rigth  it works but
what can i do when i wont work with multiple database ?
i think that i need to xml datasourse file (for example : oracle-xa-ds.xml and 
postgres-ds.xml) both of them configured corectly :
oracle ds file :

  | datasources
  |   xa-datasource
  | jndi-nameXAOracleDS/jndi-name
  | track-connection-by-tx/
  | isSameRM-override-valuefalse/isSameRM-override-value
xa-datasource-classoracle.jdbc.xa.client.OracleXADataSource/xa-datasource-class
  | xa-datasource-property 
name=URLjdbc:oracle:thin:@192.9.200.177:1521:devnbtwo/xa-datasource-property
  | xa-datasource-property name=Userpaata/xa-datasource-property
  | xa-datasource-property 
name=Password1982226/xa-datasource-property   
exception-sorter-class-nameorg.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter/exception-sorter-class-name
  | no-tx-separate-pools/
  |   metadata
  |  type-mappingOracle9i/type-mapping
  |   /metadata
  |   /xa-datasource
  |   mbean 
code=org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter 
  |  name=jboss.jca:service=OracleXAExceptionFormatter
  | depends 
optional-attribute-name=TransactionManagerServicejboss:service=TransactionManager/depends
  |   /mbean
  | /datasources
  | 
and  postgres ds file:


  | datasources
  |   local-tx-datasource
  | jndi-namePostgresDS/jndi-name
  |connection-urljdbc:postgresql://localhost:5432/Test/connection-url
  | driver-classorg.postgresql.Driver/driver-class
  | user-namepostgres/user-name
  | password1982226/password
  | new-connection-sqlselect 1/new-connection-sql
  |   metadata
  |  type-mappingPostgreSQL 7.2/type-mapping
  |   /metadata
  |   /local-tx-datasource
  | /datasources
  | 

and i want do operation wich inserts into one db and then into second db in one 
transaction 
how i can do it ? :( plz F1 :)

[EMAIL PROTECTED]  told me about JBossJCA 
but i didn't find any sample about it ... 
is there any simple example about distributed transactions ...




View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3956565#3956565

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3956565


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: transactions and distributed transactions in ejb3

2006-07-10 Thread epbernard
remove @TransactionManagement(value = TransactionManagementType.BEAN)

in most case you don't want to handle tx management yourself

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3956549#3956549

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3956549


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: transactions and distributed transactions in ejb3

2006-07-08 Thread grdzeli_kaci
thanks ...
i will try it .


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3956385#3956385

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3956385


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: transactions and distributed transactions in ejb3

2006-07-07 Thread [EMAIL PROTECTED]
Hi, your English is just fine!

The issue is you are trying to acquire a transaction in a component that 
manages transactions for you. 

Remove the 


  | 
  | manager.getTransaction().begin();   
  | manager.getTransaction().commit();
  | 
  | 

and the associated rollback. 

For the distributed (multi DB) transaction you just need two XA datasources. 
Please see

http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossJCA

to learn how to set up XA datasources. 





View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3956219#3956219

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3956219

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user