Annotation Interface MappedUDT
A class marked with this annotation must implement SQLData
, and will
use the methods of that interface to map between its own state and the
PostgreSQL internal form. If this annotation includes a
structure
, SQL will be emitted to create a new composite
type with that structure in the schema
named here (or at
the head of the search_path
if unspecified), and with the
name
given here (or else the simple name of the class being
annotated), and then to use the sqlj.add_type_mapping
function to
associate that type with the annotated class.
If no structure
is given, no new type will be created,
and sqlj.add_type_mapping
will simply be called to map some existing
PostgreSQL type (known by name
if specified or the simple name
of the class being annotated, and found in schema
if
specified, or by following the search path) to the annotated class.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionA comment to be associated with the type.The<implementor name>
to be used around SQL code generated for this type.Name of the type in SQL, if it is not to be the simple name of the class.String[]
One or more arbitrary labels that will be considered 'provided' by the object carrying this annotation.String[]
One or more arbitrary labels that will be considered 'required' by the object carrying this annotation.Schema in which the type is declared.String[]
Structure of the new composite ("structured") type to create, as strings, one per attribute, for example{"x float8", "y float8"}
.
-
Element Details
-
name
String nameName of the type in SQL, if it is not to be the simple name of the class. By default, the class name will be used, subject to PostgreSQL's normal case-folding and case-insensitive matching.- Default:
""
-
schema
String schemaSchema in which the type is declared. If not given, the names will not be schema qualified.- Default:
""
-
provides
String[] providesOne or more arbitrary labels that will be considered 'provided' by the object carrying this annotation. The deployment descriptor will be generated in such an order that other objects that 'require' labels 'provided' by this come later in the output for install actions, and earlier for remove actions.- Default:
{}
-
requires
String[] requiresOne or more arbitrary labels that will be considered 'required' by the object carrying this annotation. The deployment descriptor will be generated in such an order that other objects that 'provide' labels 'required' by this come earlier in the output for install actions, and later for remove actions.- Default:
{}
-
implementor
String implementorThe<implementor name>
to be used around SQL code generated for this type. Defaults toPostgreSQL
. Set explicitly to""
to emit code not wrapped in an<implementor block>
.- Default:
""
-
structure
String[] structureStructure of the new composite ("structured") type to create, as strings, one per attribute, for example{"x float8", "y float8"}
. Collation syntax could be included if needed as well; the strings are simply dumped, with commas between, into theCREATE TYPE
command.An empty list
{}
is allowed, and will create a composite type with no attributes at all; PostgreSQL expressly allows this for some reason, and you can still tell whether you have one of those ornull
, so it could be used as a strange sort of boolean.If no
structure
is given at all, no type is created, and this annotation simply maps the class being annotated to some existing PostgreSQL type.- Default:
{}
-
comment
String commentA comment to be associated with the type. If left to default, and the Java class has a doc comment, its first sentence will be used. If an empty string is explicitly given, no comment will be set.- Default:
""
-