title: How can I tell my database that some changes are made by hibernate and not by other application?
body: <p>I'm new in working with hibernate and I've got this isue.
  I work with Oracle db and Hibernate+Maven+Netbeans. My purpose is to be able to do changes in my database only with my authorized app. Making changes from SQL console or others programs should not be possible. For this I made a table in my database:</p>
  
  <pre><code>CREATE TABLE DATA(
     name  char(30),
     day   integer,
     month integer,
     year  integer );
  </code></pre>
  
  <p>And a trigger like this which restricts any access on my database:</p>
  
  <pre><code>  CREATE OR REPLACE TRIGGER tri_block
       BEFORE INSERT OR UPDATE OR DELETE ON data
      BEGIN
         IF  TO_NUMBER(TO_CHAR(SYSDATE,'hh24')) &lt; 12
             OR TO_NUMBER(TO_CHAR(SYSDATE,'hh24')) &gt;= 12
              OR TO_CHAR(SYSDATE,'dy') in ('sun','sat') THEN 
      RAISE_APPLICATION_ERROR (-20000, 'changes can not be made');
      END IF;
     END;
  </code></pre>
  
  <p>And this is my HibernateUtil.java :</p>
  
  <pre><code> package com.scooby.util;
  
      import com.scooby.DATA;
      import org.hibernate.SessionFactory;
      import org.hibernate.cfg.AnnotationConfiguration;
  
  public class HibernateUtil {
  
      private static final SessionFactory sessionFactory = buildSessionFactory();
  
      private static SessionFactory buildSessionFactory() {
          try {
              // Create the SessionFactory from hibernate.cfg.xml
              return new AnnotationConfiguration().configure()
                                  .addAnnotatedClass(DATA.class).buildSessionFactory();
          } catch (Throwable ex) {
              // Make sure you log the exception, as it might be swallowed
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
      }
  
      public static SessionFactory getSessionFactory() {
          return sessionFactory;
      }
  
      public static void shutdown() {
          // Close caches and connection pools
          getSessionFactory().close();
      }
  
    }
  </code></pre>
  
  <p>I heard something about ORACLE contexts and something about the session in hibernate. Can someone explain me?</p>