mirror of https://github.com/apache/cloudstack.git
quota: fixing warped up db
This commit is contained in:
parent
eaf3d21b55
commit
92269d2636
|
|
@ -22,4 +22,10 @@ import com.cloud.utils.db.GenericDao;
|
|||
|
||||
public interface QuotaAccountDao extends GenericDao<QuotaAccountVO, Long> {
|
||||
|
||||
QuotaAccountVO findById(Long id);
|
||||
|
||||
QuotaAccountVO persist(QuotaAccountVO entity);
|
||||
|
||||
boolean update(Long id, QuotaAccountVO entity);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,40 @@ import org.apache.cloudstack.quota.vo.QuotaAccountVO;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
|
||||
@Component
|
||||
@Local(value = { QuotaAccountDao.class })
|
||||
public class QuotaAccountDaoImpl extends GenericDaoBase<QuotaAccountVO, Long> implements QuotaAccountDao {
|
||||
|
||||
@Override
|
||||
public QuotaAccountVO findById(Long id){
|
||||
QuotaAccountVO result=null;
|
||||
final short opendb = TransactionLegacy.currentTxn().getDatabaseId();
|
||||
TransactionLegacy.open(TransactionLegacy.USAGE_DB).close();
|
||||
result = findById(id);
|
||||
TransactionLegacy.open(opendb).close();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuotaAccountVO persist(QuotaAccountVO entity){
|
||||
QuotaAccountVO result=null;
|
||||
final short opendb = TransactionLegacy.currentTxn().getDatabaseId();
|
||||
TransactionLegacy.open(TransactionLegacy.USAGE_DB).close();
|
||||
result = persist(entity);
|
||||
TransactionLegacy.open(opendb).close();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Long id, QuotaAccountVO entity){
|
||||
boolean result=false;
|
||||
final short opendb = TransactionLegacy.currentTxn().getDatabaseId();
|
||||
TransactionLegacy.open(TransactionLegacy.USAGE_DB).close();
|
||||
result=update(id, entity);
|
||||
TransactionLegacy.open(opendb).close();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import java.math.BigDecimal;
|
|||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Table(name = "quota_balance")
|
||||
@Table(name = "quota_account")
|
||||
public class QuotaAccountVO implements InternalIdentity {
|
||||
|
||||
private static final long serialVersionUID = -7112846845287653210L;
|
||||
|
|
|
|||
Loading…
Reference in New Issue