Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hibernate.id
Class HQMultipleHiLoPerTableGenerator

java.lang.Object
  extended by org.hibernate.engine.TransactionHelper
      extended by org.hyperic.hibernate.id.HQMultipleHiLoPerTableGenerator
All Implemented Interfaces:
org.hibernate.id.Configurable, org.hibernate.id.IdentifierGenerator, org.hibernate.id.PersistentIdentifierGenerator

public class HQMultipleHiLoPerTableGenerator
extends org.hibernate.engine.TransactionHelper
implements org.hibernate.id.PersistentIdentifierGenerator, org.hibernate.id.Configurable

A hilo IdentifierGenerator that returns a Long, constructed using a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction to the Session transaction so the generator must be able to obtain a new connection and commit it. Hence this implementation may not be used when the user is supplying connections. In this case a SequenceHiLoGenerator would be a better choice (where supported).

A hilo IdentifierGenerator that uses a database table to store the last generated values. A table can contains several hi values. They are distinct from each other through a key

This implementation is not compliant with a user connection

Allowed parameters (all of them are optional):


Field Summary
static int DEFAULT_INITIAL_HI
           
static java.lang.String DEFAULT_TABLE
           
static java.lang.String ID_TABLE
           
static java.lang.String INITIAL_HI
           
static java.lang.String MAX_LO
           
static java.lang.String PK_COLUMN_NAME
           
static java.lang.String PK_LENGTH_NAME
           
static java.lang.String PK_VALUE_NAME
           
static java.lang.String VALUE_COLUMN_NAME
           
 
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, PK, SCHEMA, SQL, TABLE, TABLES
 
Fields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME
 
Constructor Summary
HQMultipleHiLoPerTableGenerator()
           
 
Method Summary
 void configure(org.hibernate.type.Type type, java.util.Properties params, org.hibernate.dialect.Dialect dialect)
           
 java.io.Serializable doWorkInCurrentTransaction(java.sql.Connection conn, java.lang.String sql)
           
 java.io.Serializable generate(org.hibernate.engine.SessionImplementor session, java.lang.Object obj)
           
 java.lang.Object generatorKey()
           
 java.lang.String[] sqlCreateStrings(org.hibernate.dialect.Dialect dialect)
           
 java.lang.String[] sqlDropStrings(org.hibernate.dialect.Dialect dialect)
           
 
Methods inherited from class org.hibernate.engine.TransactionHelper
doWorkInNewTransaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_TABLE

public static final java.lang.String ID_TABLE
See Also:
Constant Field Values

PK_COLUMN_NAME

public static final java.lang.String PK_COLUMN_NAME
See Also:
Constant Field Values

PK_VALUE_NAME

public static final java.lang.String PK_VALUE_NAME
See Also:
Constant Field Values

VALUE_COLUMN_NAME

public static final java.lang.String VALUE_COLUMN_NAME
See Also:
Constant Field Values

PK_LENGTH_NAME

public static final java.lang.String PK_LENGTH_NAME
See Also:
Constant Field Values

INITIAL_HI

public static final java.lang.String INITIAL_HI
See Also:
Constant Field Values

DEFAULT_INITIAL_HI

public static final int DEFAULT_INITIAL_HI
See Also:
Constant Field Values

DEFAULT_TABLE

public static final java.lang.String DEFAULT_TABLE
See Also:
Constant Field Values

MAX_LO

public static final java.lang.String MAX_LO
See Also:
Constant Field Values
Constructor Detail

HQMultipleHiLoPerTableGenerator

public HQMultipleHiLoPerTableGenerator()
Method Detail

sqlCreateStrings

public java.lang.String[] sqlCreateStrings(org.hibernate.dialect.Dialect dialect)
                                    throws org.hibernate.HibernateException
Specified by:
sqlCreateStrings in interface org.hibernate.id.PersistentIdentifierGenerator
Throws:
org.hibernate.HibernateException

sqlDropStrings

public java.lang.String[] sqlDropStrings(org.hibernate.dialect.Dialect dialect)
                                  throws org.hibernate.HibernateException
Specified by:
sqlDropStrings in interface org.hibernate.id.PersistentIdentifierGenerator
Throws:
org.hibernate.HibernateException

generatorKey

public java.lang.Object generatorKey()
Specified by:
generatorKey in interface org.hibernate.id.PersistentIdentifierGenerator

doWorkInCurrentTransaction

public java.io.Serializable doWorkInCurrentTransaction(java.sql.Connection conn,
                                                       java.lang.String sql)
                                                throws java.sql.SQLException
Specified by:
doWorkInCurrentTransaction in class org.hibernate.engine.TransactionHelper
Throws:
java.sql.SQLException

generate

public java.io.Serializable generate(org.hibernate.engine.SessionImplementor session,
                                     java.lang.Object obj)
                              throws org.hibernate.HibernateException
Specified by:
generate in interface org.hibernate.id.IdentifierGenerator
Throws:
org.hibernate.HibernateException

configure

public void configure(org.hibernate.type.Type type,
                      java.util.Properties params,
                      org.hibernate.dialect.Dialect dialect)
               throws org.hibernate.MappingException
Specified by:
configure in interface org.hibernate.id.Configurable
Throws:
org.hibernate.MappingException

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.