View RSS Feed

My Java Tips

  1. hibernate.connection.rele ase_mode

    by , 05-25-2011 at 09:49 AM (My Java Tips)
    Hibernate JDBC/Connection's property hibernate.connection.release_mode is used to specify when Hibernate should release JDBC connections.

    A JDBC connection is held until the session is explicitly closed or disconnected by default. For a JTA datasource, one should use after_statement to aggressively release connections after every JDBC call. And for a non-JTA connection, it often makes sense to release the connection at the end of each transaction. after_transaction.auto will
    ...
    Categories
    Hibernate
  2. SessionFactory Monitoring

    by , 05-21-2011 at 10:37 PM (My Java Tips)
    There are few ways of accessing SessionFactory metrics. One of them is to use JMX to publish metrics. For that you need to enable the StatisticsService MBean. A single MBean can be enabled for your SessionFactory or one per factory.

    Following snippet presents a configuration example:

    Java Code:
    // MBean service registration for a specific SessionFactory
    Hashtable tb = new Hashtable();
    tb.put("type", "statistics");
    tb.put("sessionFactory",
    ...
    Categories
    Hibernate