Code example for Lockable

Methods: getFactorygetIdentifierType

	private volatile MapDatastoreProvider provider;
	public MapPessimisticWriteLockingStrategy(Lockable lockable, LockMode lockMode) {
		this.lockable = lockable;
		this.lockMode = lockMode;
		TypeTranslator typeTranslator = lockable.getFactory().getServiceRegistry().getService( TypeTranslator.class );
		this.identifierGridType = typeTranslator.getType( lockable.getIdentifierType() );
	public void lock(Serializable id, Object version, Object object, int timeout, SessionImplementor session) throws StaleObjectStateException, JDBCException {
		MapDatastoreProvider dataStore = getProvider( session );
		EntityKey key = EntityKeyBuilder.fromData(
				( (OgmEntityPersister) lockable).getRootEntityKeyMetadata(),
				session );
		dataStore.writeLock( key, timeout );
		// FIXME check the version number as well and raise an optimistic lock exception if there is an issue JPA 2 spec: 
		// (Comment by Emmanuel)