Back to listJava
JPA/Hibernate - Entity Definition
Lv.5512@mukitaro11 playsDec 31, 2025
JPA entity with Hibernate annotations for ORM mapping. Shows table mapping, relationships, and automatic timestamp handling.
preview.java
1@Entity2@Table(name = "products")3public class Product {4 @Id5 @GeneratedValue(strategy = GenerationType.IDENTITY)6 private Long id;7 8 @Column(nullable = false, length = 100)9 private String name;10 11 @Column(precision = 10, scale = 2)12 private BigDecimal price;13 14 @ManyToOne(fetch = FetchType.LAZY)15 @JoinColumn(name = "category_id")16 private Category category;17 18 @CreationTimestamp19 private LocalDateTime createdAt;20 21 @UpdateTimestamp22 private LocalDateTime updatedAt;23}Custom problems are not included in rankings