Examples of HibernateTemplate


Examples of org.springframework.orm.hibernate3.HibernateTemplate

  /**
   * @see de.iritgo.aktera.authentication.defaultauth.entity.UserDAO#findGroupsByUser(de.iritgo.aktera.authentication.defaultauth.entity.AkteraUser)
   */
  public List<AkteraGroup> findGroupsByUser(AkteraUser user)
  {
    HibernateTemplate htl = getHibernateTemplate();
    List<AkteraGroup> groups = new LinkedList();
    List<AkteraGroupEntry> entries = htl.find("from AkteraGroupEntry where userId = ?", user.getId());

    for (AkteraGroupEntry entry : entries)
    {
      AkteraGroup group = (AkteraGroup) htl.get(AkteraGroup.class, entry.getGroupId());

      groups.add(group);
    }

    return groups;
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  /**
   * @see de.iritgo.aktera.authentication.defaultauth.entity.UserDAO#findUsersByGroup(de.iritgo.aktera.authentication.defaultauth.entity.AkteraGroup)
   */
  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);
    }
    return users;
  }
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  @Transactional(readOnly = false)
  public boolean moveScheduleUp(Schedule schedule)
  {
    synchronized (Schedule.class)
    {
      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));
        }

        schedule.setPosition(schedule.getPosition() - 1);
        htl.update(schedule);

        return true;
      }

      return false;
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  @Transactional(readOnly = false)
  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);

        if (nextSchedules.size() > 0)
        {
          nextSchedules.get(0).setPosition(schedule.getPosition());
          htl.update(nextSchedules.get(0));
        }

        schedule.setPosition(schedule.getPosition() + 1);
        htl.update(schedule);

        return true;
      }

      return false;
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  @Transactional(readOnly = false)
  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);
      }

      if (schedule.getPosition() != 1)
      {
        schedule.setPosition(1);
        htl.update(schedule);

        return true;
      }

      return false;
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  @Transactional(readOnly = false)
  public boolean moveScheduleToEnd(Schedule schedule)
  {
    synchronized (Schedule.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      Integer maxPosition = (Integer) htl.find("select max(position) from Schedule").get(0);
      List<Schedule> nextSchedules = htl.find("from Schedule where position > ?", schedule.getPosition());

      for (Schedule nextSchedule : nextSchedules)
      {
        nextSchedule.setPosition(nextSchedule.getPosition() - 1);
        htl.update(nextSchedule);
      }

      if (schedule.getPosition() != maxPosition)
      {
        schedule.setPosition(maxPosition);
        htl.update(schedule);

        return true;
      }

      return false;
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  /**
   * @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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

  /**
   * @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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

    /**
     * Sets Hibernate session factory.
     */
    public void setSessionFactory(SessionFactory sessionFactory) {
        template = new HibernateTemplate(sessionFactory);
    }
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

    /**
     * Sets Hibernate session factory.
     */
    public void setSessionFactory(SessionFactory sessionFactory) {
        template = new HibernateTemplate(sessionFactory);
    }
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.