org.hibernate.classic.Session.get()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(251)

本文整理了Java中org.hibernate.classic.Session.get()方法的一些代码示例,展示了Session.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.get()方法的具体详情如下:
包路径:org.hibernate.classic.Session
类名称:Session
方法名:get

Session.get介绍

暂无

代码示例

代码示例来源:origin: gocd/gocd

public User load(final long id) {
  return (User) transactionTemplate.execute((TransactionCallback) transactionStatus -> sessionFactory.getCurrentSession().get(User.class, id));
}

代码示例来源:origin: denimgroup/threadfix

@Override
public ChannelSeverity retrieveById(int id) {
  return (ChannelSeverity) sessionFactory.getCurrentSession().get(
      ChannelSeverity.class, id);
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

public Blueprint getBlueprintByIdInternal(String uuid) {
  Blueprint bluePrint = (Blueprint) factory.getCurrentSession().get(Blueprint.class, uuid);
  // updateBluePrintFromUserApplication(bluePrint);
  return bluePrint;
}

代码示例来源:origin: denimgroup/threadfix

@Override
public ChannelVulnerability retrieveById(int id) {
  return (ChannelVulnerability) sessionFactory.getCurrentSession().get(
      ChannelVulnerability.class, id);
}

代码示例来源:origin: madvirus/spring4

@Override
public Item findById(Integer itemId) {
  Item item = (Item) sessionFactory.getCurrentSession().get(Item.class, itemId);
  return item;
}

代码示例来源:origin: denimgroup/threadfix

@Override
public EmptyScan retrieveById(Integer emptyScanId) {
  return (EmptyScan) sessionFactory.getCurrentSession().get(EmptyScan.class, emptyScanId);
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

public Blueprint getBlueprintByIdInternal(String uuid) {
  Blueprint bluePrint = (Blueprint) factory.getCurrentSession().get(Blueprint.class, uuid);
  // updateBluePrintFromUserApplication(bluePrint);
  return bluePrint;
}

代码示例来源:origin: denimgroup/threadfix

@Override
public Survey retrieveById(int id) {
  return (Survey) sessionFactory.getCurrentSession().get(Survey.class, id);
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

@Override
public TerritoryCategory findCategoryById(String territoryCategoryId) throws GeomajasSecurityException {
  return (TerritoryCategory) factory.getCurrentSession().get(TerritoryCategory.class, territoryCategoryId);
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

@Override
public User findById(long userId) throws GeomajasSecurityException {
  return (User) factory.getCurrentSession().get(User.class, userId);
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

@Override
public boolean deleteGroup(long groupId) throws GeomajasSecurityException {
  Object group = factory.getCurrentSession().get(Territory.class, groupId);
  if (group != null) {
    factory.getCurrentSession().delete(group);
    return true;
  }
  return false;
}

代码示例来源:origin: denimgroup/threadfix

@Override
public Vulnerability retrieveById(int id) {
  Vulnerability vuln = (Vulnerability) sessionFactory.getCurrentSession()
      .get(Vulnerability.class, id);
  if (vuln != null && !vuln.isExpired()) {
    return vuln;
  } else {
    assert false : "Attempted to retrieve invalid vulnerability id.";
    return null;
  }
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

@Override
public AuthenticationSession getActiveSessionOfToken(String token) {
  if (token != null) {
    AuthenticationSession session = (AuthenticationSession) sessionFactory.
        getCurrentSession().get(AuthenticationSession.class, token);
    if (session != null && isActive(session)) {
      return session;
    }
  }
  return null;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

@Override
public boolean deleteUser(long userId) throws GeomajasSecurityException {
  Object user = factory.getCurrentSession().get(User.class, userId);
  if (user != null) {
    factory.getCurrentSession().delete(user);
    return true;
  }
  return false;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

@Override
public boolean deleteGroup(long groupId) throws GeomajasSecurityException {
  Object group = factory.getCurrentSession().get(Territory.class, groupId);
  if (group != null) {
    factory.getCurrentSession().delete(group);
    return true;
  }
  return false;
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

@Override
public boolean deleteUser(long userId) throws GeomajasSecurityException {
  Object user = factory.getCurrentSession().get(User.class, userId);
  if (user != null) {
    factory.getCurrentSession().delete(user);
    return true;
  }
  return false;
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

@Override
public List<GroupMember> findGroupsOfUser(long userId) {
  User user = (User) factory.getCurrentSession().get(User.class, userId);
  List<GroupMember> groups = user.getGroups();
  Hibernate.initialize(groups);
  return groups;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

@Override
public List<GroupMember> findGroupsOfUser(long userId) {
  User user = (User) factory.getCurrentSession().get(User.class, userId);
  List<GroupMember> groups = user.getGroups();
  Hibernate.initialize(groups);
  return groups;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

public LayerModel getLayerModelById(String id) throws GeomajasSecurityException {
  LayerModel l = (LayerModel) factory.getCurrentSession().get(LayerModel.class, id);
  if (l != null) {
    if (((DeskmanagerSecurityContext) securityContext).readAllowed(l)) {
      return l;
    } else {
      throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Read layermodel",
          securityContext.getUserName());
    }
  } else {
    return null;
  }
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

public Geodesk getGeodeskById(String uuid) throws GeomajasSecurityException {
  Geodesk l = (Geodesk) factory.getCurrentSession().get(Geodesk.class, uuid);
  if (l != null) {
    if (((DeskmanagerSecurityContext) securityContext).readAllowed(l)) {
      return l;
    } else {
      throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Read Geodesk",
          securityContext.getUserName());
    }
  } else {
    return null;
  }
}

相关文章