1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.dataaccess.impl;
17
18 import org.apache.ojb.broker.query.Criteria;
19 import org.apache.ojb.broker.query.QueryFactory;
20 import org.kuali.ole.coa.businessobject.Account;
21 import org.kuali.ole.coa.businessobject.SubFundGroup;
22 import org.kuali.ole.coa.dataaccess.SubFundGroupDao;
23 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
24
25
26
27
28 public class SubFundGroupDaoOjb extends PlatformAwareDaoBaseOjb implements SubFundGroupDao {
29
30
31
32
33 public SubFundGroup getByChartAndAccount(String chartCode, String accountNumber) {
34 Criteria criteria = new Criteria();
35 criteria.addEqualTo("chartOfAccountsCode", chartCode);
36 criteria.addEqualTo("accountNumber", accountNumber);
37
38 Account account = (Account) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(Account.class, criteria));
39 criteria = new Criteria();
40 criteria.addEqualTo("subFundGroupCode", account.getSubFundGroupCode());
41
42 return (SubFundGroup) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(SubFundGroup.class, criteria));
43 }
44
45 }