01: package com.odal.petstore.persistence.dao;
02:
03: import com.completex.objective.components.persistency.MappingPersistency;
04: import com.completex.objective.components.persistency.OdalPersistencyException;
05: import com.completex.objective.components.persistency.core.impl.BasicLifeCycleController;
06: import com.odal.petstore.OdalPetstoreException;
07: import com.odal.petstore.domain.Category;
08: import com.odal.petstore.persistence.gen.pos.CategoryPO;
09: import com.odal.petstore.persistence.iface.CategoryDao;
10:
11: import java.util.List;
12:
13: /**
14: * @author Gennady Krizhevsky
15: */
16: public class CategoryDaoImpl implements CategoryDao {
17:
18: private BasicLifeCycleController controller = new BasicLifeCycleController(
19: "categoryCache");
20:
21: private MappingPersistency persistency;
22:
23: public CategoryDaoImpl(MappingPersistency persistency) {
24: this .persistency = persistency;
25: }
26:
27: public List getCategoryList() throws OdalPetstoreException {
28: try {
29: return (List) persistency.select(new CategoryPO(),
30: controller);
31: } catch (OdalPersistencyException e) {
32: throw new OdalPetstoreException(e);
33: }
34: }
35:
36: public Category getCategory(String categoryId)
37: throws OdalPetstoreException {
38: try {
39: return (Category) persistency.load(new CategoryPO(
40: categoryId), controller);
41: } catch (OdalPersistencyException e) {
42: throw new OdalPetstoreException(e);
43: }
44: }
45:
46: }
|