alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (hibernate-service.xml)

This example Hibernate source code file (hibernate-service.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

adapter, adapter, blockingtimeoutmillis, build, bycontainer, bycontainer, jboss, managedconnectionfactoryname, managedconnectionfactoryproperties, oldrardeployment, resource, resource, subject, subject

The Hibernate hibernate-service.xml source code

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!--                                                                       -->
<!--  JBoss Server Configuration                                           -->
<!--                                                                       -->
<!-- ===================================================================== -->

<server>

  <!-- ==================================================================== -->
  <!-- New ConnectionManager setup for mysql using 2.0.11 driver            -->
  <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
  <!-- ==================================================================== -->

  <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=Hibernate Resource Adapter">

    <attribute name="JndiName">jca/test
    <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->
      <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=Hibernate Resource Adapter">

	        <attribute name="ManagedConnectionFactoryProperties">
	          <properties>
	            <config-property>
	              <config-property-name>ConnectionURL
	              <config-property-type>java.lang.String
	              <config-property-value>jdbc:mysql:///test
	            </config-property>
	            <config-property>
	              <config-property-name>DriverClass
	              <config-property-type>java.lang.String
	              <config-property-value>com.mysql.jdbc.Driver
	            </config-property>
	            <config-property>
	              <config-property-name>Password
	              <config-property-type>java.lang.String
	              <config-property-value>
	            </config-property>
	            <config-property>
	              <config-property-name>UserName
	              <config-property-type>java.lang.String
	              <config-property-value>dbradby
	            </config-property>
	            <config-property>
	              <config-property-name>Dialect
	              <config-property-type>java.lang.String
	              <config-property-value>org.hibernate.dialect.MySQLDialect
	            </config-property>
	            <config-property>
	              <config-property-name>MapResources
	              <config-property-type>java.lang.String
	              <config-property-value>Simple.hbm.xml
	            </config-property>
	          </properties>
        </attribute>

<!--Below here are advanced properties -->
        <!--hack-->
        <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Hibernate Resource Adapter

      </mbean>
    </depends>
    <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->
      <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=Hibernate Resource Adapter">

        <attribute name="MinSize">0
        <attribute name="MaxSize">50
        <attribute name="BlockingTimeoutMillis">5000
        <attribute name="IdleTimeoutMinutes">15
        <!--criteria indicates if Subject (from security domain) or app supplied
            parameters (such as from getConnection(user, pw)) are used to distinguish
            connections in the pool. Choices are
            ByContainerAndApplication (use both),
            ByContainer (use Subject),
            ByApplication (use app supplied params only),
            ByNothing (all connections are equivalent, usually if adapter supports
              reauthentication)-->
        <attribute name="Criteria">ByContainer
      </mbean>

    </depends>
    <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

    <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

    <!--make the rar deploy! hack till better deployment-->
    <depends>jboss.jca:service=RARDeployer
    <attribute name="TransactionManager">java:/TransactionManager
  </mbean>


</server>

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate hibernate-service.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.