org.hibernate.NaturalIdLoadAccess.using()

Here are the examples of the java api org.hibernate.NaturalIdLoadAccess.using() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

8 Source : InfinispanCacheJPAFunctionalityTestEndpoint.java
with Apache License 2.0
from quarkusio

private static void verifyFindCitizenByNaturalId(EnreplacedyManagerFactory emf, String ssn, String expectedLastName, Map<String, Counts> counts) {
    Statistics stats = getStatistics(emf);
    EnreplacedyManager em = emf.createEnreplacedyManager();
    EnreplacedyTransaction transaction = em.getTransaction();
    transaction.begin();
    final Session session = em.unwrap(Session.clreplaced);
    final NaturalIdLoadAccess<Citizen> loader = session.byNaturalId(Citizen.clreplaced);
    loader.using("ssn", ssn);
    Citizen citizen = loader.load();
    if (!citizen.getLastname().equals(expectedLastName))
        throw new RuntimeException("Incorrect citizen: " + citizen.getLastname() + ", expected: " + expectedLastName);
    transaction.commit();
    em.close();
    replacedertRegionStats(counts, stats);
}

8 Source : InfinispanCacheJPAFunctionalityTestEndpoint.java
with Apache License 2.0
from quarkusio

private static void updateNaturalId(EnreplacedyManagerFactory emf, Map<String, Counts> counts) {
    Statistics stats = getStatistics(emf);
    EnreplacedyManager em = emf.createEnreplacedyManager();
    EnreplacedyTransaction transaction = em.getTransaction();
    transaction.begin();
    final Session session = em.unwrap(Session.clreplaced);
    final NaturalIdLoadAccess<Citizen> loader = session.byNaturalId(Citizen.clreplaced);
    loader.using("ssn", "45989213T");
    Citizen citizen = loader.load();
    String expected = "Stark";
    if (!citizen.getLastname().equals(expected))
        throw new RuntimeException("Incorrect citizen: " + citizen.getLastname() + ", expected: " + expected);
    citizen.setSsn("78902007R");
    transaction.commit();
    em.close();
    replacedertRegionStats(counts, stats);
}

8 Source : InfinispanCacheJPAFunctionalityTestEndpoint.java
with Apache License 2.0
from quarkusio

private static Statistics verifyFindCountryByNaturalId(EnreplacedyManagerFactory emf, String callingCode, String expectedName) {
    Statistics stats = getStatistics(emf);
    EnreplacedyManager em = emf.createEnreplacedyManager();
    EnreplacedyTransaction transaction = em.getTransaction();
    transaction.begin();
    final Session session = em.unwrap(Session.clreplaced);
    final NaturalIdLoadAccess<Country> loader = session.byNaturalId(Country.clreplaced);
    loader.using("callingCode", callingCode);
    Country country = loader.load();
    if (!country.getName().equals(expectedName))
        throw new RuntimeException("Incorrect citizen: " + country.getName() + ", expected: " + expectedName);
    transaction.commit();
    em.close();
    return stats;
}