org.openstreetmap.osmosis.core.mysql.common
Class IdentityColumnValueLoader

java.lang.Object
  extended by org.openstreetmap.osmosis.core.mysql.common.IdentityColumnValueLoader
All Implemented Interfaces:
Releasable

public class IdentityColumnValueLoader
extends java.lang.Object
implements Releasable

A utility class for retrieving the last inserted identity column value.

Author:
Brett Henderson

Constructor Summary
IdentityColumnValueLoader(DatabaseContext dbCtx)
          Creates a new instance.
 
Method Summary
 long getLastInsertId()
          Returns the id of the most recently inserted row on the current connection.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityColumnValueLoader

public IdentityColumnValueLoader(DatabaseContext dbCtx)
Creates a new instance.

Parameters:
dbCtx - The database context to use for all database access.
Method Detail

getLastInsertId

public long getLastInsertId()
Returns the id of the most recently inserted row on the current connection.

Returns:
The newly inserted id.

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable