Yes, I'm using NetBeans. I'll look around for info on that.
I did figure out how to configure Glassfish to use the MySQL pools using the admin interface. Here are the settings that it generated:
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/MySQLPool" object-type="user" pool-name="MySQLPool">
<description>MySQL Pool</description>
</jdbc-resource>
...
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" c
onnection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-
validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource" fail-all-connecti
ons="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="false" lazy-conne
ction-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size=
"32" max-wait-time-in-millis="60000" name="MySQLPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax
.sql.ConnectionPoolDataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wra
p-jdbc-objects="false">
<property name="roleName" value="myrole"/>
<property name="user" value="me"/>
<property name="password" value="mypassword"/>
<property name="networkProtocol" value="jdbc"/>
<property name="portNumber" value="3306"/>
<property name="serverName" value="myhost"/>
<property name="databaseName" value="my_database"/>
<property name="datasourceName" value="my_datasource"/>
</jdbc-connection-pool>
I had to add the mysql connector located here:
/usr/local/lib/mysql-connector-java-5.1.6-bin.jar
to the Glassfish's Classpath using the Admin interface for the Glassfish JVM as well. (I'm not sure if this is the preferred way to add the JDBC driver to Glassfish.)
I read up more on the Hibernate configuration and came up with this so far:
<hibernate-configuration>
<session-factory name="hibernate/MySessionFactory">
<property name="connection.datasource">jdbc/MySQLPool</property>
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="hibernate.jdbc.batch_size">500</property>
<!-- Control echoing all executed SQL to stdout -->
<property name="show_sql">false</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">false</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
...
</hibernate-configuration>
I'm not sure what Hibernate is going to do with this in terms of using the MySQL database pool.
Now, I'm creating a static block in my MDB to initialize the hibernate Session Manager.
I'll see how that goes once I get the JNDI issues worked out.
I'd also like to add the Hibernate SessionManager as a service rather than initializing it through a static block in the MDB. I noticed that Hibernate can be loaded as a JCA component...what have others been doing? (I imagine I could create a session bean to do this kind of thing as well.)
[Message sent by forum member 'rrr6399' (rrr6399)]
http://forums.java.net/jive/thread.jspa?messageID=284169