HibernateReservedValueStore extends HibernateGenericStore<ReservedValue> implements ReservedValueStore { @Override public boolean isReserved( String ownerObject, String ownerUID, String value ) { String hql = "from ReservedValue rv where rv.ownerObject =:ownerObject and rv.ownerUid =:ownerUid " + "and rv.value =:value"; return !getQuery( hql ) .setParameter( "ownerObject", ownerObject ) .setParameter( "ownerUid", ownerUID ) .setParameter( "value", value ) .getResultList() .isEmpty(); } HibernateReservedValueStore( SessionFactory sessionFactory, JdbcTemplate jdbcTemplate,
        ApplicationEventPublisher publisher, BatchHandlerFactory batchHandlerFactory ); @Override List<ReservedValue> reserveValues( ReservedValue reservedValue,
        List<String> values ); @Override List<ReservedValue> reserveValuesJpa( ReservedValue reservedValue, List<String> values ); @Override List<ReservedValue> getIfReservedValues( ReservedValue reservedValue,
        List<String> values ); @Override int getNumberOfUsedValues( ReservedValue reservedValue ); @Override void removeExpiredReservations(); @Override boolean useReservedValue( String ownerUID, String value ); @Override void deleteReservedValueByUid( String uid ); @Override boolean isReserved( String ownerObject, String ownerUID, String value );  }
@Test public void isReservedShouldBeTrue() { assertTrue( reservedValueStore.isReserved( reservedValueA.getOwnerObject(), reservedValueA.getOwnerUid(), "001" ) ); }
@Test public void isReservedShouldBeFalse() { assertFalse( reservedValueStore.isReserved( reservedValueA.getOwnerObject(), reservedValueA.getOwnerUid(), "100" ) ); }