May 29th, 2009, 11:32 PM
Saving data (with hibernate?) without using a domain object or .hbm.xml files
Ok, I'm going to start with the big picture and work my way down so if you're reading this and begin to wonder "why would he want to do that?" chances are it's because I'm new to this and need to be set straight, so please do
So, I have recipes that people can rate (think product ratings on amazon or something). To do this I created a recipes table and put in an avg_rating column.
Then I created another table just for the ratings, linking back to the recipes table. This table would have a trigger on it to average all the recipes ratings and save that average back in the recipes table.
So how do I go about saving ratings to the ratings table? There's no ratings class in my application, it's all just ints (for the actual vote) and doubles (for the avg) and I think (again, new to this) that prevents me from using .hbm.xml files.
Obviously I could use straight JDBC, but the rest of the app uses hibernate and I'd like to stick with that as much as possible.
Thanks in advance.
Tags for this Thread