01: package com.completex.objective.persistency.examples.ex005.app;
02:
03: import com.completex.objective.components.persistency.OdalPersistencyException;
04: import com.completex.objective.components.persistency.Persistency;
05: import com.completex.objective.persistency.examples.ex005.domain.CpxOrder;
06:
07: /**
08: * @author Gennady Krizhevsky
09: */
10: public class OrderDAO {
11: private Persistency persistency;
12:
13: public OrderDAO(Persistency persistency) {
14: this .persistency = persistency;
15: }
16:
17: public void insertOrder(final CpxOrder order) throws OrderException {
18: try {
19: persistency.insert(order);
20: } catch (OdalPersistencyException e) {
21: throw new OrderException(e);
22: }
23: }
24:
25: public void updateOrder(final CpxOrder order) throws OrderException {
26: try {
27: persistency.update(order);
28: } catch (OdalPersistencyException e) {
29: throw new OrderException(e);
30: }
31: }
32:
33: public CpxOrder loadOrder(final Long orderId) throws OrderException {
34: try {
35: return (CpxOrder) persistency.load(new CpxOrder(orderId));
36: } catch (OdalPersistencyException e) {
37: throw new OrderException(e);
38: }
39: }
40:
41: }
|