Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hi all,
I've just read HIA, after finishing Chapter 8. (Writing Hibernate Applications) I have a question here.
Before persisting a domain model to DB I need to make sure that the record does not exist yet in the database by comparing ID from domain model to the one in DB.
That is, I need to query the DB first using the ID contained in the domain model and if the query returns 1 record that means the record already exists in the DB and the domain model should not be persisted.
I don't know where the above routine should take place, I definitely can not put it in the domain model itself since this will pollute the domain model with persistence API and DAOs.
Regards,
Setya