view spring-boot-playground/src/main/java/de/comline/spring/service/MovieService.java @ 4:92d52e4ac567

JPA hinzugefuegt.
author Dirk Olmes <dirk.olmes@codedo.de>
date Thu, 13 Aug 2020 15:31:38 +0200
parents
children d57d0c6a841b
line wrap: on
line source

package de.comline.spring.service;

import javax.transaction.Transactional;

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

import de.comline.spring.entity.Movie;
import de.comline.spring.repository.MovieRepository;

@Service
public class MovieService {
	@Autowired
	private MovieRepository repository;
	
	@Transactional
	public Movie createMovie(String title) {
		Movie movie = new Movie(title);
		movie = repository.save(movie);
		return movie;
	}
}