I'm new to Hibernate and all that Object/Relational mapping stuff. I need a recipe in Hibernate of the simplest relational situation. Let me explain.
I have three tables
As you see the first two are simple entities and the third one shows which DVD a specific user has taken. In my application I have to be able to know these things:
1) What user has which DVDs. SQL query would be:
2) Which DVDs are vacant (not taken by other users). SQL query would be:
Users also have to be able to take and give back DVDs. It means to insert into/delete from the TakenItem table.
So, I made up a hibernate-mapping for two classes Users and DVD in a standard and simple with one id and some fields (as any of the tutorials say). But the problem is that I don't understand what to do with the third table and what hibernate-mapping must I write to be able to make queries that I described before?