alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (EssentialsHSQLPlatformWithNativeSequence.java)

This example Spring Framework source code file (EssentialsHSQLPlatformWithNativeSequence.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

call, essentialshsqlplatformwithnativesequence, essentialshsqlplatformwithnativesequence, hsqlplatform, hsqlplatform, identity, identity, io, ioexception, validationexception, valuereadquery, valuereadquery

The Spring Framework EssentialsHSQLPlatformWithNativeSequence.java source code

package org.springframework.samples.petclinic.toplink;

import java.io.IOException;
import java.io.Writer;

import oracle.toplink.essentials.exceptions.ValidationException;
import oracle.toplink.essentials.platform.database.HSQLPlatform;
import oracle.toplink.essentials.queryframework.ValueReadQuery;

/**
 * Subclass of the TopLink Essentials default HSQLPlatform class, using native
 * HSQLDB identity columns for id generation.
 *
 * <p>Necessary for PetClinic's default data model, which relies on identity
 * columns: this is uniformly used across all persistence layer implementations
 * (JDBC, Hibernate, and JPA).
 *
 * @author Juergen Hoeller
 * @author <a href="mailto:james.x.clark@oracle.com">James Clark
 * @since 1.2
 */
public class EssentialsHSQLPlatformWithNativeSequence extends HSQLPlatform {

	private static final long serialVersionUID = -55658009691346735L;


	public EssentialsHSQLPlatformWithNativeSequence() {
		// setUsesNativeSequencing(true);
	}

	public boolean supportsNativeSequenceNumbers() {
		return true;
	}

	public boolean shouldNativeSequenceAcquireValueAfterInsert() {
		return true;
	}

	public ValueReadQuery buildSelectQueryForNativeSequence() {
		return new ValueReadQuery("CALL IDENTITY()");
	}

	public void printFieldIdentityClause(Writer writer) throws ValidationException {
		try {
			writer.write(" IDENTITY");
		}
		catch (IOException ex) {
			throw ValidationException.fileError(ex);
		}
	}

}

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework EssentialsHSQLPlatformWithNativeSequence.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.