All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.anteros.nosql.spring.mongodb.service.SpringTransactionalMongoService Maven / Gradle / Ivy

The newest version!
package br.com.anteros.nosql.spring.mongodb.service;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.anteros.nosql.persistence.mongodb.session.service.MongoSimpleService;
import br.com.anteros.nosql.persistence.session.NoSQLSessionFactory;
import br.com.anteros.nosql.persistence.session.query.Example;
import br.com.anteros.nosql.persistence.session.query.Page;
import br.com.anteros.nosql.persistence.session.query.Pageable;
import br.com.anteros.nosql.persistence.session.query.Sort;


@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
public class SpringTransactionalMongoService extends MongoSimpleService{


	@Autowired 
	@Override
	public void setSessionFactory(NoSQLSessionFactory sessionFactory) {
		super.setSessionFactory(sessionFactory);
	}

	
	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public  S save(S entity) throws Exception {
		return super.save(entity);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public  Iterable save(Iterable entities) {
		return super.save(entities);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public Optional findById(ID id) {
		return super.findById(id);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public boolean existsById(ID id) {
		return super.existsById(id);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public Iterable findAll() {
		return super.findAll();
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public Iterable find(String query) {
		return super.find(query);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public Iterable findById(Iterable ids) {
		return super.findById(ids);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public long count() {
		return super.count();
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public void removeById(ID id) {
		super.removeById(id);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public void remove(T entity) {
		super.remove(entity);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public void remove(Iterable entities) {
		super.remove(entities);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public void removeAll() {
		super.removeAll();
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public Iterable findAll(Sort sort) {
		return super.findAll(sort);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public Page findAll(Pageable pageable) {
		return super.findAll(pageable);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public  Optional findOne(Example example) {
		return super.findOne(example);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public  Iterable find(Example example) {
		return super.find(example);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public  Iterable find(Example example, Sort sort) {
		return super.find(example, sort);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public  Page find(Example example, Pageable pageable) {
		return super.find(example, pageable);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public  long count(Example example) {
		return super.count(example);
	}

	@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true)
	@Override
	public  boolean exists(Example example) {
		return super.exists(example);
	}

}