public Object queryForObject(String statementName, Object parameter) { return delegate.selectOne(translateStatementName(statementName), parameter); }
@RequestMapping("/user/{id}") public User user(@PathVariable int id) { User user = sqlSessionTemplate.selectOne("com.segmentfault.springbootlesson7.mapper.UserMapper.selectOneUser", id); return user; }
@Override protected Long selectMinUnusedTxnCommitTime() { return template.selectOne(SELECT_TXN_UNUSED_MIN_COMMIT_TIME); }
@Override public Long getMaxNodeId() { return (Long) template.selectOne(SELECT_NODE_MAX_ID); }
@Override protected Long selectMaxTxnCommitTime() { return template.selectOne(SELECT_TXN_MAX_COMMIT_TIME); }
@Override protected Long selectMaxChangeSetCommitTime() { return template.selectOne(SELECT_CHANGE_SET_MAX_COMMIT_TIME); }
@Override protected AclEntity getAclEntity(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.selectOne(SELECT_ACL_BY_ID, params); }
@Override protected PropertyDateValueEntity findDateValueByValue(Date value) { PropertyDateValueEntity result = template.selectOne( SELECT_PROPERTY_DATE_VALUE_BY_VALUE, new Long(value.getTime())); // The ID is the actual time in ms (GMT) return result; }
@Override protected TenantEntity getTenantEntity(String tenantDomain) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("tenantDomain", tenantDomain); return template.selectOne(SELECT_TENANT, params); }
@Override protected LocaleEntity getLocaleEntity(Long id) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", id); return template.selectOne(SELECT_LOCALE_BY_ID, params); }
@Override protected AclEntity getAclEntity(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.selectOne(SELECT_ACL_BY_ID, params); }
@Override protected AclChangeSetEntity getAclChangeSetEntity(Long aclChangeSetEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclChangeSetEntityId); return template.selectOne(SELECT_ACL_CHANGESET_BY_ID, params); }
@Override protected LocaleEntity getLocaleEntity(Long id) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", id); return template.selectOne(SELECT_LOCALE_BY_ID, params); }
@Override protected NodeEntity selectNodeById(Long id) { NodeEntity node = new NodeEntity(); node.setId(id); return template.selectOne(SELECT_NODE_BY_ID, node); }
@Override protected AppliedPatchEntity getAppliedPatchEntity(String id) { AppliedPatchEntity entity = new AppliedPatchEntity(); entity.setId(id); entity = template.selectOne(SELECT_APPLIED_PATCH_BY_ID, entity); // Could be null return entity; }
@Override protected ContentUrlEntity getContentUrlEntity(Long id) { ContentUrlEntity contentUrlEntity = new ContentUrlEntity(); contentUrlEntity.setId(id); contentUrlEntity = (ContentUrlEntity) template.selectOne(SELECT_CONTENT_URL_BY_ID, contentUrlEntity); // Done return contentUrlEntity; }
@Override protected ContentUrlEntity getContentUrlEntity(Long id) { ContentUrlEntity contentUrlEntity = new ContentUrlEntity(); contentUrlEntity.setId(id); contentUrlEntity = (ContentUrlEntity) template.selectOne(SELECT_CONTENT_URL_BY_ID, contentUrlEntity); // Done return contentUrlEntity; }
@Override protected QNameEntity findQNameEntityByNamespaceAndLocalName(Long nsId, String localName) { QNameEntity entity = new QNameEntity(); entity.setNamespaceId(nsId); entity.setLocalNameSafe(localName); entity = template.selectOne(SELECT_QNAME_BY_NS_AND_LOCALNAME, entity); return entity; }
public void rw() { Students students = (Students)sqlSessionTemplate.selectOne("selectByPrimaryKey", 1L); System.out.println(students.getName()); students.setName("rw"); sqlSessionTemplate.update("updateByPrimaryKeySelective", students); studentsMapper.updateByPrimaryKeySelective(students); students.setId(2L); studentsMapper.updateByPrimaryKeySelective(students); students = studentsMapper.selectByPrimaryKey(2L); System.out.println(students.getName()); // throw new RuntimeException(); }
@Override protected NodeEntity selectStoreRootNode(StoreRef storeRef) { StoreEntity store = new StoreEntity(); store.setProtocol(storeRef.getProtocol()); store.setIdentifier(storeRef.getIdentifier()); return template.selectOne(SELECT_STORE_ROOT_NODE_BY_REF, store); }