Results 1 to 3 of 3

Thread: Using TransactionCallback

  1. #1

    Default Using TransactionCallback

    Hello,

    I am new to this forum and I am sure my question may have been answered already.
    My search did not yield any results. Hence this post.

    I have a code as follows -

    public void insertCustomer(CustomerVO customerVO) {
    transactionTemplate.execute(new TransactionCallback(){
    public Object doInTransaction(TransactionStatus arg0) {
    customerDAO.insertCustomer(customerVO); // syntax error here
    return null; // I don't want to return null. Just a place holder
    }
    });
    }

    The code is syntactically not correct. The customerVO object cannot be referenced like this.
    However this is exactly what I want to achieve. I want to be able to pass objects inside the
    doInTransaction() method.

    Any best way of achieving this?

    I would appreciate any pointers on this.

    Thanks,

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    Any best way of achieving this?
    Make customerVO final E.g.
    public void insertCustomer(final CustomerVO customerVO) {

  3. #3

    Default

    Thanks a ton katentim.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •