Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.hibernate.id
Class HQMultipleHiLoPerTableGenerator

    java.lang.Object
      org.hibernate.engine.TransactionHelper
          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):

- table: table name (default `hibernate_sequences`)
- primary_key_column: key column name (default `sequence_name`)
- value_column: hi value column name(default `sequence_next_hi_value`)
- primary_key_value: key value for the current entity (default to the entity's primary table name)
- primary_key_length: length of the key column in DB represented as a varchar (default to 255)
- max_lo: max low value before increasing hi (default to Short.MAX_VALUE)

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`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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