<file_sep>spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:postgres://bzcpxabopdlmdf:3d6cf<PASSWORD>6@ec2-52-1-20-236.compute-1.amazonaws.com:5432/dfagg9s7tge7ak
spring.datasource.username=bzcpxabopdlmdf
spring.datasource.password=<PASSWORD>
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
<file_sep>package com.rodrigo.bookstore.dtos;

import java.io.Serializable;

import com.rodrigo.bookstore.domain.Livro;

public class LivroDTO implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String titulo;
	private String nomeAutor;
	private String textoLivro;

	public LivroDTO() {
		super();
		// TODO Auto-generated constructor stub
	}

	public LivroDTO(Livro obj) {
		super();
		this.id = obj.getId();
		this.titulo = obj.getTitulo();
		this.nomeAutor = obj.getNomeAutor();
		this.textoLivro = obj.getTextoLivro();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitulo() {
		return titulo;
	}

	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}

	public String getNomeAutor() {
		return nomeAutor;
	}

	public void setNomeAutor(String nomeAutor) {
		this.nomeAutor = nomeAutor;
	}

	public String getTextoLivro() {
		return textoLivro;
	}

	public void setTextoLivro(String textoLivro) {
		this.textoLivro = textoLivro;
	}

}
<file_sep>spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost/BOOKSTORE?createDatabaseIfNotExist=true&serverTimezone=UTC&useSSl=false
spring.datasource.username=root
spring.datasource.password=<PASSWORD>
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
<file_sep>package com.rodrigo.bookstore.resources.exception;

import javax.servlet.ServletRequest;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import com.rodrigo.bookstore.exception.DataIntegrityVioletionException;
import com.rodrigo.bookstore.exception.ObjNotFoundException;

@ControllerAdvice
public class ResourceExceptionHandler {

	@ExceptionHandler(ObjNotFoundException.class)
	public ResponseEntity<StandardError> objNotFoundException(ObjNotFoundException e, ServletRequest request) {
		StandardError error = new StandardError(System.currentTimeMillis(), HttpStatus.NOT_FOUND.value(),
				e.getMessage());
		
		return ResponseEntity.status(HttpStatus.NOT_FOUND).body(error);
	}
	
	@ExceptionHandler(DataIntegrityVioletionException.class)
	public ResponseEntity<StandardError> DataIntegrityVioletionException(DataIntegrityVioletionException e, ServletRequest request) {
		StandardError error = new StandardError(System.currentTimeMillis(), HttpStatus.BAD_REQUEST.value(),
				e.getMessage());
		return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
	}
}
