I'm trying to create a session bean that checks the contents of a potential new record against a table before adding that record to the table. The table is a list of (funnily enough) hotel bookings. I want to make sure that the booking dates don't clash for a particular room. Because a booking has a start date and end date, it's not sufficient to have a compound primary key based on dates.
I'm using EJB3 on JBOSS 4
If I were doing it in normal java it would look something like: