Configuring the Transaction Manager

I'm currently trying to use Hibernate in OC4J and it works okay. However I've been told I can bind the Hibernate Transaction Manager to a JNDI name in the application server but cannot find any info on how.
I also want to bind the HibernateSessionFactory to a JNDI name.
Regards,
Anthony

Configuring for JNDI is even easier. Simply add this line to your hibernate.cfg.xml
<property name="hibernate.session_factory_name">java:hibernate/HibernateFactory</property>
Then implement the getSessionFactory() method of whatever factory class you're using like so:
public static SessionFactory getSessionFactory()
SessionFactory sessions = null;
try {
Context ctx = new InitialContext();
String jndiName = "java:hibernate/HibernateFactory";
sessions = (SessionFactory)ctx.lookup(jndiName);
} catch (NamingException ex) {
throw new InfrastructureException(ex);
return sessions;

Similar Messages

  • Configuration for Transaction Management

              Hi,
              I am working with Weblogic Server SP1. I am facing a problem in configuring for
              Transaction Management.
              I have a session EJB say SEJB and two entity EJB say EEJB1 and EEJB2. EEJB1 is
              for the parent table
              and EEJB2 is for the child table.
              I have two records in the database REC1 and REC2.
              REC2 has dependencies and cannot be deleted, while REC1 can be deleted.
              In weblogic-ejb-jar.xml I have configured as follows:
              <weblogic-enterprise-bean>
              <ejb-name>SEJB</ejb-name>
              <stateless-session-descriptor>
              <pool>
              <max-beans-in-free-pool>300</max-beans-in-free-pool>
              <initial-beans-in-free-pool>150</initial-beans-in-free-pool>
              </pool>
              </stateless-session-descriptor>
              <reference-descriptor>
                   <ejb-reference-description>
                   <ejb-ref-name>EEJB</ejb-ref-name>
                   <jndi-name>EEJBean</jndi-name>
                   </ejb-reference-description>
                   </reference-descriptor>
              <jndi-name>SEJBn</jndi-name>
              </weblogic-enterprise-bean>
              Further, in ejb-jar.xml I have set up the <trans-attribute> as RequiresNew for
              Session Bean while Supports
              for the EEJB. Something like this:...
              <container-transaction>
              <method>
              <ejb-name>SEJB</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>*</method-name>
              </method>
              <trans-attribute>RequiresNew</trans-attribute>
              </container-transaction>
              In spite of this setting, when, through the client, I am selecting the two records
              REC1 and REC2 at the same
              time and deleting them, REC1 gets deleted while REC2 does not and gives a TransactionRollbackException.
              Ideally, since both are part of a single transaction, both should have been rolled
              back.
              Please suggest if I am missing on some kind of configuration parameter or setting.
              I'll be more than
              happy to provide some more details to get the problem solved.
              I can also be reached at [email protected]
              Thanks in advance,
              Regards,
              Rishi
              

    TCode: SWF5
    Enterprise_Extensions:
    -> EA-FS
    Enterprise_Business_Functions:
    -> FIN_TRM*
    Rg
    Lorenz

  • How to Configure the Eterprise Manager in sun solaris

    Hi
    Please help me In configuring the enterprise manager
    my environment :
    2 node RAC in SUN Solaris 9
    database :Oracle 10.1.4.0
    if any body have documents regarding configuring(order wise steps) for configuring Enterprise Manager

    The Oracle docs should help (Oracle® Enterprise Manager Advanced Configuration).

  • How to configuring the download manager

    RE: Firefox v22.0 | Linux Mint 15 Cinnamon v1.8 (32bit)
    How can I configure the download manager to intercept "EVERYTHING" regarding the updates to the addons and plugins? I want to intercept everything and determine myself where I want the stuff to be saved. As for the addons/plugins (generally ".xpi"), I want to save them to a specific location and then I can install them into Firefox after the download(s) is/are complete. I already have the option "Always ask me where to save files" selected but any addons/plugins that are added or updated are not affected by this selected option. Instead, they are updated/added ... more or less ... with my saving them to a specific location other than in Firefox.

    Firefox will not detect .xpi (addons/extentions) using the Firefox download manager to save the .xpi's. Instead Firefox is downloading the .xpi and then asking to install them or not. I already have the option "always ask where to save files" checked. As for downloading manually, nope! If using FIrefox browser, you cannot download manually and expect to save them to a different location. It appears that, at present, I will either accept the current download manager (Firefox) as is or will have to use a 3rd party download manager; either application or addon. I am looking at the Firefox addon "Download Them All (dTa)" to use for a download manager and thus bypassing the Firefox default download manager. Anyway, thanks for the responses.

  • How to configure the document management

    Hi all,
    I am new to document management system. My request is about how can we configure the document management system in our sap system, actually we are not using sap for storage of documents.
    Is there some way, so that we can attached documents in the system and put some attributes with them so as to retrieve and search purpose.
    Please guide.
    Thanks and Regards

    Hai,
    See this link, it would help you
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/04/92718846f311d189470000e829fbbd/frameset.htm
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/2d/3527f6448c11d189420000e829fbbd/frameset.htm
    Regards,
    KK

  • Cleanup the Transaction Manager?

    How do you clean out the records in the Transaction Manager?
    Thanks,
    Chuck

    Hi,
    Please refere SAP MII Help to delete records from transaction manager.
    [SAP MII 12.1 Help|http://help.sap.com/saphelp_mii121/helpdata/en/43/e80b59ad40719ae10000000a1553f6/frameset.htm]
    To delete transactions from the table, do the following:
      a.      Select the checkbox next to the transactions you want to delete from the table.
      b.      Click Delete.
    The system removes the transactions from the Transaction Manager screen, but the transaction records still exist in the system.
    Hope this help!!!
    Regards,
    Manoj Bilthare

  • Configuring the UWL Manage Substitution Rules

    Hi,
    I have a need to be able to add at least one more additional columns/fields to the ‘Manage Substitute Rules/My Substitute Rules’, ‘Search For People/Current Selection’ and the General Data screens of the UWL Manage Substitutions Rules.
    Is this a configurable feature/option in that can I add extra fields to the different fields?
    The reason for this requirement is that my current client is implementing SAP’s Concurrent Employment in their ECC 6 and SRM 5.0 systems. This decision is causing all sorts of challenges.
    If a person wants to define a substitute in the UWL, when they select the ‘Search For People’, we want to display an additional column that displays the position/job description for each person within the organization. This would make it easier to select the correct instance of a person if that person had multiple display entries in the selection list. For example if the system returns Joe Cole – Soccer Player; Joe Cole – Librarian and Joe Cole – Accountant and the person wanted to select Joe Cole – Librarian, they would have the required information to make the selection.
    Thanks,
    Jerry

    Hi Jerry,
    May be this link can help you...
    <i>http://help.sap.com/saphelp_nw2004s/helpdata/en/0b/1fc20097b74c41b38621ec2a9454bb/frameset.htm</i>
    Please ignore this reply if this link doesnt help you.
    Regards,
    <i><b>Raja Sekhar</b></i>

  • How to configure the SOA MANAGER

    Hi,
    I having WAS 7.0,  I created a service provider,for cosuming the service Im using SOAMANAGER transaction,
    but the transaction doesnt exist in system.Please tell me how to configure the SOAMANAGER or there is other
    way to consume the web ser servicr with out SOAMANAGER.
    Regards,
    Brahmaji

    Hi,
    If you want to consume a webservice. If you have the WSDL document. Then you dont need to config anything in SOAMANAGER.
    All you have to do is. Go to  SE80 select a package in the enterprise section you have create a new service consumer.
    which eventually will create the Client proxy in which you see a class and methods created automatically for you.
    After this you have to go to LPCONFIG where you have to create a port for created service. There you have give the PROXY class that just got created give a new logical port name.Once you are in then you have to give the URL that is specific mentioned in WSDL document.In the operations section you have give the SOAP action which is also mentioned in WSDL document.
    Then in SE80 you can run the service with newly created port.

  • How to configure the transaction OKB9

    i would like to configure the system so that a user can execute the
    transaction OKB9 and make changes to the entries without create a changerequest.
    I found the sap note 135028, please could you tell me if i can apply it
    to my system to solve the issue?
    Best Regards.
    Gianluca Vinco

    nothing about pb
    Edited by: Gianluca Vinco on May 26, 2008 4:04 PM

  • How to configure the work manager java code to eclipse?

    Hello all,
                   I am working with the syclo work manager app. I have successfully installed all components required.
                   I imported the work manager mobile application and I want to import the standard work manager java code, what is the process to import java code into work space.
                   Guide me with some screen shots.
                   When I try to start the WM server it is giving me the following error:
    How to resolve the error.
    Please anyone provide me complete setup needed to run the work manager app smoothly.
    Please guide me.
    Thanks & Regards,
    Swaroopa.

    Swaroopa,
    That error is telling you the SAP JCo library cannot find one of the needed DLLs on the system.  The sapjco.jar loads two additional DLL files (sapjcorfc.dll and librfc32.dll).  Both should be installed by default into your ServerDev directory (assuming you are running Agentry 6.0.x).
    I would guess it is having trouble loading the librfc32.dll based on the message but confirm both are in the correct location.
    --Bill

  • Early on while configuring the Device Management settings in Profile Manager (Mavericks server) I received an error code -1

    When I started up the Server application, Profile Manager was not selected as expected.  I selected it and started the first step of configuring Device Management in the Settings section.  I entered the organization information and went on to the next step which was to Configure an SSL Certificate
    I selected a "Self Signed" Cert.  Which was the only one of the two choices that made sense.  The other being the, com.deploystudio.server - Self signed
    Hit next and it processed the info and went to "Finish"  I click "Finish" and this is what I get when the setting are confirmed.
    I stopped there since I suspect this error will probably come back to haunt me further down the line as if you recall we could not get the Profile to install due to the invalid cert which I suspect has something to do with this code -1 error at the get go.  I ran the one command line instruction twice to verify this was not a quirk and the same occurred.
    sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB.sh

    Did you ever get this resolved? This error is usually related to DNS, hostname, or Open Directory configuration. Let me know if you still need help.

  • Coherence and EclipseLink - JTA Transaction Manager - slow response times

    A colleague and I are updating a transactional web service to use Coherence as an underlying L2 cache. The application has the following characteristics:
    Java 1.7
    Using Spring Framework 4.0.5
    EclipseLink 12.1.2
    TopLink grid 12.1.2
    Coherence 12.1.2
    javax.persistence 12.1.2
    The application is split, with a GAR in a WebLogic environment and the actual web service application deployed into IBM WebSphere 8.5.
    When we execute a GET from the server for a decently sized piece of data, the response time is roughly 20-25 seconds. From looking into DynaTrace, it appears that we're hitting a brick wall at the "calculateChanges" method within EclipseLink. Looking further, we appear to be having issues with the transaction manager but we're not sure what. If we have a local resource transaction manager, the response time is roughly 500 milliseconds for the exact same request. When the JTA transaction manager is involved, it's 20-25 seconds.
    Is there a recommendation on how to configure the transaction manager when incorporating Coherence into a web service application of this type?

    Hi Volker/Markus,
    Thanks a lot for the response.
    Yeah Volker, you are absolutely right. the 10-12 seconds happens when we have not used the transaction for several minutes...Looks like the transactions are moved away from the SAP buffer or something, in a very short time.
    and yes, the ABAP WP's are running in Pool 2 (*BASE) and the the JAVA server, I have set up in another memory pool of 7 GB's.
    I would say the performance of the JAVA part is much better than the ABAP part.
    Should I just remove the ABAP part of the SOLMAN from memory pool 2 and assign the JAVA/ABAP a separate huge memory pool  of say like 12-13 GB's.
    Will that likely to improve my performance??
    No, I have not deactivated RSDB_TDB in TCOLL from daily twice to weekly once on all systems on this box. It is running daily twice right now.
    Should I change it to weekly once on all the systems on this box?  How is that going to help me?? The only thinng I can think of is that it will save me some CPU utilization, as considerable CPU resources are needed for this program to run.
    But my CPU utilization is anyway only like 30 % average. Its a i570 hardware and right now running 5 CPU's.
    So you still think I should deactivate this job from daily twice to weekly once on all systems on this box??
    Markus, Did you open up any messages with SAP on this issue.?
    I remember working on the 3.2 version of soultion manager on change management and the response times very much better than this as compared to 4.0.
    Let me know guys and once again..thanks a lot for your help and valuable input.
    Abhi

  • Does transaction manager also releases the connections ?

    Hi All,
    I've a doubt regarding release of connection in transaction handling scenarios in EJB.
    Let us assume I have an EJB method associated with a transaction attribute as Requires New (i.e. the ejb method is associated with container managed transaction).
    Within that method two diffreent databasess are accessed, connections are created, databases are updated but connections are not realeased.
    The code goes similar to the one given below -
    public void beanMethod1()
    InitialContext cntx = new InitialContext();
    javax.sql.DataSource ds1 = cntx.lookup("dataSourceName1");
    javax.sql.DataSource ds2 = cntx.lookup("dataSourceName2");
    java.sql.Connection conn1 = ds1.getConnection();
    ds1.setAutoCommit(false);
    PreparedStatement pst1 = ds1.prepareStatement("Qyery1");
    pst1.executeUpdate();
    java.sql.Connection conn2 = ds2.getConnection();
    ds2.setAutoCommit(false);
    PreparedStatement pst2 = ds2.prepareStatement("Qyery2");
    pst2.executeUpdate();
    Now in this context my doubt is - will the transaction manager, along with handling commit/rollback, release the connections also (once commit/rollback is over) ? Or releasing of connections need to be handled in the bean method ?
    If releasing connections has to be handled in the bean method, then how does transaction manager execute a commit/rollback on a released connection ?
    The same doubt can be extended to bean managed transaction also where transaction boundarry is demarcated using javax.transaction.UserTransaction object's begin(), commit() and rollback() methods.
    It will be a real help if anyone please throw some light on this doubt.
    Thanks in advance,
    Sourav

    Hi,
    Your code needs to release (i.e., close) the connections it uses; this is outside the TM responsibility scope.
    The commit or rollback is not a problem, because the corresponding XAResource (which is the
    transaction manager's handle to your connection) can be used even after your connection
    has been closed in the application code. That is the catch about XA, and it allows the whole
    mechanism of connection pooling and DataSources to work properly.
    Hope that helps,
    Guy

  • Configuration of Incident Management in CRM IC Web Client

    Hi,
      Can anyone give me the procedure for configuring the incident management in IC Web UI and what are the pre-req for configuration
    Thanks,

    Hi ,
    You can try two things:
    1. Find a standard business role(in tx crmc_ui_profile) that has the links as you need
    2. Create a custom business role by copying from some standard business roles that has all the links you have mentioned and more, then remove unwanted links from the ui profile
    You might need to configure the navigation bar profile using transaction crmc_ui_nblinks.
    Regards,
    Shiromani

  • @TransactionAttribute annotation being ignored by Transaction Manager

    I am currently running jboss-4.0.4GA. I believe I must have something configured incorrectly, or I misunderstand transaction management performed by the container. Though I have my datasource declared as local-tx, which I believe allows transactions, it appears that my a call to a remote function in a stateless session bean is completely executed in one single transaction, regardless of the @TransactionAttribute tags.
    In my example, I call a function with @TransactionAttribute = REQUIRED. This is the OUTER FUNCTION. This function inserts a record into the cust table of our database. Then this function calls a second function with @TransactionAttribute = REQUIRES_NEW. This is the INNER FUNCTION.
    This function should, according to spec, start up a new transaction independant of the first function. However, the INNER function can select the (un-committed) cust record from the OUTER function. The INNER function then proceeds to add a cust record of its own to the database.
    Control then returns to the OUTER function, which can succesfully read the cust record inserted by the INNER function, which is to be expected because the INNER function should have had its transaction committed. However, my program then throws a RuntimeException in order to force a rollback, and this rollback removes both the cust record inserted by the OUTER function and the cust record inserted by the INNER function.
    To further my belief that the transaction manager is ignoring my @TransactionAttribute annotations, I change the TransactionAttributeType of the INNER function to "NEVER". According to spec, the code should throw an exception when this function is called within a managed transaction. However, when I run the code I get the exact same behavior as when the INNER function is "REQUIRES_NEW".
    I would greatly appreciate if anyone has any insight into what I am doing wrong. Thanks!
    Client Program that Invokes TestTransImpl Stateless Session Bean
    public class Client{
         public static void main(String[] args) throws Exception {
              try{               
                   Properties env = new Properties();
                               env.setProperty(Context.SECURITY_PRINCIPAL, "guest");
                               env.setProperty(Context.SECURITY_CREDENTIALS, "guest123");
                               env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
                               env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                               env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
                   InitialContext ctx = new InitialContext(env);
                   TestTransRemote ttr = (TestTransRemote)ctx.lookup("TestTransImpl/remote");
                   ttr.testTransactions();
              }catch(Exception e){
                   e.printStackTrace();
                   throw e;
    }Remote Interface for TestTransImpl Stateless Session Bean
    public interface TestTransRemote extends Serializable {
         public void testTransactions() throws Exception;
    }TestTransImpl Stateless Session Bean
    @Stateless
    @Remote(TestTransRemote.class)
    public class TestTransImpl implements TestTransRemote {
         private static final long serialVersionUID = 1L;
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public void testTransactions() throws Exception{
              java.sql.Connection conn = getConnection();
              java.sql.PreparedStatement ps;
              ps = conn.prepareCall("insert into cust(loc,cust_no) values ('001',20)");
              ps.execute();
              System.out.println("OUTSIDE FUNCTION - Customer 20 created");
              requiredNewFunction();
              ps = conn.prepareCall("Select cust_no from cust where loc = '001' and cust_no = 24");
              java.sql.ResultSet results = ps.executeQuery();
              results.next();     
              System.out.println("OUTSIDE FUNCTION - Customer Read - Cust No = " + results.getLong("cust_no"));
              throw new RuntimeException();
         @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
         private void requiredNewFunction() throws Exception{
              java.sql.Connection conn = getConnection();
              java.sql.PreparedStatement ps;
              ps = conn.prepareCall("Select cust_no from cust where loc = '001' and cust_no = 20");
              java.sql.ResultSet results = ps.executeQuery();
              results.next();     
              System.out.println("INSIDE FUNCTION - Customer Read - Cust No = " + results.getLong("cust_no"));
              ps = conn.prepareCall("insert into cust(loc,cust_no) values ('001',24)");
              ps.execute();
              System.out.println("INSIDE FUNCTION - Customer 24 created");
         private java.sql.Connection getConnection() throws Exception{
              javax.sql.DataSource ds;
              javax.naming.InitialContext ic = new javax.naming.InitialContext();
              ds = (javax.sql.DataSource)ic.lookup("java:MyOracleDS");
              java.sql.Connection conn = ds.getConnection();
              return conn;          
    }Datasource XML File
    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
        <local-tx-datasource>
            <jndi-name>MyOracleDS</jndi-name>
            <connection-url>jdbc:oracle:thin:XXXXX(DB Host):1521:XXXXX(DB Sid)</connection-url>
            <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
            <user-name>XXXXX(username)</user-name>
            <password>XXXXX(password)</password>
            <min-pool-size>5</min-pool-size>
            <max-pool-size>100</max-pool-size>
            <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
            <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
            <metadata>
                <type-mapping>Oracle10g</type-mapping>
            </metadata>
        </local-tx-datasource>
    </datasources>Program Output
    08:43:41,093 INFO  [STDOUT] OUTSIDE FUNCTION - Customer 20 created
    08:43:41,125 INFO  [STDOUT] INSIDE FUNCTION - Customer Read - Cust No = 20
    08:43:41,140 INFO  [STDOUT] INSIDE FUNCTION - Customer 24 created
    08:43:41,140 INFO  [STDOUT] OUTSIDE FUNCTION - Customer Read - Cust No = 24

    All ejb invocation behavior, including authorization, container-managed transactions, etc. only applies when the call is made through one of the appropriate ejb client objects. If
    TestTransImpl.testTransactions() directly invokes requiredNewFunction() it's just a normal java
    method call -- the ejb container has no idea it's happening and is not interposing. If you want
    the full ejb invocation behavior when you invoke requiredNewFunction() you'll need to
    make sure requiredNewFunction is part of a business interface, is public, and is invoked through
    the corresponding ejb reference :
    @Resource private SessionContext ctx;
    public void testTransactions() throws Exception {
    TestTransRemote testTrans = ctx.getBusinessObject(TestTransRemote.class);
    testTrans.requiredNewFunction();
    }

Maybe you are looking for