日期:2014-05-17 浏览次数:20827 次
public List<Dishes> getAll() {
try {
String hql="from Dishes";
Query query = session.createQuery(hql);
return query.list();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
<hibernate-mapping>
<class name="com.shop.bean.Dishes" table="DISHESNAME" schema="myshop">
<id name="id" type="java.lang.Integer">
<column name="id" precision="20" scale="0" />
<!-- <generator class="sequence">
<param name="sequence">Sequence_Order</param>
</generator> -->
<generator class="identity" />
</id>
<property name="dishesName" type="java.lang.String">
<column name="DishesName" />
</property>
<property name="dishesType" type="java.lang.Integer">
<column name="DishesType" />
</property>
<property name="price" type="java.lang.Double">
<column name="price" />
</property>
<property name="type" type="java.lang.Integer">
<column name="type" />
</property>
</class>
</hibernate-mapping>