On Sun, Nov 23, 2008 at 20:06, Stephanus Astorizkhy
<[EMAIL PROTECTED]> wrote:
> Hi all,
> I'm using appfuse in my final thesis.
> rite now i'm a bit confuse about creating a filter to my cart.
> Let say, i have 2 tables, user and cart.
> im using Appfuse 2.0.2 with struts + Hibernate.
> i just wan an user just see his shopping cart only, not all.
> let say in sql statement:
> Select c.cartId, c.totalPrice from cart c, app_user where cart.userId = id;
>
> how to make it in my application?
> let say, my cart's table is
>        private Long cartId;
>        private Long userId;
>        private Long itemId;
>        private Date cartDate;
>        private byte status;
>        private int totalPrice;
> while table app_user is from AppFuse itself.
> Thanks in advanced.


I would change  userId in Cart model to use User object, like
private Long cartId;
private User user;
...
then in HQL I can use
select * from cart where user.id = :id

In the other hand, you could still using  native sql statement using
CreateSQLQuery.

Regards,

-- 
Ernas Moethar

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to