KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > samples > petclinic > toplink > HSQLPlatformWithNativeSequence


1 /*
2  * Created on Nov 25, 2004
3  *
4  */

5
6 package org.springframework.samples.petclinic.toplink;
7
8 import oracle.toplink.internal.databaseaccess.HSQLPlatform;
9 import oracle.toplink.queryframework.ValueReadQuery;
10
11 /**
12  * Subclass of TopLink's default HSQLPlatform class,
13  * using native HSQLDB identity columns for id generation.
14  * <b>Only works on TopLink 10.1.3 and higher.</b>
15  *
16  * <p>Necessary for PetClinic's default data model, which relies on
17  * identity columns: this is uniformly used across all persistence
18  * layer implementations (JDBC, Hibernate, OJB, and TopLink).
19  *
20  * @author Juergen Hoeller
21  * @author <a HREF="mailto:james.x.clark@oracle.com">James Clark</a>
22  * @since 1.2
23  */

24 public class HSQLPlatformWithNativeSequence extends HSQLPlatform {
25
26     public HSQLPlatformWithNativeSequence() {
27         setUsesNativeSequencing(true);
28     }
29
30     public boolean supportsNativeSequenceNumbers() {
31         return true;
32     }
33
34     public boolean shouldNativeSequenceAcquireValueAfterInsert() {
35         return true;
36     }
37
38     public ValueReadQuery buildSelectQueryForNativeSequence() {
39         return new ValueReadQuery("CALL IDENTITY()");
40     }
41
42 }
43
Popular Tags