-1
    public List<ShoworderbybidId> queryTradesByBid(String bid) throws Exception {

  Session session=null;

  Transaction transaction=null;

  List<ShoworderbybidId> orders=new ArrayList<ShoworderbybidId>();

  try {

   session=HibernateSessionFactory.getSession();

   transaction=session.beginTransaction();

   Query query=session.createQuery("from Showorderbybid");// In this way, I could query all results from view Showorderbybid

   //Query query=session.createQuery("from Showorderbybid where bid = "+bid); //I try to use this code to find out the orders from a view(Showorderbybid) in my database. However, it failed. It said " Unknown column 'ru0001' (bid=ru0001) in 'where clause' "

   orders=(List<ShoworderbybidId>)query.list();

   transaction.commit();

  } catch (Exception e) {

   throw e;

  }finally{

   HibernateSessionFactory.closeSession();

  }

  return orders;

 }
4

1 に答える 1