org.xquark.mapping
Class KeyGenerator

java.lang.Object
  extended byorg.xquark.mapping.KeyGenerator
All Implemented Interfaces:
Generator, UserGenerator

public class KeyGenerator
extends java.lang.Object
implements UserGenerator

This generator is a built-in default implementation intended as a device for relational primary and foreign keys generation. It uses the compilation context to get the needed parameters, especially for initialization. WARNING !!! Currently, this generator is limited: it uses the target column provided by the compilation context to initialize a counter (performing a 'SELECT MAX(...) FROM ...' which is totally managed in memory (using 1 increments). This has the advantage to be extremely rapid (no useless database access, JDBC batch usable...) but the major drawback of this approach is the fact that concurrency in insertion is not supported...


Constructor Summary
KeyGenerator(CompilationContext properties)
           
 
Method Summary
 java.lang.Object getValue(StorageContext context)
          This method is called by the custom XMLCollection storage algorithm when a user-generated column of a relational table is filled.
 java.lang.String getXMLType()
          Return the corresponding XML Schema type using the XML Schema recommendation syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyGenerator

public KeyGenerator(CompilationContext properties)
Method Detail

getXMLType

public java.lang.String getXMLType()
Description copied from interface: UserGenerator
Return the corresponding XML Schema type using the XML Schema recommendation syntax.

You must not use the the prefix for XML Schema namespace which is implicitly defined

.

Examples:/B>

string

decimal

]]>

Specified by:
getXMLType in interface UserGenerator
Returns:
an XML Schema fragment describing a simple type

getValue

public java.lang.Object getValue(StorageContext context)
Description copied from interface: Generator
This method is called by the custom XMLCollection storage algorithm when a user-generated column of a relational table is filled. The Object type returned must be consistent with column target SQL type.

Specified by:
getValue in interface Generator
Parameters:
context - Passed by the mapping algorithm to provide an access to storage system variables.
Returns:
An Object, that must be, from a JDBC 2.0 point of view, consistent with column target SQL type.


Copyright © 2004 Université de Versailles Saint-Quentin, XQuark Group. All rights reserved.