lock and hibernate script