2009. 8. 21. 20:14
Roo Relationship 구현하기 프레임워크2009. 8. 21. 20:14
1. ManyToOne
add field reference
2. OneToMany
add field set
3. ManyToOne Relationship 구현 방법
Order와 LineItem 경우를 예로 들어보자.
ENTITY: Order ENTITY: LineItem
Set<LineItem> items Order order
add field set jpa -fieldName items -class Order -element LineItem -mappedBy order
add field reference jpa -fieldName order -class LineItem -type Order -notNull
4. ManyToMany Relationship 구현 방법
n:m relationship을 구현하기 위해서는 3개의 테이블이 필요하다.
Order와 OrderLine이 n:m인 경우
Order
- OneToMany-> OrderOrderLine
OrderOrderLine
-orders: @ManyToOne->Order
-orderlines: @ManyToOne->OrderLine
OrderLine
-OneToMany->OrderOrderLine
5. Inheritance 구현 방법
new persistent class jpa -name ~.domain.AbstractPerson -abstract
new persistent class jpa -name ~.domain.Vet -extends ~.domain.AbstractPerson -testAutomatically
5. Inheritance 구현 방법
new persistent class jpa -name ~.domain.AbstractPerson -abstract
new persistent class jpa -name ~.domain.Vet -extends ~.domain.AbstractPerson -testAutomatically