{
ColumnDef colDef = (ColumnDef) mapping.getArgDef( mf );
String seq = getProperName( colDef.getSequence().getNameDef() ); //getManager().getSequenceName( mf );
if ( seq == null )
throw new MetaException( "MetaField[" + mf + "] has no sequence defined" );
try
{
// Get next next MAX() sequence
Statement s = conn.createStatement();
try
{
String query = "SELECT " + seq + ".nextval FROM dual";
ResultSet rs = s.executeQuery( query );
if ( !rs.next() )
throw new MetaException( "Unable to get next id for MetaField[" + mf + "], no result in result set" );
try
{
return rs.getString( 1 );
}
finally { rs.close(); }
}
finally { s.close(); }
}
catch( SQLException e )
{
log.error( "Unable to get next id for MetaField[" + mf + "]: " + e.getMessage() );
throw new MetaException( "Unable to get next id for MetaField[" + mf + "]: " + e.getMessage(), e );
}
}