-
-
Save Danny-Hoang/42ad7dab31f37748cfca20f00ae18d53 to your computer and use it in GitHub Desktop.
spring data jpa #jpa
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
| public interface ProductsRepository extends JpaRepository<ProductsEntity, Integer> { | |
| ProductsEntity findTopByOrderByProductIdDesc(); | |
| } | |
| @Getter | |
| @Setter | |
| @ToString(exclude = {"associateCompanies"}) | |
| @Entity | |
| @Table(name = "Products") | |
| @Access(value = AccessType.FIELD) | |
| public class ProductsEntity { | |
| @Id | |
| private int productId; | |
| private String productName; | |
| @Convert(converter = SaleStatusEnumConverter.class) | |
| private SaleStatus saleStatus; | |
| @Convert(converter = OffsetDateTimeConverter.class) | |
| private OffsetDateTime changed; | |
| @ManyToOne(fetch = FetchType.EAGER) | |
| @JoinColumn(name = "AssociateCompanyId") | |
| private AssociateCompaniesEntity associateCompanies; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment