fierst of all sorry for my english :)
1.I've jboss-4.0.4.GA configured with EJB3 and it was working fine before i
deside working with transaction. :)
i have one entity bean (for example Student) and one stateless session bean
like this :
| 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 {
| manager.getTransaction().begin();
| manager.persist(_student);
| manager.getTransaction().commit();
| return _student.getId();
| } catch (Exception e) {
| manager.getTransaction().rollback();
| }
| }
| }
|
|
and this is my persistance.xml file :
| <?xml version="1.0" encoding="UTF-8" ?>
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="Students Registration" transaction-type="JTA">
| <jta-data-source>java:/XAOracleDS</jta-data-source>
| <class>com.magti.businesslayer.ejb3entity.Student</class>
| <properties>
| <property name="hibernate.dialect"
value="org.hibernate.dialect.OracleDialect"/>
| <property name="hibernate.connection.driver_class"
value="oracle.jdbc.driver.OracleDriver"/>
| <property name="hibernate.connection.url"
value="jdbc:oracle:thin:@192.9.200.177:1521:devnbtwo"/>
| <property name="hibernate.connection.username"
value="paata"/>
| <property name="hibernate.connection.password"
value="1982226"/>
| <property name="hibernate.default_schema"
value="PAATA"/>
| </properties>
| </persistence-unit>
| </persistence>
|
and in client side i get error like this:
| Exception in thread "main" java.lang.IllegalStateException: Illegal to call
this method from injected, managed EntityManager
| at
org.jboss.ejb3.entity.TransactionScopedEntityManager.getTransaction(TransactionScopedEntityManager.java:219)
|
|
and one other question :) how i can workig with distributed transactions in
ejb3 (i mean that bean insert two different database and i want manage both
transaction of them)
thanks .....
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956212#3956212
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956212
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=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user