ch.algotrader.dao.trade.OrderStatusDaoImpl.java Source code

Java tutorial

Introduction

Here is the source code for ch.algotrader.dao.trade.OrderStatusDaoImpl.java

Source

/***********************************************************************************
 * AlgoTrader Enterprise Trading Framework
 *
 * Copyright (C) 2015 AlgoTrader GmbH - All rights reserved
 *
 * All information contained herein is, and remains the property of AlgoTrader GmbH.
 * The intellectual and technical concepts contained herein are proprietary to
 * AlgoTrader GmbH. Modification, translation, reverse engineering, decompilation,
 * disassembly or reproduction of this material is strictly forbidden unless prior
 * written permission is obtained from AlgoTrader GmbH
 *
 * Fur detailed terms and conditions consult the file LICENSE.txt or contact
 *
 * AlgoTrader GmbH
 * Aeschstrasse 6
 * 8834 Schindellegi
 ***********************************************************************************/
package ch.algotrader.dao.trade;

import java.util.List;

import org.hibernate.SQLQuery;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import ch.algotrader.dao.AbstractDao;
import ch.algotrader.entity.trade.OrderStatus;
import ch.algotrader.entity.trade.OrderStatusImpl;
import ch.algotrader.enumeration.QueryType;

/**
 * @author <a href="mailto:aflury@algotrader.ch">Andy Flury</a>
 */
@Repository // Required for exception translation
public class OrderStatusDaoImpl extends AbstractDao<OrderStatus> implements OrderStatusDao {

    public OrderStatusDaoImpl(final SessionFactory sessionFactory) {

        super(OrderStatusImpl.class, sessionFactory);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<OrderStatus> findPending() {

        SQLQuery query = (SQLQuery) prepareQuery(null, "OrderStatus.findPending", QueryType.BY_NAME);
        query.addEntity(OrderStatusImpl.class);
        return query.list();
    }

}