You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by th...@apache.org on 2003/02/28 22:29:23 UTC

cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/sequence SequenceManagerNextValImpl.java

thma        2003/02/28 13:29:23

  Modified:    src/java/org/apache/ojb/broker/util/sequence
                        SequenceManagerNextValImpl.java
  Log:
  enhancement: support for long values. (fix by Per-Olof Noren)
  
  Revision  Changes    Path
  1.6       +16 -5     db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
  
  Index: SequenceManagerNextValImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SequenceManagerNextValImpl.java	12 Jan 2003 10:03:32 -0000	1.5
  +++ SequenceManagerNextValImpl.java	28 Feb 2003 21:29:23 -0000	1.6
  @@ -106,11 +106,22 @@
       }
   
       /**
  -     *
  +     * returns a unique int value for class clazz and field fieldName.
  +     * the returned number is unique accross all tables in the extent of clazz.
        */
       public int getUniqueId(FieldDescriptor field) throws SequenceManagerException
       {
  -        int result = 0;
  +    	return (int) getUniqueLong(field);
  +    }
  +
  +
  +    /**
  +     * returns a unique long value for class clazz and field fieldName.
  +     * the returned number is unique accross all tables in the extent of clazz.
  +     */
  +    public long getUniqueLong(FieldDescriptor field) throws SequenceManagerException
  +    {
  +        long result = 0;
           // lookup sequence name
           String sequenceName = SequenceManagerHelper.buildSequenceName(getBrokerForClass(), field);
           try
  @@ -147,7 +158,7 @@
           return result;
       }
   
  -    protected int buildNextSequence(ClassDescriptor cld, String sequenceName) throws Exception
  +    protected long buildNextSequence(ClassDescriptor cld, String sequenceName) throws Exception
       {
           ResultSet rs = null;
           Statement stmt = null;
  @@ -157,7 +168,7 @@
               stmt = getBrokerForClass().serviceStatementManager().getGenericStatement(cld, Query.NOT_SCROLLABLE);
               rs = stmt.executeQuery(getPlatform().nextSequenceQuery(sequenceName));
               rs.next();
  -            return rs.getInt(1);
  +            return rs.getLong(1);
           }
           finally
           {