1entity: Order
2x-pyd-source: [ejb-jar.xml:112-141, OrderBean.java:20-64]
3table: ORDERS
4id: { field: orderId, type: Long, column: ORDER_ID, source: "sequence ORDER_SEQ in ejbCreate" }
5fields:
6 status: { type: String, column: STATUS, values: [OPEN, SHIPPED, CLOSED] }
7 total: { type: BigDecimal, column: TOTAL_AMT, precision: 12, scale: 2 }
8relationships:
9 customer: { kind: ManyToOne, target: Customer, joinColumn: CUST_ID, required: true }
10 lineItems: { kind: OneToMany, target: LineItem, mappedBy: order, cascadeDelete: true }
11queries:
12 findOpenByCustomer:
13 ejbQl: "o.customer.customerId = ?1 AND o.status <> 'CLOSED'"
14 jpql: "select o from Order o where o.customer.customerId = :customerId and o.status <> 'CLOSED'"
15 rule: ORD-Q-01 "open order = any status except CLOSED (includes SHIPPED)"
16rules:
17 - "ORD-INIT-01: ejbCreate sets status OPEN, total 0.00"
18 - "ORD-CALC-02: total = sum(qty * unitPrice) of lineItems, HALF_UP to 2 dp, in ejbStore"