Package org.hibernate

Examples of org.hibernate.Session.save()


      cloud.setLength( length );

      for ( String description : producedSnowflakes ) {
        SnowFlake sf = new SnowFlake();
        sf.setDescription( description );
        session.save( sf );
        cloud.getProducedSnowFlakes().add( sf );
      }

      for ( String description : backupSnowflakes ) {
        SnowFlake sf = new SnowFlake();
View Full Code Here


      }

      for ( String description : backupSnowflakes ) {
        SnowFlake sf = new SnowFlake();
        sf.setDescription( description );
        session.save( sf );
        cloud.getBackupSnowFlakes().add( sf );
      }

      session.persist( cloud );
View Full Code Here

      annotatedCloud.setLength( length );

      for ( String description : producedSnowflakes ) {
        SnowFlake sf = new SnowFlake();
        sf.setDescription( description );
        session.save( sf );
        annotatedCloud.getProducedSnowFlakes().add( sf );
      }

      for ( String description : backupSnowflakes ) {
        SnowFlake sf = new SnowFlake();
View Full Code Here

      }

      for ( String description : backupSnowflakes ) {
        SnowFlake sf = new SnowFlake();
        sf.setDescription( description );
        session.save( sf );
        annotatedCloud.getBackupSnowFlakes().add( sf );
      }

      session.persist( annotatedCloud );
View Full Code Here

   }

   public Object create(Object obj) throws Exception
   {
      Session session = openSession();
      session.save(obj);
      session.flush();
      return obj;
   }

   public Object update(Object obj) throws Exception
View Full Code Here

    public void testSetCurrentWorkspace() throws Exception {
        Session session = sessionManager.getSession();
        SqlWorkspace sqlWorkspace = new SqlWorkspace();
        sqlWorkspace.setWorkspaceId("WORKSPACE_1");
        sqlWorkspace.setDisplayTitle("workspace1");
        session.save(sqlWorkspace);

        User user = sqlUserRepository.addUser("123", "abc", null, null, new String[0]);
        sqlUserRepository.setCurrentWorkspace(user.getUserId(), sqlWorkspace.getWorkspaceId());
        SqlUser testUser = (SqlUser) sqlUserRepository.findById(user.getUserId());
        assertEquals("workspace1", testUser.getCurrentWorkspace().getDisplayTitle());
View Full Code Here

        notification.setSeverity(severity);
        notification.setTitle(title);
        notification.setMessage(message);
        notification.setStartDate(startDate);
        notification.setEndDate(endDate);
        session.save(notification);
        return notification;
    }

    @Override
    public SystemNotification updateNotification(SystemNotification notification) {
View Full Code Here

                newUser.setPassword(salt, passwordHash);
            }
            newUser.setUserStatus(UserStatus.OFFLINE);
            newUser.setPrivilegesString(Privilege.toString(getDefaultPrivileges()));
            LOGGER.debug("add %s to user table", displayName);
            session.save(newUser);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
            }
View Full Code Here

            sqlWorkspaceUser.setUser((SqlUser) user);
            sqlWorkspaceUser.setWorkspace(newWorkspace);

            LOGGER.debug("add %s to workspace table", title);
            newWorkspace.getSqlWorkspaceUserList().add(sqlWorkspaceUser);
            session.save(newWorkspace);
            session.save(sqlWorkspaceUser);
            session.update(user);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
View Full Code Here

            sqlWorkspaceUser.setWorkspace(newWorkspace);

            LOGGER.debug("add %s to workspace table", title);
            newWorkspace.getSqlWorkspaceUserList().add(sqlWorkspaceUser);
            session.save(newWorkspace);
            session.save(sqlWorkspaceUser);
            session.update(user);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
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.