Example usage for org.hibernate LockMode OPTIMISTIC

List of usage examples for org.hibernate LockMode OPTIMISTIC

Introduction

In this page you can find the example usage for org.hibernate LockMode OPTIMISTIC.

Prototype

LockMode OPTIMISTIC

To view the source code for org.hibernate LockMode OPTIMISTIC.

Click Source Link

Document

Optimistically assume that transaction will not experience contention for entities.

Usage

From source file:com.github.jmnarloch.hstreams.internal.QueryDelegateTest.java

License:Apache License

@Test
public void testSetLockMode() throws Exception {

    // given//from  w  w w  .  ja  v a 2 s.  c  o  m
    final String alias = "alias";
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(q -> q.setLockMode(alias, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testLoad1() throws Exception {

    // given// w  ww  .j  a v  a2  s.  com
    final Class<Object> clazz = Object.class;
    final long id = 1l;
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(s -> s.load(clazz, id, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testLoad4() throws Exception {

    // given//from www .j a v  a 2 s .c om
    final String entityName = "entityName";
    final long id = 1l;
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(s -> s.load(entityName, id, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testLock() throws Exception {

    // given/*from   w  w w .j av  a2  s .com*/
    final LockMode lockMode = LockMode.OPTIMISTIC;
    final String entityName = "entityName";

    // then
    verifyMethodCall(s -> s.lock(entityName, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testLock1() throws Exception {

    // given//w ww  .  j  ava2s  . c o m
    final Object object = new Object();
    final LockMode lockMode = LockMode.OPTIMISTIC;
    final String entityName = "entityName";

    // then
    verifyMethodCall(s -> s.lock(entityName, object, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testRefresh2() throws Exception {

    // given//from   w  w w .  ja v  a2  s.c o m
    final Object object = new Object();
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(s -> s.refresh(object, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testGet1() throws Exception {

    // given/*from  w w w .ja  va 2 s .  c o m*/
    final Class<?> clazz = Object.class;
    final long id = 1l;
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(s -> s.get(clazz, id, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SessionDelegateTest.java

License:Apache License

@Test
public void testGet4() throws Exception {

    // given//from   ww  w  .  j a v a2  s. co m
    final String entityName = "entityName";
    final long id = 1l;
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(s -> s.get(entityName, id, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.SQLQueryDelegateTest.java

License:Apache License

@Test
public void testAddJoin2() throws Exception {

    // given/*from   www .  j a  v  a 2  s .co  m*/
    final String alias = "alias";
    final String path = "path";
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // then
    verifyMethodCall(q -> q.addJoin(alias, path, lockMode));
}

From source file:com.github.jmnarloch.hstreams.internal.StatelessSessionDelegateTest.java

License:Apache License

@Test
public void testGetOptional1() throws Exception {

    // given/*from   w ww .j  av a 2 s .co  m*/
    final Class<Object> clazz = Object.class;
    final long id = 1l;
    final LockMode lockMode = LockMode.OPTIMISTIC;

    // when
    instance.getOptional(clazz, id, lockMode);

    // then
    verify().get(clazz, id, lockMode);
}