org.hyperic.util.jdbc
Class IDGeneratorFactory
java.lang.Object
org.hyperic.util.jdbc.IDGeneratorFactory
public class IDGeneratorFactory
- extends java.lang.Object
This factory is meant to be the central point of access for IDGenerator
objects used by an application. It will hold the single IDGenerator in a
private map and reuse it across repeated invocations of getNextId(). It is
particularly useful for Entity bean scenarios, where multiple instances of an
IDGenerator result in database row contention and SQL timeouts if more than
one thread attempts to get a new id from the sequence at the same time.
Method Summary |
static long |
getNextId(java.lang.String ctx,
java.lang.String sequenceName,
java.lang.String dsName)
Get a new ID from the named sequence, accessible through the named
datasource string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IDGeneratorFactory
public IDGeneratorFactory()
getNextId
public static long getNextId(java.lang.String ctx,
java.lang.String sequenceName,
java.lang.String dsName)
throws ConfigPropertyException,
javax.naming.NamingException,
SequenceRetrievalException,
java.sql.SQLException
- Get a new ID from the named sequence, accessible through the named
datasource string.
- Parameters:
ctx
- - the logging context. Typically the name of the calling
classsequenceName
- - the name of the sequence to retrieve the new id fromdsName
- - the JNDI name of the datasource
- Throws:
ConfigPropertyException
javax.naming.NamingException
SequenceRetrievalException
java.sql.SQLException
Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.