Ant Group interview question

How to implement locks in database queries?