You can try the below query. In your query, you haven't added which column should be joined to fetch exact results for the given id.
SELECT o FROM ShoppingCart o, Customer c WHERE c.userName = o.userName AND o.userName = :id
Also, you can try adding relationships one-to-many as each customer can have one or more than that order items.
SELECT c FROM Customer c JOIN c.orders o WHERE c.userName = :id
Here, orders
is the collection of orders for particular customer. Then from Customer
, you can get its orders.