Spring/Spring&Hibernate 강의
Entity class
빙하둘리
2022. 12. 30. 18:54
728x90
Entity Class) Java class that is mapped to a database table
@Entity
@Table(name="student") // Map class to database table
public class Student {
@Id
@Column(name="id")
private int id; // 이게 primary key
@Column(name="first_name")
private String firstName;
...
}
Java Annotations) Map class to database table & Map fields to database columns
FAQ: Can Hibernate generate database tables based on the Java code?
Answer:
Yes, you can generate database tables from Java code. Here's a tutorial that shows you how.
https://www.dineshonjava.com/hibernate/hbm2ddl-configuration-and-name/
hbm2ddl Configuration and Name Annotations in Hibernate - Dinesh on Java
Here we will learn about hbm2ddl Configuration in the hibernate configuration file (hibernate.cfg.xml). Actually hbm2ddl Configuration means hibernate mapping to create schema DDL (Data Definition Language). <!– Drop and re-create the
www.dineshonjava.com
728x90