JTA and JTS

1. What is the difference between JTA and JTS?
2. When should we use JTA and when should we use JTS?
3. In which scenarios that JTA and JTS could not help so that RDBMS specific commands are MUST to LOCK TABLES/ROWS?

The JTS specifies what happens. The JTA is the API used to talk to a JTS compliant service.

Similar Messages

  • Toplink 9.0.4.8 and JTS on OAS 10.1.2.0.0 and 10.1.2.0.2 not rolling back

    Re-Posting message with more information.
    Toplink 9.0.4.8 and JTS not rolling back transaction
    Hi
    Scenario:
    I have a session bean (EJB1) calling a session bean (EJB2).
    When an EJB1 is called, EJB1 persists data on to Table1 in database.
    And EJB1 makes multiple calls to EJB2 to create entries in three different tables. Trans-attribute is set as required on both EJBS.
    Problem:
    EJB1 gets a Runtime Exception while inserting the data into TABLE1 (ORA-12899: value too large for column), EJB1 transaction is rollback, but all other transactions related to EJB2 are getting committed. I assume that they should roll back too.
    Also, I did JAD on external transaction controller and listener and noticed that there is a transaction associated to each call. Meaning EJB1 had Transaction T1 and EJB2 had T2, T3, and T4 for the subsequent calls. When EJB1 is getting runtime exception in the method beforeCompletion(), the it calls rollbackGlobalTransaction() which is calling T1.setRollbackonly(). But not on on T2, T3, and T4 rollback
    Am I missing anything?
    Please help me
    Here are my configuration details:
    The datasource configuration:
    <data-source name="myTxDataSource"
    class="com.evermind.sql.OrionCMTDataSource"
    location="jdbc/myTxDataSourceCoreDS"
    xa-location="jdbc/xa/myTxDataSourceXADS"
    ejb-location="jdbc/myTxDataSourceDS"
    pooled-location="jdbc/myTxDataSourcePooledDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="duser"
    password="d123"
    url="jdbc:oracle:thin:@localhost:1521:ORCL"
    inactivity-timeout="30"
    />
    Sessions.xml
    <login>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
    <datasource>jdbc/DimpleTxDataSourceCoreDS</datasource>
    <user-name>duser</user-name>
    <encryption-class-name>oracle.toplink.internal.security.JCEEncryptor</encryption-class-name>
    <encrypted-password>22F7AFE6F6B9672435537CE1189E123DD62D1A19DF561D1E</encrypted-password>
    <uses-native-sequencing>true</uses-native-sequencing>
    <uses-external-connection-pool>true</uses-external-connection-pool>
    <uses-external-transaction-controller>true</uses-external-transaction-controller>
    </login>
    <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
    Toplink Helper class that is used by both EJB's
    This one uses SessionBroker. here is how it is initialized:
    SessionManager manager = SessionManager.getManager();
    sessionBroker = (SessionBroker) manager.getSession(xmlLoader,
    sessionBrokerName, this.getClass().getClassLoader());
    Oracle9iJTSExternalTransactionController extController = new Oracle9iJTSExternalTransactionController();
    sessionBroker.setExternalTransactionController(extController);
    It has common following commong methods:
    public UnitOfWork getUnitOfWork() {
    UnitOfWork uow = sessionBroker.getActiveUnitOfWork();
    return uow;
    public Object create(Object o)
    UnitOfWork uow = getUnitOfWork();
    uow.registerNewObject(o);
    // added so that the assigned sequence number will be available before the commit happens
    uow.assignSequenceNumber(o);
    return o;
    }

    A couple of this appear different in your sessions.xml. To do what you want you need to configure TopLink to:
    1. Use an external XT controller - requires flag to be set and controller provided
    2. Use the OC4J data source - requires flag to be set and data source name provided
    I notice that your sessions.xml has both a data source name as well as a direct connection URL.
    Here is a sample that shows the proper settings for the external TX and data source usage:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE toplink-configuration PUBLIC "-//Oracle Corp.//DTD TopLink Sessions 9.0.4//EN" "sessions_9_0_4.dtd">
    <toplink-configuration>
       <session>
          <name>default</name>
          <project-xml>META-INF/tlMap1.xml</project-xml>
          <session-type>
             <server-session/>
          </session-type>
          <login>
             <datasource>jdbc/DimpleTxDataSourceCoreDS</datasource>
             <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
             <uses-external-connection-pool>true</uses-external-connection-pool>
             <uses-external-transaction-controller>true</uses-external-transaction-controller>
          </login>
          <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
          <enable-logging>true</enable-logging>
          <logging-options>
             <print-thread>false</print-thread>
             <print-date>false</print-date>
          </logging-options>
       </session>
    </toplink-configuration>Doug

  • Toplink 9.0.4.8 and JTS on OAS 10.1.2.0.0 and 10.1.2.0.2 not rolling back t

    Toplink 9.0.4.8 and JTS not rolling back transaction
    Hi
    Scenario:
    I have a session bean (EJB1) calling a session bean (EJB2).
    When an EJB1 is called, EJB1 persists data on to Table1 in database.
    And EJB1 makes multiple calls to EJB2 to create entries in three different tables. Trans-attribute is set as required on both EJBS.
    Problem:
    EJB1 gets a Runtime Exception while inserting the data into TABLE1 (ORA-12899: value too large for column), EJB1 transaction is rollback, but all other transactions related to EJB2 are getting committed. I assume that they should roll back too.
    Also, I did JAD on external transaction controller and listener and noticed that there is a transaction associated to each call. Meaning EJB1 had Transaction T1 and EJB2 had T2, T3, and T4 for the subsequent calls. When EJB1 is getting runtime exception in the method beforeCompletion(), the it calls rollbackGlobalTransaction() which is calling T1.setRollbackonly(). But not on on T2, T3, and T4 rollback
    Am I missing anything?
    Please help me
    Here are my configuration details:
    The datasource configuration:
    <data-source name="myTxDataSource"
    class="com.evermind.sql.OrionCMTDataSource"
    location="jdbc/myTxDataSourceCoreDS"
    xa-location="jdbc/xa/myTxDataSourceXADS"
    ejb-location="jdbc/myTxDataSourceDS"
    pooled-location="jdbc/myTxDataSourcePooledDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="duser"
    password="d123"
    url="jdbc:oracle:thin:@localhost:1521:ORCL"
    inactivity-timeout="30"
    />
    Sessions.xml
    <login>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
    <datasource>jdbc/DimpleTxDataSourceCoreDS</datasource>
    <user-name>duser</user-name>
    <encryption-class-name>oracle.toplink.internal.security.JCEEncryptor</encryption-class-name>
    <encrypted-password>22F7AFE6F6B9672435537CE1189E123DD62D1A19DF561D1E</encrypted-password>
    <uses-native-sequencing>true</uses-native-sequencing>
    <uses-external-connection-pool>true</uses-external-connection-pool>
    <uses-external-transaction-controller>true</uses-external-transaction-controller>
    </login>
    <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
    Toplink Helper class that is used by both EJB's
    This one uses SessionBroker. here is how it is initialized:
    SessionManager manager = SessionManager.getManager();
    sessionBroker = (SessionBroker) manager.getSession(xmlLoader,
    sessionBrokerName, this.getClass().getClassLoader());
    Oracle9iJTSExternalTransactionController extController = new Oracle9iJTSExternalTransactionController();
    sessionBroker.setExternalTransactionController(extController);
    It has common following commong methods:
    public UnitOfWork getUnitOfWork() {
    UnitOfWork uow = sessionBroker.getActiveUnitOfWork();
    return uow;
    public Object create(Object o)
    UnitOfWork uow = getUnitOfWork();
    uow.registerNewObject(o);
    // added so that the assigned sequence number will be available before the commit happens
    uow.assignSequenceNumber(o);
    return o;
    }

    Doug, Andrei and others
    I found the problem. I have a Delegate that provides access to all EJBS. This delegate is used by both the webtier and middle tier.It is written in a generic fashion so that the web server and middle tier does not have to be co-located in one container. getInitialContext() which is implemented as follows:
    private static Context getInitialContext() throws NamingException
    // Get InitialContext for Embedded OC4J.
    // The embedded server must be running for lookups to succeed.
    // actual code reads from the external parameters
    String contextFactory = "com.evermind.server.rmi.RMIInitialContextFactory";
    String principal = "admin";
    String passwd = "admin123";
    String providerURL = "ormi://localhost:3201/shc";
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
    env.put(Context.SECURITY_PRINCIPAL, principal);
    env.put(Context.SECURITY_CREDENTIALS, passwd);
    env.put(Context.PROVIDER_URL, providerURL);
    env.put("dedicated.rmicontext","true");
    return new InitialContext(env);
    When the EJB1 tries to look up for EJB2, container thinks that the call is from outside the container and it is starting a new transaction.
    When I changed the EJB1 to look up EJB2 to get the context as shown below,every thing seems to rolling back.
    private static Context getInitialContext() throws NamingException
    return new InitialContext();
    Thanks again for pointing me in the right direction.
    I will post the same message in other threads.
    Raju

  • Creating a separate transaction in both JTA and nonJTA environment

    I want to record some performance information for each call to my application and I want to write it to the database even if the transaction rolls back. The code needs to run both in a Websphere JTA context and a non-JTA context. The code I wrote works in non-JTA, but doesn't work in Websphere JTA context. How do I create an independent transaction when running in JTA context ? Would starting a new thread work, assuming that started a new JTA transaction ? Is there any other way that would have less overhead ?

    One way would be to use non-JTA data source. I am not sure that WebSphere allows that in JTA case, but you still may be able to create it and put into jndi "by hand".
    Alternatively you may try to use suspend / resume apis defined in jta spec.:
    Transaction tobj = TransactionManager.suspend();
    TransactionManager.resume(tobj);
    For more please see
    Java Transaction API (JTA)
    3.2.3 Suspending and Resuming a Transaction

  • Non jta and autocommit

    i am using mysql, tomcat and toplink. how to set autocommit off?

    my persistence.xml is this
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" 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">
    <persistence-unit name="SeleccionsCatPU" transaction-type="RESOURCE_LOCAL">
    <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
    <non-jta-data-source>java:comp/env/jdbc/selcat</non-jta-data-source>
    <class>com.xlives.selcat.prueba.Prueba</class>
    <properties>
    <property name="toplink.session.customizer" value="com.xlives.system.jpa.DataSourceSessionCustomizer"/>
    <property name="toplink.logging.level" value="FINEST"/>
    </properties>
    </persistence-unit>
    </persistence>
    and my customizer is this
    JNDIConnector conn = (JNDIConnector)session.getLogin().getConnector();
    conn.setLookupType(JNDIConnector.STRING_LOOKUP);
    session.getLogin().setTransactionIsolation(DatabaseLogin.TRANSACTION_READ_COMMITTED);
    my code is
    EntityTransaction et = em.getTransaction();
    Prueba p = new Prueba();
    em.persist(p);
    p = new Prueba();
    em.persist(p);
    Query q = em.createQuery("SELECT p FROM Prueba p");
    List<Prueba> results = q.getResultList();
    System.out.println(new Date());
    for (Prueba a: results) {
    // System.out.println(a.getFecha());
    Date b = a.getFecha();
    et.rollback();
    after rollback the transaction the table PRUEBA has 2 more rows.

  • Jta and java snippets

    I notice the java spippets run in the same transactional context. Does anyone know if it is possible to use this fact to commit database changes at specific points in a process?

    Hi,
    Using JDBC connection objects to manage transactions is feasible only in straightforward cases where you have more than one access to the SAME database (and in the same connection scope).
    If you want to be able to do rollback across more than one database (or even across different systems like a database and a queue) then you need to use the JTA facility.
    Hope that helps,
    Guy
    http://www.atomikos.com

  • JTA and XA, Mqueue

    Trying to get XA to work with Oracle and
    Ibm mqueue series.
    I'm not having much luck. Lot's of problems
    and lack of info?
    We want Mqueue to be the TM and oracle to
    be the resource? There seems to be no docs
    on how to make oracle a XA resource and
    understand global transactions?
    Any help would be great.
    thanks
    mark =.=

    Trying to get XA to work with Oracle and
    Ibm mqueue series.
    I'm not having much luck. Lot's of problems
    and lack of info?
    We want Mqueue to be the TM and oracle to
    be the resource? There seems to be no docs
    on how to make oracle a XA resource and
    understand global transactions?
    Any help would be great.
    thanks
    mark =.=

  • Flex Data Services JOTM, JTA and JMX downloads

    I am not a Java developer. I am an Information Architect/UI
    Designer and up until a few months ago, I designed GUIs using MS
    Studio.Net -- Tomcat is a little different IIS, to say the least.
    =)
    I have downloaded the trial software of Flex Builder 2 and
    Flex Data Services to test it with intent to purchase.
    I was getting real happy with Flex Builder 2. Breezing
    through the "Getting Started" and all the tutorials. Absolutely
    Love it.
    Then along comes Flex Data Services. This application has
    bought me to a screeching halt.
    I've downloaded the files according to the instructions at:
    http://www.adobe.com/support/documentation/en/flex/2/install.html#flexj2ee.
    I placed the files in my webapps directory running on tomcat.
    However, according to the instructions at:
    http://www.adobe.com/support/documentation/en/flex/2/install.html#tomcat,
    I need to download additional applications in order to
    correctly use FDS. I have tried to download the JOTM 2.0.10.tgz
    from
    http://forge.objectweb.org/project/download.php?group_id=19&file_id=3926
    without success. When I try to unzip the file (I am running
    Windows XP Professional), I get the following error:
    "Error reading header after processing 0 entries."
    I've tried to download three different versions of JOTM, no
    luck. Our Java developer suggested that I save the "tar" file as a
    "zip" file and try to open it after download. However, when I try
    to open the archive in WinZip it returns this error:
    "Cannot open file: it does not appear to be a valid archive.
    If you downloaded this file, try downloading the file again."
    Both of these errors occur when trying to open the downloaded
    JOTM 2.0.10.tgz and JOTM 2.0.8.tgz files.
    How can I get these applications? Has anyone had any success
    in downloading these files from:
    http://forge.objectweb.org/project/showfiles.php?group_id=19&release_id=1024
    The downloaded archive files are empty. I can not run any of
    the Data Service samples.
    When I tried at:
    http://localhost:8080/samples/dataservice/flexcab/flexcabDispatcher.mxml
    A service error prompt returns: "Unable to access
    UserTransaction in Dataservice".
    I'm assuming this is because the JOTM (et. al) is not on my
    box, because the archive is empty when I try to open it in WinZip.
    Also, while I was reading the installation instructions for
    Tomcat at:
    http://www.adobe.com/support/documentation/en/flex/2/install.html#tomcat
    it seems pretty complicated for a non-Java programmer to
    understand. I asked one of our 6-year veteran Java developers here
    to help me with this and he said it was a pretty a complicated
    process for someone w/o Java programming experience. I thought it
    was geared towards front-end developers. But he did say that if I
    can't download the JOTM, I won't be able to do whatever it is that
    Flex Data Services is supposed to do. I say the latter because I am
    still in the "Getting Started" manual going through the last of the
    tutorials (which is the Flex Data Services distributed application
    tutorial) before I start reading "Using Flex", so I'm not really
    sure what lessons I will be doing that require FDS to work
    correctly on my box.
    Do I really need the FDS to build interactive applications in
    Flex Builder?
    I appreciate your answers. Thanks in advance.

    I agree with you about the process of getting FDS installed
    and working. I recommend that you try Christophe Coenraets FDMS
    tutorial. The JOTM files are in "tar" format, and so I think you'll
    have to extract them using a "tar" utility. This is included with
    any Unix variant, and so I asked someone at work to extract the
    files; on Windows I think you'll have to find a free "tar" program.
    I downloaded jotm-2.0.10.tar from the JOTM Sourceforge. Use
    parameters "-xf" if the tar file is not compressed, or "-zxf" if it
    is compressed. Good luck!

  • JTA and Oracle 8.1.6

              Newbie question.
              We're using Weblogic 6.1 sp2 with Oracle 8.1.6.
              What are my options for JDBC drivers to support JTA for CMT with our EJB's?
              Thanks
              

    Hi John,
              You should be able to use Latest Oracle 8.1.7 thin driver/XA or WebLogic
              jDriver.
              sree
              "John Hufnagle" <[email protected]> wrote in message
              news:3ce913fc$[email protected]..
              >
              > Newbie question.
              > We're using Weblogic 6.1 sp2 with Oracle 8.1.6.
              > What are my options for JDBC drivers to support JTA for CMT with our
              EJB's?
              > Thanks
              >
              

  • WLS JTA and  JMS

    Hi,
              I would like to know, whether the WLS TransactionManager can do the
              following,
              1. within a single unit of work using Bean managed transactions eg.
              pseudo code,
              txn.begin();
              for loop = 1 to n
              msg.send();
              txn.commit();
              I cannot get this to work with MQSeries JMS.
              Please can you explain how the TransactionManager works.
              Is the TransactionManager able to support concurrent transactions?
              If not how do you synchronize calls to the TransactionManager.
              Thank you in advance!
              Regards
              Suren
              

    Hi,
              I would like to know, whether the WLS TransactionManager can do the
              following,
              1. within a single unit of work using Bean managed transactions eg.
              pseudo code,
              txn.begin();
              for loop = 1 to n
              msg.send();
              txn.commit();
              I cannot get this to work with MQSeries JMS.
              Please can you explain how the TransactionManager works.
              Is the TransactionManager able to support concurrent transactions?
              If not how do you synchronize calls to the TransactionManager.
              Thank you in advance!
              Regards
              Suren
              

  • Demarcate and propagate transactions from web components

    Hi,
    Can I start a transaction from within a JSP/Servlet and propagate it to EJBs?
    For example, say there are EJB1.method1 and EJB2.method2, both marked "required". Code a JSP/Servlet like:
    1 UserTransaction tx = ...;
    2 tx.begin();
    3 EJB1.method1();
    4 EJB2.method2();
    5 tx.commit();
    Does it embrace the two EJB methods in one transaction? What if the web components and EJBs are deployed on different servers physically?
    Thanks!
    Sunyu

    I think you probably want to look at a Web services transactions system that integrates with the JTA. That way you can span your transactions across both a loosely coupled and closely coupled environment. There are some examples at www.arjuna.com
    There are several web services transactions specifications out there (OASIS Business Transactions Protocol and IBMs Web Services Transactions, for example). The latter is probably the way to go as it's been designed to interoperate with existing TP systems (it doesn't do that too well at the moment due to "issues" in the spec. but those will be fixed). In addition, JSR 156 is aiming to give J2EE a standard set of interfaces to Web services transactions and interoperability with other J2EE transaction services (JTA and JTS) is high on the agenda.
    Mark.

  • About web service transaction

    Hello everyone:
    I am a newcomer to web service, but now I have to simulate ws-businessactivity protocol. I don't have any idea about it and where to begin with. I made an survey about JTA and JTS, but it seems this api only supports ws-atomic transaction. And in WSIT tutorial, there is only one example. Besides, someone suggests to use web service callback (asynchronous) technology. I so hope somebody could give me advices about the way how to do this. Thank you very much.

    I haven't found any official info on it, but my simple testing (mainly via ST05) indicates that you should be able to call multiple web services within a single LUW -  there seems to be no implicit "commit work" issued by the framework (unlike remote RFC calls).
    Jonathan

  • Transaction with Sunapplication server

    Dear All,
    I am working on some project with sun application server. The project was done in weblogic and it was working fine. Now our management decided move the working version to sunapplication server. I am having big trouble in finding when does server commits the transaction. Is there any indiaction in the log file and any information that we can trace for transactions that are being commited or rolledback. / any thing to indiacte in the sun-ejb-jar.xml
    the flow is like main application conatct session bean which generates event, once event is generated the application generates other 4 records related different persons(insert 4 records into 4 diff tables).
    in 5th step program retrieves the values from tables based on what they inserted in previous steps.
    session bean which initiates applications generated event and use hybernate to store record, the other 4 recordes are created using entity beans.
    I am able to populate the beans(for storing) and retrieve the information from beans. but the actual values are not in the database.
    If some one can help that would be great help.
    thanks
    Srini

    To find out what each transaction ended with you have to change your instance's Log Level for JTA and JTS from default INFO to FINE or FINEST. You could also throw in FINE for EJB Container if you need to check what your EJBs are up to.
    You can chenge Log Level setting via admin console:
    instance-config --> Logger Settings --> Log Levels tab
    Once you change the logger settings rerun your test and loads of info would be printed into instance's server.log.

  • JTS/JTA help

    Could anyone clear my thoughts regarding the following queries -
    1. Is JTS just a Specification or a concrete Implementation that could
    provided Transaction service.
    2. What is the differences between JTS and JTA?
    3. Could I use JTS/JTA directly in my application.
    4. Do I need any other software to make these API work.
    5. Who would be really be the provider of this API? Is there any provider
    from where I could download the libraries.
    Any insights from ur experiences would put me in high spirits :-)
    --Suresh
    [email protected]

    Hi,
    JTS is a specification, a 'Java-version' of the CORBA OTS specification.
    JTA is the interface for creating and using transactions inside one Java application (such as an application server).
    JTS is mainly for 'exporting' and 'importing' the same transaction in different VMs or even to/from CORBA applications that were written in a diffent language and run on a non-Java platform. JTS/OTS also has some interfaces for application-level transaction creation, but Java has the JTA as a simplified mechanism for doing that.
    About using JTA/JTS in your application directly: yes you can, but you may need some extra handling of XAResources that need setup. Atomikos has such a JTA, and also a JTS (but still in beta).
    You do not need extra APIs to make them work, except maybe for the databases or message queues that you want to connect to. For the JTS, you need a Java ORB.
    For more information: http://www.atomikos.com
    Best regards,
    Guy

  • JTA Transaction and CUrrent Session

    We have the following problem. We configured hibernate with
    jta and when we execute a simple code that performs some hibernate
    queries we get the following error:
    "org.hibernate.LazyInitializationException: could not
    initialize proxy - the owning Session was closed"
    We discovered that if we leave the session opened the error
    disapears, but on the long run this crashes the server throwing a
    JDBC connection error.
    We tried to use getCurrentSession() instead of opening the
    session manualy but in this case we get the following error:
    "org.hibernate.HibernateException : Unable to locate current
    UserTransaction"
    This its quite strange because the current session should be
    bound to the current user transaction and its seems to us that our
    hibernate cfg file its ok.
    I´am posting part of my hibernate cfg file and the code
    that I execute.
    hibernate.cfg.xml
    <hibernate-configuration>
    <session-factory name="java:/hibernate/SessionFactory">
    <property
    name="hibernate.connection.datasource">java:fiap</property>
    <property
    name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    <!-- Enable Hibernate's automatic session context
    management -->
    <property
    name="hibernate.current_session_context_class">jta</property>
    <property
    name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactor y</property>
    <property
    name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransact ionManagerLookup</property>
    <property
    name="jta.UserTransaction">java:comp/UserTransaction</property>
    <!-- <property
    name="connection.release_mode">after_statement</property>
    -->
    <!-- <property
    name="hibernate.transaction.flush_before_completion">true</property>-->
    <property
    name="hibernate.transaction.auto_close_session">true</property>
    and my java Code:
    try {
    tx = HUtil.getTx(); //JNDI lookup
    tx.begin();
    session = HUtil.getSessionFactory().getCurrentSession();
    //JNDI Lookup
    //session = HUtil.getSessionFactory().openSession();
    Query query = session.createQuery("from Persona where
    username = ?");
    query.setString(0, userName);
    persona = (Persona) query.uniqueResult();
    query = session.createQuery("from Festival where id = ?");
    query.setInteger(0, idFestival);
    festival = (Festival) query.uniqueResult();
    if (persona != null && festival != null) {
    query = session.createQuery("from Inscripcion where
    inscribeA = :persona " +
    "AND inscriptosEn = :festival");
    query.setParameter("persona", persona);
    query.setParameter("festival", festival);
    inscripcion = (Inscripcion) query.uniqueResult();
    return inscripcion;
    } catch (Exception e) {
    e.printStackTrace();
    throw e;
    } finally {
    tx.commit();
    //session.close();
    thanks

    The scenario you described is typical ... "If a client calls m1" ... there are 2 cases:
    (1) the client is already in a trans
    (2) not (1)
    Let (1). This is the case of a Client Controlled Transaction ... etc ... when s1 is called it begins a transaction in the client transactional context ... hence s1 can't call a kind of roolback but can force the rollback of the global transaction marking EJBContext.setRollbackOnly() ... s2 uses the same transactional context ... anayway the client is the only one that can commit. This happens because of "transaction required" as the transaction attribute, that in this case forces a flat transaction model. Different is the case if you uses "requiredNew" --> nested trans model ...
    (2) is the same of (1) except that the trans starts at application tier.
    "I still have one doubt. Wouldn't the stateless session bean loose the transaction context once I exit the second stateles session bean's method? Isn't that what stateless means? "
    No:
    stateless doesn't stay for the transaction context but for the conversational state with the client ... that is serializable ... it makes the beans more poolable ... that the stateful session bean has
    bye

Maybe you are looking for

  • Can you open more than one ER file at a time?

    I was wondering if you can open more than one file at a time in ER? I attempted it, however, it does not appear that I can do that like other Adobe products.  (If not, it would be  nice to have the ability of working, or opening more than one file at

  • IDOC to EDI scenario

    Dear All, need your help on how to configure and deploy a scenario for a IDOC to EDI (856)  .  I believe this is like "IDoc to X12 - > X12 to EDI" using AS2 adapter.  BASIS has configured the B2B addon installation and I am not sure about the EDI par

  • Making a PDF Form secure for emailing

    I have created an enrollment form with LiveCyle.  The employer will send the application to a new employee for them to fill out and they would like it emailed back to them.  I tried the submit button but that doesn't work because while the informatio

  • Error while running DI post inst template in CRM 2007

    Hi all, I am running DI post installation template in my CRM system.I am getting the below error at the 8th step. Element 'SAPConfigLib.CR7.Unclassified.addUserToGroup':!BrokerImport.import_of_element_failed!!BrokerImport.Fehler!com.sap.tc.lm.ctc.cul

  • Why does Creator changes Component ID in Page Fragment?

    When you embed a page fragment in a page, the component ID changes to: form1.Page.PageFragment.componentIDThe problem is that I have some JavaScript functions in my page fragment and I am re-using the page fragment across many pages. This causes my J