I am developing a web application to count the hit rate of websites that a user is interested in. My application can host multiple users. so each user is supposed to have his own table in the database that stores his websites and their corresponding count. My idea is to automatically generate a table in the name of the user once he/she signs up with the application. How can this be possible using Java Persistence API?.............. Please help
Because each user would have his own list of Websites and their respective counts, I thought generating a table with two colums (website, count) for each user would be a good idea to ingest and retrive data . Please correct me if I am wrong
I would create a table of users, a table of websites, and a mapping table. The user table has data about the user, and in integer primary key. The website table has a varchar for url, and an integer primary key. The mapping table can be a ManyToMany in JPA, or you can do it manually with an integer primary key, and then two foreign keys, one for users, and one for websites.
Each time you see a totally new website, add a row to the websites table, and add a row to the mapping table.
Each time you see an existing website, you only need to add a row to the mapping table.
Does this make things more clear?
Joined: Nov 23, 2012
Definitely Sir I am working on it. Thanks for the word.