DAO constructor should be lightweight to make Spring DI faster.

This commit is contained in:
Prachi Damle 2013-03-15 15:06:17 -07:00
parent 1ba6740fc1
commit e9300d2676
2 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.affinity.dao;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.Local;
import org.apache.cloudstack.affinity.AffinityGroupVO;
import org.springframework.stereotype.Component;
@ -33,7 +34,12 @@ public class AffinityGroupDaoImpl extends GenericDaoBase<AffinityGroupVO, Long>
private SearchBuilder<AffinityGroupVO> AccountIdNamesSearch;
protected AffinityGroupDaoImpl() {
public AffinityGroupDaoImpl() {
}
@PostConstruct
protected void init() {
AccountIdSearch = createSearchBuilder();
AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
AccountIdSearch.done();

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.affinity.dao;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.Local;
import javax.inject.Inject;
@ -50,7 +51,11 @@ public class AffinityGroupVMMapDaoImpl extends GenericDaoBase<AffinityGroupVMMap
@Inject
protected AffinityGroupDao _affinityGroupDao;
protected AffinityGroupVMMapDaoImpl() {
public AffinityGroupVMMapDaoImpl() {
}
@PostConstruct
protected void init() {
ListVmIdByAffinityGroup = createSearchBuilder(Long.class);
ListVmIdByAffinityGroup.and("affinityGroupId", ListVmIdByAffinityGroup.entity().getAffinityGroupId(),
SearchCriteria.Op.EQ);