Single transaction through multiple service objects [Spring]

Hello.
I have multiple service objects, while methods in service objects represent use cases.
If I call the method from the other method in the same service object, then the second (called) method uses the same transaction as the first (caller), because of default propagation REQUIRED is applied.
.. as is shown in the following pseudo code:
@Transactional
public class PersonService {
     private PersonDAO personDAO;
     public void otherMethod() {
     public void savePerson(Person person) {
          otherMethod();
          personDAO.save(person);
}But I need to call service methods of different service objects, because some use cases use other use cases. I also need all those called methods to be done as a single transaction.
@Transactional
public class OrderService {
     private OrderDAO orderDAO;
     public void saveOrder(Person person, Order order) {
          PersonService personService = CONTEXT.getBean("personService");
          personService.savePerson(person);
          orderDAO.save(order);
}If I do it like that, the new transaction proxy is created and all personService stuff is executed in the new transaction. How to configure @Transactional annotated objects or Spring beans to do all service stuff in single transaction?
I have Hibernate sessionfactory, DAOs and services beans simply configured in Spring configuration XML, using autowiring and transaction annotation config. I prefer using @transactional annotated service classes, but if I had to use more complex Spring transaction configuration to achieve the goal I won't have any problem with it.
Thank you in advance.

I would like it to be done is single transaction but it isn't. As the bean is retrieved from the spring context in OrderService's method
PersonService personService = CONTEXT.getBean("personService");a new transaction for PersonService is started. So then I have two transactions in progress - one for OrderService and second for PersonService. I need the PersonService (or any other service object) to detect already pending transaction and use that. Not create new (it's own). I use no arguments in @Transactional annotation so default propagation REQUIRED should be used, but it still creates a new transaction for PersonService stuff.
I'm posting my applicationContext.xml (simplified slightly)
<beans default-autowire="byType">
     <bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
     </bean>
     <!-- Hibernate SessionFactory -->
     <bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
          <property name="dataSource">
               <ref local="dataSource" />
          </property>
     </bean>
     <bean id="hibernateTxManager"
          class="org.springframework.orm.hibernate3.HibernateTransactionManager">
          <property name="sessionFactory">
               <ref local="sessionFactory" />
          </property>
     </bean>
     <tx:annotation-driven transaction-manager="hibernateTxManager" />
     <!-- DAOs -->
     <bean id="personDAO" class="net.package.dao.PersonDAO" />
     <bean id="orderDAO" class="net.package.dao.OrderDAO" />
     <!-- Services -->
     <bean id="personService" class="net.package.service.PersonService" />
     <bean id="orderService" class="net.package.service.OrderService" />
</beans>Thank you

Similar Messages

  • Single Payment through multiple banks/accounts for multiple vendor invoices

    Hi,
    In R12, is there a way to pay through different Bank Accounts for different supplier invoices in a single go?
    I assume, we can do so by creating a PPR, and then assigning payer bank account for each invoice before creating payment instruction.
    However, we are looking for a single template setup which can have multiple bank accounts tied to different Pay Groups, and based on invoice pay groups the system automatically selects he bank accounts while creating the payment file.
    E.g. We have Inv01 in OU1 with Currency USD, Paygroup USD_PAY, Inv02 in OU1 with Currency EUR paygroup EUR_PAY, Inv03 in OU2 currency USD paygroup USD_PAY & Inv04 in OU2 currency EUR paygroup EUR_PAY. We have seperate Bank Accounts for each currency say EUR_BANK, USD_BANK
    Can we create a single template such that for paygroup USD_PAY, bank account USD_BANK can be set up and for paygroup EUR_PAY, EUR_BANK can be setup, so that when we create payment file, we can have them created simultaneously for USD_BANK (Inv01 & Inv03) & for EUR_BANK (Inv02 & Inv04)
    Appreciate if someone can share their experience/thoughts
    Ashutosh

    Hi,
    have a look at this thread:
    Vendor with Multiple Bank Account in MIRO
    Best regards.

  • Split single transaction into multiple PDFs

    I have a single XML file that contains a form that overflows multiple times. I want each form to be treated as a separate transaction (i.e. I want each form to generate a separate pdf).
    From the FSISYS:
    < ExtractKeyField >
    SearchMask = 1,<Wrapper
    I want each of these Address Changes to result in a separate PDF.
    <Wrapper>
    <ProducerConfirmations beginTime="0001-01-01T00:00:00" endTime="0001-01-01T00:00:00" emailChange="true" nyFlag="NA">
    <AddressChange previousAddressId="ResidentAddr_Old" addressId="ResidentAddr" mode="email" responsys="e0740ace1f534391b464b03707874636" addressType="Residential" />
    <AddressChange previousAddressId="BusAddr1_Old" addressId="BusAddr1" mode="email" responsys="e0740ace1f534391b464b03707874636" addressType="BusinessAddress1" />
    <AddressChange previousAddressId="BusAddr2_Old" addressId="BusAddr2" mode="email" responsys="e0740ace1f534391b464b03707874636" addressType="BusinessAddress2" />
    <AddressChange previousAddressId="BusAddr3_Old" addressId="BusAddr3" mode="email" responsys="e0740ace1f534391b464b03707874636" addressType="BusinessAddress3" />
    <AddressChange previousAddressId="BusAddr4_Old" addressId="BusAddr4" mode="email" responsys="e0740ace1f534391b464b03707874636" addressType="BusinessAddress4" />
    </ProducerConfirmations>
    </Wraper>
    Any way I can force the PDF print driver to produce each page as a separate file?
    Muchas gracias,
    Dave

    You'd need to use class recipients and make this node the address field. There is not an other way to split at the transaction level.

  • Can you propagate a transaction through multiple DBs of different vendors?

    I want to do some inserts/updates/deletes from my Oracle DB. Some of them are in my DB, others are in another Oracle DB in another machine, some are happening in a MS SQL Server in a another machine, some in a DB2 which is residing in another country. Everything should work as ONE Txn.
    Can we do this using the Oracle DB? Is there a built-in Oracle supplied pkg for this?
    i.e. We assume we are using an Oracle SP for this.

    Channa wrote:
    I want to do some inserts/updates/deletes from my Oracle DB. Some of them are in my DB, others are in another Oracle DB in another machine, some are happening in a MS SQL Server in a another machine, some in a DB2 which is residing in another country. Everything should work as ONE Txn.
    Can we do this using the Oracle DB? Is there a built-in Oracle supplied pkg for this?How can you even call this as ONE Transaction when you want to do parts of it in one machine running MySql , another in another machine running Oracle?
    i.e. We assume we are using an Oracle SP for this.What is oracle SP ?
    Aman....

  • Capture and post in single transaction J1IEX

    Hello
    Business requirement is that:
    Business do not want to give any excise related activity to stores persons. So i,e the reason they will do the GR with Ref to Purchase order with Option "NO excise entry" in MIGO.
    Now they want to make the Capture and Post in single transaction through J1IEX. If we select J1IEX with ref to GR then system will generates the Internal number, but it will not update J_1IPART1 and J_1IPARt2.
    How to Capture and post in single step?m means how to update J_1IPART1 and J_1IPART2
    Regards
    sapman man

    HI,
    Remove the authorization of J1IEX transaction from the Stores Id.
    SPRO--> Logistic general --> tax on goods and movement --> india -->basic  settings --> maintain excise group.
    Select the appropriate excise group in combination of your plant.
    Click on the details (ctrl +Shift + F2), In the MIGO Setting Block, there are options like EI Capture, Post EI in MIGO.
    untick this option and save it.
    After that you will not get excise option in MIGO Screen and you can have your control as per below mentioned steps.
    1. CVD (commercial invoice) Booking is done by finance.
    2. GRN Booking -- Stores Incharge
        Select the option 'No excise entry' while making GRN or disable this functionality from SPRO.
    3. Capture the excise invoice using J1IEX -- Done by Finance
    4. Post the Excise Invoice using J1IEX -- Done by finance.
    regards,
    S Anand

  • Single Workflow to trigger from multiple business objects

    Can a single workflow be triggered for multiple business objects. We already have a workflow which triggers when there is error in the document. Can we use same workflow for other objects (Opportunity, lead etc..) or do we have to create separate workflows for each objects?

    Yes you check.Check the business object by passing test data in the function module.
    check with import and export parameters and check with the business object with the transaction
    after testing of business object check the status at transaction swel for event trace.
    Multiple Events & Triggering of Workflow
    Thanks,
    AMS

  • Entering multiple scrap accounts in a single transaction

    Hi guys
    Can I enter multiple scrap accounts in OSFM transactions in a single form?
    I hope oracle offers only single a/c for each step.
    This will minimize the data entry effort for me.
    Please suggest any work arounds.
    Regards
    Sreee

    Hello Sebastien,
    Thanks for your response!!!
    Let me make it bit more clear.In deploymewnt descriptor,we define jndi name for any resource and do a lookup on that resource from the code.
    Let us consider that resource as JDBC data source for our discussion.usually you define any jdbc data source under a JDBC resource provider.
    So my question is,in a single transaction can you access multiple data sources defines under multiple JDBC resource providers.
    Ex:A datasource "x "defined under resource provider "A"[say DB2 jbdc provider] and a datasource "y" defined under respurce provider "B"[say mysql jdbc provider].
    Thanks

  • Multiple db2 instances with informix in a single transaction

    Hi All,
    Can somebody tell how this can be achieved.
    I do have 3 db2 instances in three physical mahines. Within a transaction I will
    only be writing to a one instance but will be retieving data from the other two
    instances. In the same transaction I will be writing to a Informix database as
    well. All the systems are on windows.
    The application server is Weblogic 7.02.
    For DB2 the driver is db2jcc driver which does not support XA transactions. And
    for informix we do use the driver which comes along with the informix installation
    which is a XA supported driver.
    We do have seperate TXDatasources created in the Web logic server and EJBs are
    used in the project.
    As welogic can give the XA features only for one none XA driver. How about implementing
    the above scenario.
    Waiting for a early response.

    Hello Sebastien,
    Thanks for your response!!!
    Let me make it bit more clear.In deploymewnt descriptor,we define jndi name for any resource and do a lookup on that resource from the code.
    Let us consider that resource as JDBC data source for our discussion.usually you define any jdbc data source under a JDBC resource provider.
    So my question is,in a single transaction can you access multiple data sources defines under multiple JDBC resource providers.
    Ex:A datasource "x "defined under resource provider "A"[say DB2 jbdc provider] and a datasource "y" defined under respurce provider "B"[say mysql jdbc provider].
    Thanks

  • Multiple Database access in a single transaction

    Hello All,
    I have read in a book which states that "according to J2ee Specification,a single transaction(an EJB method for example) may not be provided access to multiple JDBC resource providers.."
    Does it mean that i cannot access multiple databases from different vendors in a single EJB transaction??
    Any help is very much appreciated
    Thanks

    Hello Sebastien,
    Thanks for your response!!!
    Let me make it bit more clear.In deploymewnt descriptor,we define jndi name for any resource and do a lookup on that resource from the code.
    Let us consider that resource as JDBC data source for our discussion.usually you define any jdbc data source under a JDBC resource provider.
    So my question is,in a single transaction can you access multiple data sources defines under multiple JDBC resource providers.
    Ex:A datasource "x "defined under resource provider "A"[say DB2 jbdc provider] and a datasource "y" defined under respurce provider "B"[say mysql jdbc provider].
    Thanks

  • Multiple records for a single transaction - Issue in LSMW

    Hi,
    i'm facing a issue in LSMW
    i have the data coming up in the flat file. the data which constitutes the single transaction consists of  data from multiple records from the flat file..
    suppose we have 10 records in the flat file... and all the 10 records related to ony  2 transactions i.e say 6 records to first transaction and next 4 records to next transaction.
    we have a direct input method to handle this data like field1 for first record, field2 for 2nd record and so on...
    while uploading, we will get all the records one by one into our source structure. My question is can we handle this scenario in lsmw? if yes, pls suggest
    Thanks in advance
    Shekhar

    Hi Kris,
    this is regarding the asset creation via AS01..
    we are getting the flat file in that way. Lets assume like this:
    suppose for one transaction we may need to fill 5 depreciation keys and for another option only 3 dep. keys we need to fill.
    then in the flat file, we can get like 5 records for first transaction i.e asset and 3 records for 2nd transaction
    Can we handle this via lsmw
    Regards
    shekhar

  • Multiple records as a single transaction in JDBC Receiver Adapter

    Hi,
    I am sending multiple records in a single message to a JDBC receiver adapter to get updated to the database. How to make all the insert a single transaction. Like all the records has to be inserted else all has to be rolled back.
    For eg for table Employee two fields EMPNO and EMPNAME
    EMPNO  EMPNAME
    1            Jay
    2            Christie
    These two records are in the same message and has to be updated
    if one fails the other has to be rolled back.
    How can i achieve it using a JDBC Receiver Adapter.
    Thanks
    Sebin

    Hi Rolf Micus,
    My xml structure to insert 2 tables are as follow:-
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_PODB xmlns:ns0="http://abeam.com/xi/fer_filejdbc_scenarios1">
    ..   <STATEMENT_HEADER>
    ....      <ROW action="INSERT">
    ......         <TABLE>ZPO_HEADER</TABLE>
    ......        <access>
    ........            <PONUMBER>001</PONUMBER>
    ........            <PODATE>20070801</PODATE>
    ........            <POAMOUNT>200.99</POAMOUNT>
    ....         </access>
    ....      </ROW>
    ..   </STATEMENT_HEADER>
    ..   <STATEMENT_DETAIL>
    ....      <ROW action="INSERT">
    ......         <TABLE>ZPODETAIL</TABLE>
    ......         <access>
    ........            <PONUMBER>001</PONUMBER>
    ........            <PONO>1</PONO>
    ........            <POITEMCODE>A12345</POITEMCODE>
    ........            <POITEMDESC>Testing A</POITEMDESC>
    ........            <POITEMAMOUNT>2990.00</POITEMAMOUNT>
    ........            <POITEMQTY>55</POITEMQTY>
    ......         </access>
    ....      </ROW>
    ..   </STATEMENT_DETAIL>
    </ns0:MT_PODB>
    Fro the structure that you have declared..there is only contained 1 statement, try to admend your MT to have 2 statements.
    If you wish to insert multiple records, just create a loop/multiple of access tag inside STATEMENT tag. For example, multiple records insert into Header should have multiple access tag in Header STATEMENT. Same goes for muliple records insert into Details STATEMENT should have multiple access tag in Details STATEMENT.
    With this structure, whenever any records insert/update/delete failed...it will rollback all the transactions together, ie. Header and Details.
    PS: For different table, please create different STATEMENT.
    Hope it helps.
    Message was edited by: Pua Ming Fei

  • Configuring multiple services in a single instance database

    Dear All,
    I would like to create multiple service names for a single instance oracle database (10.2.0.3 on IBM - AIX 6.1). I tried searching on the net, reading documentation, and also on the metalink but couldn't find anything relevant to single instance database.
    Say I have two users, userA and userB, for which I would like to use two services (ServA and ServB) to connect to the same single instance database.
    Any help in this direction is appreciated.
    Regards

    Oracle Lover3 wrote:
    Thanks for your quick solution.
    By the time you answered I was able to locate it in the documentation. I have tested it and its working perfectly. Here's the documenation link.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams188.htm#i1133481
    It is very hard to believe you didn't find this in the documentation, and my suspicion is you didn't search for it at all.It is very hard to believe that you don't trust others and end up in suspicion. I wish you were sitting next to me while I was searching for the link/document.It is because the vast majority of doc questions are asked by people who don't read the docs at all.
    Now, I'm curious about your requirement. While it can be done, it is pretty unusual. That always leads me to want to step back from the technical question and ask What business problem is this solving?

  • Is there a Tool or function (in Illustrator or InDesign) that selects any shape and "punches" a "hole" of that shape all the way down through multiple objects to the paper or artboard?

    Is there a Tool or function (in Illustrator or InDesign) that selects any shape and “punches” a “hole” of that shape all the way down through multiple objects to the paper or artboard?

    In Illustrator, group the objects that you want to punch through, and use the transparency pallet.

  • How to uploade multiple flatfiles for single transaction using BDC?

    How to uploade multiple flatfiles for single transaction using BDC?

    Hi,
    You need to upload all data files into an internal table first either using OPEN DATASET (application server files) or GUI_UPLOAD (PC files).
    Then loop at the internal table and call BDC transaction to process the data.
    Regards,
    Ferry Lianto

  • Does a single transaction, spreeds accross multiple rollback segments?

    Hi,
    Does a single transaction, spreeds accross multiple rollback segments?
    What if , there is not enough space in the allocated rollback segment?
    Thanks
    Naveen.

    With the additional note/ caveat that, assuming you're using a moderately recent version of Oracle and using automatic UNDO management, which you really, really ought to be doing, Oracle is constantly adding, removing, and expanding the rollback segments, making it all but impossible for a rollback segment to be too small unless it (along with all the other active redo segments) exceed the size of your UNDO tablespace.
    Justin

Maybe you are looking for

  • My web pages text is blurry some letters are faint how can I fix this

    the text on my web pages has some faint letters in the words and others there is only half the letter appearing. I have tried view, zoom, reset. helps on some but not on the rest of page. I have reloaded firefox to no avail. I have cleared all settin

  • JMS Bridge not Working

    Hi, I have a weblogic 9.2 running one application. I what that application to post messages on a internal JMS queue. That message gets fw to a Weblogic 8 JMS queue. To achieve this I created a JMS Bridge with the Weblogic 8 destination, and the Weblo

  • All my B/G job canceling due to dump: TSV_TNEW_PAGE_ALLOC_FAILED

    Hi SAP Gurus, Production system SAP R/3 Enterprice. 4.7 OS:AIX 5.3 DB:DB2 memory Parameters are already set properly, there was no issues from past 3 years, We din't change any parameter recently. All my Pay run B/G job canceling due to dump: TSV_TNE

  • How to install plugin indesign sdk? [Help]

    hello I am looking for information on how to make a plugin for InDesign. if someone could help me or passing information on how to install the sdk and information about how to program indesign plugin. sorry for my English. salutations and thanks

  • The latest version of Itunes keeps on locking up and is awfully slow!!

    Has anyone experienced Itunes being very slow and continually locking/not responding? Admittedly I have 60.000 songs on it, but nevertheless it is dire - 11.1.2.31