Enabling browse access, Hibernate applications – HP Integrity NonStop J-Series User Manual
Page 115

NOTE:
com.mchange.v2.c3p0.ComboPooledDataSource
is part of jar file located in <
Hibernate Home>\lib\optional\c3p0
The jar file is c3p0-0.9.1.jar in Hibernate versions 3.6.8 and 4.1.1. This file must be added
to the application classpath.
Enabling Browse Access
Browse Access is an SQL/MX specific feature, which allows you to read uncommitted data from
a table. The feature uses the Hibernate interceptor, which intercepts SQL queries and appends
for browse access
string based on the configurations defined in the query filtering criteria of
BrowseAccessIncludeExcludeList.xml
file. You can use the Browse Access feature in
Hibernate
applications, and Spring and Hibernate applications.
Hibernate
Applications
For Hibernate applications, the interceptor cannot be injected on the Hibernate Configuration
object through the configuration. Code must be changed to inject the interceptor on the
Configuration
object. The changes required to enable Browse Access feature are:
1.
Inject the interceptor on the Configuration object in one of the following ways:
a.
Specify a session-scoped interceptor by opening a session with a call to one of the
overloaded SessionFactory.openSession() methods, which accepts an
Interceptor
. For example:
Configuration cfg = new Configuration().configure();
SessionFactory sessFactory= cfg.buildSessionFactory();
Session session =
sessFactory.openSession(org.hibernate.dialect.SqlmxInterceptor.getInterceptorInstance());
b.
Specify a SessionFactory-scoped interceptor on the Hibernate Configuration
object prior to building the SessionFactory. All session factories built with this
Configuration
object have the interceptor set. For example:
Configuration cfg = new Configuration().configure();
cfg.setInterceptor(SqlmxInterceptor.getInterceptorInstance()));
SessionFactory sessFactory= cfg.buildSessionFactory();
Configuring Hibernate Applications on NonStop Systems
115