@Override @Nullable public <T> T get(Class<T> entityClass, Serializable id) throws DataAccessException { return get(entityClass, id, null); }
@Override @Nullable public Object get(String entityName, Serializable id) throws DataAccessException { return get(entityName, id, null); }
@Override @Nullable public Object get(String entityName, Serializable id) throws DataAccessException { return get(entityName, id, null); }
@Override @Nullable public <T> T get(Class<T> entityClass, Serializable id) throws DataAccessException { return get(entityClass, id, null); }
private Object get(final Class<?> clazz, final Integer id) { if (id == null) { return null; } return hibernateTemplate.get(clazz, id, LockMode.READ); }
private TenantDO getDefaultTenant() { return hibernateTemplate.get(TenantDO.class, 1); }
@Override @Nullable public <T> T get(Class<T> entityClass, Serializable id) throws DataAccessException { return get(entityClass, id, null); }
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public O internalGetById(final Serializable id) { if (id == null) { return null; } final O obj = hibernateTemplate.get(clazz, id, LockMode.READ); afterLoad(obj); return obj; }
public <T> T templateGet(Class<T> entityClass, Serializable id) { return template.get(entityClass, id); }
@Test public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); dummyDao.unbind(person); try { // Verify result - check that the operation was not rolled back ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { assertThat(true).isTrue(); } person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1)); assertThat(person).isNull(); } }
@Test public void testUnbind() { String dn = "cn=Some Person,ou=company1,ou=Sweden"; // Perform test OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); dummyDao.unbind(person); try { // Verify result - check that the operation was not rolled back ldapTemplate.lookup(dn); fail("NameNotFoundException expected"); } catch (NameNotFoundException expected) { assertThat(true).isTrue(); } person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1)); assertThat(person).isNull(); } }
@Test public void testCreate() { OrgPerson person = new OrgPerson(); person.setId(new Integer(2)); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); person.setCountry("Sweden"); person.setCompany("company1"); // dummyDao.create("Sweden", "company1", "some testperson", // "testperson", "some description"); this.dummyDao.create(person); person = null; log.debug("Verifying result"); Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2)); assertThat(ldapResult).isNotNull(); assertThat(fromDb).isNotNull(); }
@Test public void testCreate() { OrgPerson person = new OrgPerson(); person.setId(new Integer(2)); person.setDescription("some description"); person.setFullname("Some testperson"); person.setLastname("testperson"); person.setCountry("Sweden"); person.setCompany("company1"); // dummyDao.create("Sweden", "company1", "some testperson", // "testperson", "some description"); this.dummyDao.create(person); person = null; log.debug("Verifying result"); Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden"); OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2)); assertThat(ldapResult).isNotNull(); assertThat(fromDb).isNotNull(); }