Code example for IdentityGenerator

0
/** 
 * Simple {@link IdentityGenerator} implementation for testing composite-id. 
 *  
 * @author Jacob Robertson 
 */ 
public class PurchaseRecordIdGenerator extends IdentityGenerator {
 
	private static int nextPurchaseNumber = 2;
	private static int nextPurchaseSequence = 3;
	 
	public Serializable generate(SessionImplementor s, Object obj) {
		return new PurchaseRecord.Id( 
				nextPurchaseNumber++, 
				String.valueOf(nextPurchaseSequence++));
	} 
	 
}