Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTemplate.find()


   */
  public List<AkteraUser> findUsersByGroup(AkteraGroup group)
  {
    HibernateTemplate htl = getHibernateTemplate();
    List<AkteraUser> users = new LinkedList();
    List<AkteraGroupEntry> entries = htl.find("from AkteraGroupEntry where groupId = ?", group.getId());
    for (AkteraGroupEntry entry : entries)
    {
      AkteraUser user = (AkteraUser) htl.get(AkteraUser.class, entry.getUserId());

      users.add(user);
View Full Code Here


    {
      HibernateTemplate htl = getHibernateTemplate();

      if (schedule.getPosition() > 1)
      {
        List<Schedule> prevSchedules = htl.find("from Schedule where position = ?", schedule.getPosition() - 1);

        if (prevSchedules.size() > 0)
        {
          prevSchedules.get(0).setPosition(schedule.getPosition());
          htl.update(prevSchedules.get(0));
View Full Code Here

  public boolean moveScheduleDown(Schedule schedule)
  {
    synchronized (Schedule.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      Integer maxPosition = (Integer) htl.find("select max(position) from Schedule").get(0);

      if (schedule.getPosition() < maxPosition)
      {
        List<Schedule> nextSchedules = htl.find("from Schedule where position = ?", schedule.getPosition() + 1);
View Full Code Here

      HibernateTemplate htl = getHibernateTemplate();
      Integer maxPosition = (Integer) htl.find("select max(position) from Schedule").get(0);

      if (schedule.getPosition() < maxPosition)
      {
        List<Schedule> nextSchedules = htl.find("from Schedule where position = ?", schedule.getPosition() + 1);

        if (nextSchedules.size() > 0)
        {
          nextSchedules.get(0).setPosition(schedule.getPosition());
          htl.update(nextSchedules.get(0));
View Full Code Here

  public boolean moveScheduleToFront(Schedule schedule)
  {
    synchronized (Schedule.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      List<Schedule> prevSchedules = htl.find("from Schedule where position < ?", schedule.getPosition());

      for (Schedule prevSchedule : prevSchedules)
      {
        prevSchedule.setPosition(prevSchedule.getPosition() + 1);
        htl.update(prevSchedule);
View Full Code Here

   * @see de.iritgo.aktera.configuration.preferences.PreferencesDAO#findPreferencesByUserId(java.lang.Integer)
   */
  public Preferences findPreferencesByUserId(Integer userId)
  {
    HibernateTemplate htl = getHibernateTemplate();
    List<Preferences> res = htl.find("from Preferences where userId = ?", userId);

    return res.size() > 0 ? res.get(0) : null;
  }

  /**
 
View Full Code Here

   * @see de.iritgo.aktera.configuration.preferences.PreferencesDAO#findPreferencesConfig(java.lang.Integer, java.lang.String, java.lang.String)
   */
  public PreferencesConfig findPreferencesConfig(Integer userId, String category, String name)
  {
    HibernateTemplate htl = getHibernateTemplate();
    List<PreferencesConfig> res = htl.find("from PreferencesConfig where userId = ? and category = ? and name = ?",
            new Object[]
            {
                    userId, category, name
            });

View Full Code Here

        if (spaces.size() == 0) {
            return null;
        }
        CountsHolder ch = new CountsHolder();
        HibernateTemplate ht = getHibernateTemplate();
        List<Object[]> loggedByList = ht.find("select item.space.id, count(item) from Item item"
                + " where item.loggedBy.id = ? group by item.space.id", user.getId());
        List<Object[]> assignedToList = ht.find("select item.space.id, count(item) from Item item"
                + " where item.assignedTo.id = ? group by item.space.id", user.getId());
        List<Object[]> statusList = ht.findByNamedParam("select item.space.id, count(item) from Item item"
                + " where item.space in (:spaces) group by item.space.id", "spaces", spaces);
View Full Code Here

        }
        CountsHolder ch = new CountsHolder();
        HibernateTemplate ht = getHibernateTemplate();
        List<Object[]> loggedByList = ht.find("select item.space.id, count(item) from Item item"
                + " where item.loggedBy.id = ? group by item.space.id", user.getId());
        List<Object[]> assignedToList = ht.find("select item.space.id, count(item) from Item item"
                + " where item.assignedTo.id = ? group by item.space.id", user.getId());
        List<Object[]> statusList = ht.findByNamedParam("select item.space.id, count(item) from Item item"
                + " where item.space in (:spaces) group by item.space.id", "spaces", spaces);
        for(Object[] oa : loggedByList) {
            ch.addLoggedByMe((Long) oa[0], (Long) oa[1]);
View Full Code Here

        return ch;
    }
   
    public Counts loadCountsForUserSpace(User user, Space space) {
        HibernateTemplate ht = getHibernateTemplate();
        List<Object[]> loggedByList = ht.find("select status, count(item) from Item item"
                + " where item.loggedBy.id = ? and item.space.id = ? group by item.status", new Object[] {user.getId(), space.getId()});
        List<Object[]> assignedToList = ht.find("select status, count(item) from Item item"
                + " where item.assignedTo.id = ? and item.space.id = ? group by item.status", new Object[] {user.getId(), space.getId()});
        List<Object[]> statusList = ht.find("select status, count(item) from Item item"
                + " where item.space.id = ? group by item.status", space.getId());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.