Package demo.transaction

Source Code of demo.transaction.PersonService

package demo.transaction;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import core.Person;
import core.PersonRepository;

@Service
public class PersonService {

  @Autowired
  private PersonRepository repository;

  @Autowired
  private OtherService other;

  @Transactional
  public void addPeople() {
    this.repository.add(new Person("Larry"));
    this.repository.add(new Person("Curly"));
    this.repository.add(new Person("Moe"));
    other.execute();
  }

}
TOP

Related Classes of demo.transaction.PersonService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.