Skip to content

Instantly share code, notes, and snippets.

@cliffgr
Created August 24, 2017 21:37
Show Gist options
  • Save cliffgr/fc098ebcb04e28abee58b435ec997de3 to your computer and use it in GitHub Desktop.
Save cliffgr/fc098ebcb04e28abee58b435ec997de3 to your computer and use it in GitHub Desktop.
package com.apodeixoulis.Apodeixoulis.controller;
import com.apodeixoulis.Apodeixoulis.model.rating.Place;
import com.apodeixoulis.Apodeixoulis.model.rating.Rate;
import com.apodeixoulis.Apodeixoulis.model.user.UserResponse;
import com.apodeixoulis.Apodeixoulis.service.RateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.Set;
/**
* Created by cliff on 15/8/2017.
*/
@RestController
@RequestMapping(value = "/api/rate")
public class RateController {
@Autowired
private RateService rateService;
@PersistenceContext
private EntityManager entityManager;
@PostMapping(value = "/insertplace")
@Transactional
public void insertUser(@Validated @RequestBody final Rate place) {
entityManager.merge(place);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment