1 Reply Latest reply on Jun 13, 2006 4:15 AM by Boerre Brox

    hibernate, saving and updating doesn't do anything

    Boerre Brox Newbie

      Hi.

      I've recently upgraded from jboss 4.0.3 to 4.0.4GA, and I've had some troubles getting hibernate to work correctly. I'm almost there now, except whenever I try to make changes to the database, nothing happens!?

      So there must be something I'm missing..
      Either my config is wrong, or my strategy is wrong.

      this is my jboss-service.xml:

      <server>
       <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.TRIM:name=HibernateSessionFactory">
       <!-- Wait for the Postgres Datasource to be defined -->
       <!-- <depends>jboss.jca:service=RARDeployer</depends> -->
       <!-- <depends>jboss.jca:service=LocalTxCM,name=PostgresDS</depends> -->
       <depends>jboss.jca:service=DataSourceBinding,name=PostgresDS</depends>
      
       <attribute name="DatasourceName">java:/PostgresDS</attribute>
       <attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
       <attribute name="Username">admin</attribute>
       <attribute name="Password">123456</attribute>
       <attribute name="SessionFactoryName">java:/hibernate/TRIMSessionFactory</attribute>
      
      
       <!-- We do want hibernate to look everywhere for mapping files-->
       <attribute name="ScanForMappingsEnabled">true</attribute>
      
       <!-- We also want to see the actual SQL -->
       <attribute name="ShowSqlEnabled">true</attribute>
       <attribute name="SqlCommentsEnabled">true</attribute>
      
       <!-- Second level caching -->
       <attribute name="SecondLevelCacheEnabled">true</attribute>
       <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
       <attribute name="QueryCacheEnabled">false</attribute>
      
       </mbean>
      </server>
      


      and this is how I use hibernate.

       public boolean saveEditedRelationType ( RelationType relationType) {
       try {
       // Get session from session factory
       Session session = HibernateSessionFactory.currentSession();
      
       // Tell hibernate to save to database, gets the object ID in return
       session.saveOrUpdate( relationType );
      
       return true;
      
       } catch (HibernateException hex) {
      



      when I use the ShowSqlEnabled in my config, I only see selects in the output.. shouldn't there be updates or inserts?