Package org.springframework.orm.hibernate3

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


    return (User) getObject(User.class, id);
  }

    public User getUser(String username) {
        HibernateTemplate ht = getHibernateTemplate();
        User user = (User)ht.find("from User user where user.username = '"+username+"'");
        return (user);
    }

    public void saveUser(User user) {
    HibernateTemplate ht = getHibernateTemplate();
View Full Code Here


  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);
View Full Code Here

  {
    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);
View Full Code Here

    {
      HibernateTemplate htl = getHibernateTemplate();

      if (action.getPosition() > 1)
      {
        List<ScheduleAction> prevActions = htl.find(
                "from ScheduleAction where scheduleId = ? and position = ?", new Object[]
                {
                        action.getScheduleId(), action.getPosition() - 1
                });
View Full Code Here

  public boolean moveScheduleActionDown(ScheduleAction action)
  {
    synchronized (ScheduleAction.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      Integer maxPosition = (Integer) htl.find("select max(position) from ScheduleAction where scheduleId = ?",
              action.getScheduleId()).get(0);

      if (action.getPosition() < maxPosition)
      {
        List<ScheduleAction> nextActions = htl.find(
View Full Code Here

      Integer maxPosition = (Integer) htl.find("select max(position) from ScheduleAction where scheduleId = ?",
              action.getScheduleId()).get(0);

      if (action.getPosition() < maxPosition)
      {
        List<ScheduleAction> nextActions = htl.find(
                "from ScheduleAction where scheduleId = ? and position = ?", new Object[]
                {
                        action.getScheduleId(), action.getPosition() + 1
                });
View Full Code Here

  public boolean moveScheduleActionToFront(ScheduleAction action)
  {
    synchronized (ScheduleAction.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      List<ScheduleAction> prevActions = htl.find("from ScheduleAction where scheduleId = ? and position < ?",
              new Object[]
              {
                      action.getScheduleId(), action.getPosition()
              });
View Full Code Here

  public boolean moveScheduleActionToEnd(ScheduleAction action)
  {
    synchronized (ScheduleAction.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      Integer maxPosition = (Integer) htl.find("select max(position) from ScheduleAction where scheduleId = ?",
              action.getScheduleId()).get(0);
      List<ScheduleAction> nextActions = htl.find("from ScheduleAction where scheduleId = ? and position > ?",
              new Object[]
              {
                      action.getScheduleId(), action.getPosition()
View Full Code Here

    synchronized (ScheduleAction.class)
    {
      HibernateTemplate htl = getHibernateTemplate();
      Integer maxPosition = (Integer) htl.find("select max(position) from ScheduleAction where scheduleId = ?",
              action.getScheduleId()).get(0);
      List<ScheduleAction> nextActions = htl.find("from ScheduleAction where scheduleId = ? and position > ?",
              new Object[]
              {
                      action.getScheduleId(), action.getPosition()
              });
View Full Code Here

   */
  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());

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.