I'm evaluating SmartGWT EE 2.5 and am trying to create a page that relies on a many-to-many relationship. I want to use SQL DataSource (i.e., no Hibernate or JPA).
For example, I have a User page the needs to list the Products she has purchased. So my database has tables Users, Products, and an association table Users_Products. The SQL to select all Products for a user could be...
SELECT *
FROM Products CROSS JOIN Users_Products
ON Users_Products.User_id = {id} AND
Users_Products.Products_id = Products.id;
...where {id} is the User's id.
After hours of searching and looking through examples, I'm stumped. It seems like the only way to do this is to use Hibernate or JPA since those are the only examples. Is that true?
It seems like the User.ds.xml file could have a reference to the Product.ds.xml and Users_Products.ds.xml somehow that defines the relationship. Is that possible?
Maybe I'm approaching the problem wrong. Please let me know if I'm way out on a limb. What is the best way to do this?
Thanks,
boz
For example, I have a User page the needs to list the Products she has purchased. So my database has tables Users, Products, and an association table Users_Products. The SQL to select all Products for a user could be...
SELECT *
FROM Products CROSS JOIN Users_Products
ON Users_Products.User_id = {id} AND
Users_Products.Products_id = Products.id;
...where {id} is the User's id.
After hours of searching and looking through examples, I'm stumped. It seems like the only way to do this is to use Hibernate or JPA since those are the only examples. Is that true?
It seems like the User.ds.xml file could have a reference to the Product.ds.xml and Users_Products.ds.xml somehow that defines the relationship. Is that possible?
Maybe I'm approaching the problem wrong. Please let me know if I'm way out on a limb. What is the best way to do this?
Thanks,
boz
Comment