Package org.hibernate

Examples of org.hibernate.Session.beginTransaction()


  // GUI thread
  private void addActionAll(final TreeItem item, Class clazz) {
    synchronized (synchro) {
      synchronized (sync_tree) {
        final Session session = synchro.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        try  {
          for (final VisualElement elt : VisualElement.getSubElements(item, Target.class)) {
          final Target target = (Target) elt;

          boolean already_has_action = false;
View Full Code Here


        final VisualElement visual_element = (VisualElement) item.getData(VisualElement.class.toString());
        if (item.getParentItem() == null) return;
        final VisualElement visual_parent = (VisualElement) item.getParentItem().getData(VisualElement.class.toString());

        final Session session = synchro.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        try {
          visual_element.removeVisualElements(visual_parent);
          session.getTransaction().commit();
        } catch (final Exception ex) {
          log.error("Exception", ex);
View Full Code Here

   */
  private void removeActionOrView(final TreeItem item, final Class clazz) {
    synchronized (synchro) {
      synchronized (sync_tree) {
        final Session session = synchro.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        try  {
          for (final VisualElement action : VisualElement.getSubElements(item, clazz))
            if (action.getParents().size() == 1)
              action.removeVisualElements(action.getParents().get(0));
          session.getTransaction().commit();
View Full Code Here

    synchronized (synchro) {
      // should be localized
      String str = "<HR/><B>Database statistics</B><BR/>";

      Session session = getSynchro().getSessionFactory().getCurrentSession();
      session.beginTransaction();
      try {
        Integer count = (Integer) session.createQuery("select count(*) from EventGeneric").uniqueResult();
        str += "total number of events: " + count + "<BR/>";
        count = (Integer) session.createQuery("select count(*) from Target").uniqueResult();
        str += "total number of targets: " + count + "<BR/>";
View Full Code Here

      if (getGUI().getConfig().getDebugLevel() == 1) {
        synchronized (getGUI().getSynchro()) {
          synchronized (getGUI().sync_tree) {
            final Session session = getGUI().getSynchro().getSessionFactory().getCurrentSession();
            session.beginTransaction();
            try {
              session.update(this);
//              log.debug("ActionPing::invoke(): starting adding a bunch of events");
              for (int i = 1; i < 50; i++)
                getTarget().addEvent(new EventReachable(true, 10));
View Full Code Here

    }

    synchronized (synchro) {
      synchronized (sync_tree) {
        final Session session = synchro.getSessionFactory().getCurrentSession();
        session.beginTransaction();

        try  {
          // should be localized
          String str = "<TABLE BORDER='0' BGCOLOR='black' cellspacing='1' cellpadding='1'>" +
          "<TR><TD bgcolor='lightyellow' align='left'><B>" + htmlFace("target") + "</B></TD>" +
View Full Code Here

            Pattern.compile(address + getGUI().getConfig().getProperty("ping.regex")).matcher(cmd_output);

          synchronized (getGUI().getSynchro()) {
            synchronized (getGUI().sync_tree) {
              final Session session = getGUI().getSynchro().getSessionFactory().getCurrentSession();
              session.beginTransaction();
              try {
                session.update(this); // pour le setDescription() => � enlever qd la description ne sera plus persistente
                if (match.find() == true) {
                  final int delay = new Integer(match.group(2)).intValue();
View Full Code Here

          final Matcher match =
            Pattern.compile(getGUI().getConfig().getProperty("ping.regex")).matcher(cmd_output);
          synchronized (getGUI().getSynchro()) {
            synchronized (getGUI().sync_tree) {
              final Session session = getGUI().getSynchro().getSessionFactory().getCurrentSession();
              session.beginTransaction();
              try {
                session.update(this); // pour le setDescription() => � enlever qd la description ne sera plus persistente
                                      // pour ce update, lors d'un mergeEventsSimple() : Illegal attempt to associate a collection with two open sessions
                if (match.find() == true) {
                  final int delay = new Integer(match.group(2)).intValue();
View Full Code Here

    } catch (final InterruptedException ex) {

      synchronized (getGUI().getSynchro()) {
        synchronized (getGUI().sync_tree) {
          final Session session = getGUI().getSynchro().getSessionFactory().getCurrentSession();
          session.beginTransaction();
          try {
            session.update(this); // pour le setDescription() => � enlever qd la description ne sera plus persistente

            getTarget().addEvent(new EventReachable(false));
            // mettre un setstatus comme pour IPv4
View Full Code Here

        dialog.open();

        synchronized (synchro) {
          synchronized (sync_tree) {
            final Session session = synchro.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            try  {
              session.update(querier);
              if (dialog.getVersion() != version) querier.setVersion(dialog.getVersion());
              if (dialog.getSec() != sec) querier.setSec(dialog.getSec());
              if (dialog.getRetries() != port_src) querier.setRetries(dialog.getRetries());
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.