This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .... | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-web</artifactId> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.springframework.cloud</groupId> | |
| <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.eureka.server; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; | |
| @SpringBootApplication | |
| @EnableEurekaServer // Enable eureka server | |
| public class SpringEurekaServerApplication { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Give a name to the eureka server | |
| spring.application.name=eureka-server | |
| # default port for eureka server | |
| server.port=8761 | |
| # eureka by default will register itself as a client. So, we need to set it to false. | |
| # What's a client server? See other microservices (image, gallery, auth, etc). | |
| eureka.client.register-with-eureka=false | |
| eureka.client.fetch-registry=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .... | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-web</artifactId> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.springframework.cloud</groupId> | |
| <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <queue> | |
| using namespace std; | |
| // It's like a BFS algorithm, where you have 9 roots for 9 trees (1, 2, ..., 9). | |
| // For each tree, you scan it level by level, | |
| // and you generate the two children of every number, | |
| // add them to the queue, and remove the current number at q.front(). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table> | |
| <tr> | |
| <th>Customer</th> | |
| <th>Price</th> | |
| <th>Date of Order</th> | |
| <th>Actions</th> | |
| </tr> | |
| <c:forEach var="order" items="${orders}"> | |
| <tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @GetMapping("/deleteOrder") | |
| public String deleteOrder(@RequestParam("orderId") int orderId, Model model){ | |
| // delete the order using the service | |
| orderService.deleteOrder(orderId); | |
| return "redirect:/order/list"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| @Transactional | |
| public void deleteOrder(int orderId) { | |
| orderDAO.deleteOrder(orderId); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void deleteOrder(int orderId) { | |
| // get the current hibernate session | |
| Session session = factory.getCurrentSession(); | |
| // delete the order using the passed id (primary key) | |
| Query theQuery = session.createQuery("delete from Order where id=:Id"); | |
| theQuery.setParameter("Id", orderId); | |
| theQuery.executeUpdate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table> | |
| <tr> | |
| <th>Customer</th> | |
| <th>Price</th> | |
| <th>Date of Order</th> | |
| <th>Actions</th> | |
| </tr> | |
| <c:forEach var="order" items="${orders}"> | |
| <tr> |