문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
java:hibernate:annotations [2018/06/29 08:23] kwon37xi [@org.hibernate.annotations.ColumnTransformer] |
java:hibernate:annotations [2022/01/20 03:42] (현재) kwon37xi [@org.hibernate.annotations.DynamicUpdate] |
||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| ====== Hibernate Annotations ====== | ====== Hibernate Annotations ====== | ||
| - | 하이버네이트 전용 어노테이션들 | + | * 하이버네이트 전용 어노테이션들 |
| + | * [[https:// | ||
| + | |||
| + | ===== CRUD 쿼리 직접 지정 ===== | ||
| + | * [[https:// | ||
| + | |||
| + | <code java> | ||
| + | @Entity | ||
| + | @Table(name=" | ||
| + | @SQLInsert( sql=" | ||
| + | @NamedNativeQuery(name=" | ||
| + | public class Chaos { | ||
| + | @Id | ||
| + | private Long id; | ||
| + | private Long size; | ||
| + | private String name; | ||
| + | private String nickname; | ||
| + | </ | ||
| + | |||
| + | * '' | ||
| + | * Entity 단건 SELECT 에 대한 쿼리를 HQL, Native Query로 지정할 수 있다. | ||
| + | * namedQuery로 만들어 놓고, 그 nameQuery 이름을 지정해준다. | ||
| + | * '' | ||
| + | * SQL 파라미터의 순서가 매우 중요하다. 위 어노테이션들을 지정하기 전에 먼저 '' | ||
| + | * Secondary Table에 대한 지정 | ||
| + | <code java> | ||
| + | @Entity | ||
| + | @SecondaryTables({ | ||
| + | @SecondaryTable(name = "`Cat nbr1`" | ||
| + | @SecondaryTable(name = " | ||
| + | @org.hibernate.annotations.Tables( { | ||
| + | @Table(appliesTo = " | ||
| + | @Table(appliesTo = " | ||
| + | sqlInsert=@SQLInsert(sql=" | ||
| + | } ) | ||
| + | public class Cat implements Serializable { | ||
| + | </ | ||
| + | * Join Column에 대한 지정 | ||
| + | <code java> | ||
| + | @OneToMany | ||
| + | @JoinColumn(name=" | ||
| + | @SQLInsert( sql=" | ||
| + | private Set< | ||
| + | </ | ||
| ===== @org.hibernate.annotations.ForeignKey ===== | ===== @org.hibernate.annotations.ForeignKey ===== | ||
| - | * **JPA 2.1** 에서 부터 '' | + | * Deprecated. |
| - | * '' | + | * '' |
| * 이를 명시하지 않으면 '' | * 이를 명시하지 않으면 '' | ||
| * '' | * '' | ||
| 줄 30: | 줄 73: | ||
| * '' | * '' | ||
| * [[http:// | * [[http:// | ||
| + | * [[https:// | ||
| ===== @org.hibernate.annotations.Immutable ===== | ===== @org.hibernate.annotations.Immutable ===== | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| * Entity나 immutable로 지정하면 수정이 작동하지 않게 된다. | * Entity나 immutable로 지정하면 수정이 작동하지 않게 된다. | ||
| * Collection을 immutable로 지정하면 추가나 삭제가 작동하지 않게 된다. | * Collection을 immutable로 지정하면 추가나 삭제가 작동하지 않게 된다. | ||
| + | * **'' | ||
| + | * 주의! : '' | ||
| + | hibernate.query.immutable_entity_update_query_handling_mode=exception | ||
| + | </ | ||
| + | * [[https:// | ||
| + | |||
| ===== @org.hibernate.annotations.OptimisticLocking ===== | ===== @org.hibernate.annotations.OptimisticLocking ===== | ||