I developed a java web application which contains Wallpapers, there is like button for each wallpaper, If a user clicks on like then I am storing userId,wallpaperId and like count in ‘User_Wallpaper’ table, and I have another table ‘wall_stats’ which contains statistics for wallpaers, i.e total liked wallpapers.
So,What I want…
If user clicks like button then I have to update in ‘User_Wallpaper’ and also increment the count in ‘wall_stats’….How can I do this?
I am using Hibernate 3.0.
Please help me…thanks in advance…. 🙂
I developed a java web application which contains Wallpapers, there is like button for
Share
I’m not sure why you are storing the “like count” in the
User_Wallpapertable (can a user “like” a wallpaper more than once?) but rather than creating a new table for thewall_stats, I’d makewall_statsa view:That way the wall_stats is always up-to-date… (though you probably want an indexes on
User_Likes_Wallpaper)