日期:2014-05-18 浏览次数:20684 次
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name = "order_goods", joinColumns = { @JoinColumn(name = "order_id") }, inverseJoinColumns = { @JoinColumn(name = "goods_id") })
private Set<Goods> goods = new HashSet<Goods>();
String hql = "from Orders where id=1";
Query query = (Query) s.createQuery(hql);
List<Orders> list = query.list();
System.out.println(list.size());
select
orders0_.orderId as orderId4_,
orders0_.BuyersMes as BuyersMes4_,
orders0_.addressid as addressid4_,
orders0_.buyNumbers as buyNumbers4_,
orders0_.goodsDecribe as goodsDec4_4_,
orders0_.goodsName as goodsName4_,
orders0_.goodsNumber as goodsNum6_4_,
orders0_.onePrice as onePrice4_,
orders0_.orderDateTime as orderDat8_4_,
orders0_.orderNumber as orderNum9_4_,
orders0_.orderStatus as orderSt10_4_,
orders0_.totalPrice as totalPrice4_,
orders0_.userid as userid4_
from
t_orders orders0_
where
orders0_.orderId=1
Hibernate:
select
orders0_.orderId as orderId4_,
orders0_.BuyersMes as BuyersMes4_,
orders0_.addressid as addressid4_,
orders0_.buyNumbers as buyNumbers4_,
orders0_.goodsDecribe as goodsDec4_4_,
orders0_.goodsName as goodsName4_,
orders0_.goodsNumber as goodsNum6_4_,
orders0_.onePrice as onePrice4_,
orders0_.orderDateTime as orderDat8_4_,
orders0_.orderNumber as orderNum9_4_,
orders0_.orderStatus as orderSt10_4_,
orders0_.totalPrice as totalPrice4_,
orders0_.userid as userid4_
from
&nbs