I am beginning with spring data jpa and i have configured all spring app. in which my bootstrap class is
@SpringBootApplication
@ComponentScan("com.ticket.booking")
@EnableJpaRepositories("com.ticket.booking.dao")
@EntityScan("com.ticket.booking.entity")
public class TicketBookingManagementApplication {
public static void main(String[] args) {
SpringApplication.run(TicketBookingManagementApplication.class, args);
}
}
my controller
@RestController
@RequestMapping(value="/api/ticket")
public class TicketController {
@Autowired
private TicketService ticketService;
@GetMapping(value="/")
public String welcome(){
return "Welcome to Ticket Booking Systems";
}
@PostMapping(value="/add")
public Ticket createTicket(@RequestBody Ticket ticket){
return ticketService.createNewTicket(ticket);
}
@GetMapping(value="/get/{ticketId}")
public Ticket getTicket(@PathVariable ("ticketId") Integer ticketId){
return ticketService.getTicketById(ticketId);
}
}
service and repository
@Service
public class TicketService {
@Autowired
private TicketDao ticketDao;
public Ticket createNewTicket(Ticket ticket) {
// TODO Auto-generated method stub
return ticketDao.save(ticket);
}
public Ticket getTicketById(Integer ticketId) {
// TODO Auto-generated method stub
return ticketDao.findOne(ticketId);
}
}
public interface TicketDao extends CrudRepository<Ticket, Integer>{}
in pom.xml i have added
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
It uses mysql-connector-java-5.1.46.jar:5.1.46 and it maps req successfully but while running app i am getting error like
java.sql.SQLException: Unknown system variable 'language'
and exporting schema to database