1 /** 2 * Copyright (C) 2004 France Telecom R&D 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 package org.objectweb.jorm.facility.naming.rdbsequence; 19 20 /** 21 * Defines an identifier allocator based on a SQL sequence. This permits to 22 * support the inheritance with the use of a SQL sequence. Indeed, an identifier 23 * value MUST permit to find the class type of the persistent object. Then a way 24 * respect this constraint and to have an identifier allocation based on a 25 * sequence, is to modify the long value provided by the sequence in order to 26 * code the class identifier into the object identifier. This can be done by 27 * using one or several bits of the long value (in low or high position) for 28 * example. 29 * 30 * @author S.Chassande-Barrioz 31 */ 32 public interface SequenceIdAllocator { 33 34 /** 35 * Allocate an identifier from a new computed sequence value, and the naming 36 * key of the persistant class. 37 * @param key is the value that you have put in the 'inheritance-key' 38 * extension. 39 */ 40 long allocateId(long seqValue, Object key); 41 42 } 43