diff --git a/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/dao/Customer2Repository.java b/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/dao/Customer2Repository.java deleted file mode 100644 index 6afe004609..0000000000 --- a/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/dao/Customer2Repository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.boot.unique.field.dao; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.baeldung.boot.unique.field.data.Customer2; - -public interface Customer2Repository extends MongoRepository { -} diff --git a/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/data/Customer2.java b/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/data/Customer2.java deleted file mode 100644 index 523a0a9841..0000000000 --- a/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/data/Customer2.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.boot.unique.field.data; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.index.CompoundIndex; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -@CompoundIndex(def = "{ 'storeId': 1, 'number': 1 }", unique = true) -public class Customer2 { - @Id - private Long storeId; - - private Long number; - - private String name; - - public Customer2() { - } - - public Customer2(String name) { - this.name = name; - } - - public Long getStoreId() { - return storeId; - } - - public void setStoreId(Long storeId) { - this.storeId = storeId; - } - - public Long getNumber() { - return number; - } - - public void setNumber(Long number) { - this.number = number; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/web/UniqueFieldController.java b/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/web/UniqueFieldController.java index 8ac00c497f..716977edd4 100644 --- a/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/web/UniqueFieldController.java +++ b/persistence-modules/spring-boot-persistence-mongodb-2/src/main/java/com/baeldung/boot/unique/field/web/UniqueFieldController.java @@ -13,13 +13,11 @@ import org.springframework.web.bind.annotation.RestController; import com.baeldung.boot.unique.field.dao.AssetRepository; import com.baeldung.boot.unique.field.dao.CompanyRepository; -import com.baeldung.boot.unique.field.dao.Customer2Repository; import com.baeldung.boot.unique.field.dao.CustomerRepository; import com.baeldung.boot.unique.field.dao.SaleRepository; import com.baeldung.boot.unique.field.data.Asset; import com.baeldung.boot.unique.field.data.Company; import com.baeldung.boot.unique.field.data.Customer; -import com.baeldung.boot.unique.field.data.Customer2; import com.baeldung.boot.unique.field.data.Sale; import com.baeldung.boot.unique.field.data.SaleId; @@ -35,9 +33,6 @@ public class UniqueFieldController { @Autowired private CustomerRepository customerRepo; - @Autowired - private Customer2Repository customer2Repo; - @Autowired private AssetRepository assetRepo; @@ -71,11 +66,6 @@ public class UniqueFieldController { return customerRepo.insert(customer); } - @PostMapping("/customer2") - public Customer2 post(@RequestBody Customer2 customer) { - return customer2Repo.insert(customer); - } - @GetMapping("/customer/{id}") public Optional getCustomer(@PathVariable String id) { return customerRepo.findById(id);