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

<!-- ===================================================================== -->
<!--                                                                       -->
<!--  UUID Key Generator Factory Service Configuration                     -->
<!--                                                                       -->
<!-- ===================================================================== -->

<server>

  <!-- UUIDKeyGeneratorFactoryService -->
  <mbean code="org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactoryService"
         name="jboss:service=KeyGeneratorFactory,type=UUID">
  </mbean>

  <!-- HiLoKeyGeneratorFactory -->
  <mbean code="org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory"
         name="jboss:service=KeyGeneratorFactory,type=HiLo">

     <depends>jboss:service=TransactionManager</depends>

     <!-- Attributes common to HiLo factory instances -->

     <!-- DataSource JNDI name -->
     <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>

     <!-- table name -->
     <attribute name="TableName">HILOSEQUENCES</attribute>

     <!-- Column that contains sequence name -->
     <attribute name="SequenceColumn">SEQUENCENAME</attribute>

     <!-- Column that contains hi values -->
     <attribute name="IdColumnName">HIGHVALUES</attribute>

     <!-- Create table DDL - DDL should be in a single line without line breaks to work with DB2 7.2 -->
     <attribute name="CreateTableDdl">
        create table HILOSEQUENCES (SEQUENCENAME varchar(50) not null, HIGHVALUES integer not null, constraint hilo_pk primary key (SEQUENCENAME))
     </attribute>

     <!-- Uncomment to make it cluster-safe: Select current Hi value query (FOR UPDATE is recommended)
     <attribute name="SelectHiSql">
        select HIGHVALUES from HILOSEQUENCES where SEQUENCENAME='general' FOR UPDATE
     </attribute>                                                  
     -->

     <!-- whether the table should be created (if doesn't exist yet) at the start phase -->
     <attribute name="CreateTable">true</attribute>

     <!-- whether the table should be dropped (if exists) at the stop phase -->
     <attribute name="DropTable">false</attribute>

     <!-- Instance-specific attributes -->

     <!-- JNDI name -->
     <attribute name="FactoryName">HiLoKeyGeneratorFactory</attribute>

     <!-- Sequence name which this factory will use -->
     <attribute name="SequenceName">general</attribute>

     <!-- Block size -->
     <attribute name="BlockSize">10</attribute>
  </mbean>

</server>

