Dali Provisional API
Release 3.2

org.eclipse.jpt.jpa.core.context
Interface TypeMapping

All Superinterfaces:
IAdaptable, JpaContextModel, JpaModel, JptResourceTypeReference, Model
All Known Subinterfaces:
EclipseLinkEmbeddable, EclipseLinkEntity, EclipseLinkJavaEmbeddable, EclipseLinkJavaEntity, EclipseLinkJavaMappedSuperclass, EclipseLinkJavaNonEmbeddableTypeMapping, EclipseLinkJavaTypeMapping, EclipseLinkMappedSuperclass, EclipseLinkNonEmbeddableTypeMapping, EclipseLinkOrmEmbeddable, EclipseLinkOrmEntity, EclipseLinkOrmMappedSuperclass, EclipseLinkOrmNonEmbeddableTypeMapping, EclipseLinkOrmTypeMapping, EclipseLinkTypeMapping, Embeddable, Entity, IdTypeMapping, JavaEmbeddable, JavaEntity, JavaEntity2_0, JavaIdTypeMapping, JavaMappedSuperclass, JavaTypeMapping, MappedSuperclass, OrmEmbeddable, OrmEntity, OrmEntity2_0, OrmIdTypeMapping, OrmMappedSuperclass, OrmTypeMapping

public interface TypeMapping
extends JpaContextModel

type mapping:

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Since:
2.0

Nested Class Summary
static class TypeMapping.GeneratorsTransformer
           
static class TypeMapping.MappingIsIdMapping
           
static class TypeMapping.PersistentTypeTransformer
           
static class TypeMapping.QueriesTransformer
           
 
Nested classes/interfaces inherited from interface org.eclipse.jpt.jpa.core.JpaModel
JpaModel.JpaVersionIsCompatibleWith
 
Nested classes/interfaces inherited from interface org.eclipse.jpt.common.core.JptResourceTypeReference
JptResourceTypeReference.ResourceTypeIsKindOf, JptResourceTypeReference.ResourceTypeTransformer
 
Field Summary
static org.eclipse.jpt.common.utility.transformer.Transformer<TypeMapping,Iterable<Generator>> GENERATORS_TRANSFORMER
           
static String[] ID_ATTRIBUTE_MAPPING_KEYS
           
static org.eclipse.jpt.common.utility.transformer.Transformer<TypeMapping,PersistentType> PERSISTENT_TYPE_TRANSFORMER
           
static org.eclipse.jpt.common.utility.transformer.Transformer<TypeMapping,Iterable<Query>> QUERIES_TRANSFORMER
           
static String SUPER_TYPE_MAPPING_PROPERTY
          String associated with changes to the super type mapping property
 
Fields inherited from interface org.eclipse.jpt.common.core.JptResourceTypeReference
TRANSFORMER
 
Method Summary
 boolean attributeIsDerivedId(String attributeName)
          Return whether the attribute with the specified name is a derived ID.
 boolean attributeMappingKeyAllowed(String attributeMappingKey)
          Return whether the given attribute mapping key is valid for this particular type mapping (for example, id's are not valid for an embeddable type mapping)
 Iterable<String> getAllAssociatedTableNames()
          Return the names of the type mapping's "associated" tables, which includes the primary table and the collection of secondary tables, as well as all the inherited "associated" tables.
 Iterable<Table> getAllAssociatedTables()
          Return the type mapping's "associated" tables, which includes the primary table and the collection of secondary tables, as well as all inherited "associated" tables.
 Iterable<AttributeMapping> getAllAttributeMappings()
          Return all the attribute mappings in the type mapping's inheritance hierarchy.
<T extends AttributeMapping>
Iterable<T>
getAllAttributeMappings(String mappingKey)
          Return attribute mappings of a particular mapping type that are declared anywhere on this type mapping's hierarchy
 Iterable<String> getAllOverridableAssociationNames()
          Return an Iterator of all associations names that can be overridden in this type mapping.
 Iterable<String> getAllOverridableAttributeNames()
          Return an Iterator of all attribute names that can be overridden in this type mapping.
 Iterable<IdTypeMapping> getAncestors()
          Return the type mapping's "persistence" inheritance hierarchy, excluding the type mapping itself.
 Iterable<Table> getAssociatedTables()
          Return the type mapping's "associated" tables, which includes the primary table and the collection of secondary tables.
<T extends AttributeMapping>
Iterable<T>
getAttributeMappings()
          A convenience method for getting the attribute mappings from PersistentType.attributes()
<T extends AttributeMapping>
Iterable<T>
getAttributeMappings(String mappingKey)
          Return attribute mappings of a particular mapping type that are declared on this type mapping
 Schema getDbSchema()
           
 Iterable<Generator> getGenerators()
           
 AttributeMapping getIdAttributeMapping()
          Return the (single) mapping used as the id mapping for this type mapping.
 Iterable<AttributeMapping> getIdAttributeMappings()
          Return all mappings that are mapped as id mappings
 Iterable<? extends TypeMapping> getInheritanceHierarchy()
          Return the type mapping's "persistence" inheritance hierarchy, including the type mapping itself.
 JavaResourceType getJavaResourceType()
          Return the corresponding java resource type, this can be null
 String getKey()
          Return a unique key for the type mapping.
 String getName()
          Return the name, specified or default if not specified.
 Iterable<AttributeMapping> getNonTransientAttributeMappings()
          Return all the non-transient attribute mappings in the type mapping's inheritance hierarchy
 Iterable<String> getOverridableAssociationNames()
          Return an Iterator of associations names that can be overridden in this type mapping.
 Iterable<String> getOverridableAttributeNames()
          Return an Iterator of attribute names that can be overridden by a sub type mapping.
 PersistentType getPersistentType()
           
 Table getPrimaryDbTable()
          Return the type mapping's primary database table.
 String getPrimaryTableName()
          Return the type mapping's primary table name.
 Iterable<Query> getQueries()
           
 IdTypeMapping getSuperTypeMapping()
          Return the "super" TypeMapping from the "persistence" inheritance hierarchy.
 boolean isMapped()
           
 Table resolveDbTable(String tableName)
          Return the resolved associated db table with the specified name; i.e. the specified table must be among those associated with the type mapping otherwise return null.
 SpecifiedColumn resolveOverriddenColumn(String attributeName)
          Return the column of the overridable attribute mapping (or attribute override) with the specified attribute name.
 SpecifiedRelationship resolveOverriddenRelationship(String attributeName)
           
 boolean tableNameIsInvalid(String tableName)
          Return whether the specified table is invalid for any annotations associated with the type mapping.
 boolean validatesAgainstDatabase()
          Return whether any database metadata specific validation should occur.
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.JpaContextModel
getCompletionProposals, getContextDefaultDbCatalog, getContextDefaultDbSchema, getContextDefaultDbSchemaContainer, getMappingFileRoot, getParent, getPersistenceUnit, getValidationTextRange, synchronizeWithResourceModel, update, validate
 
Methods inherited from interface org.eclipse.jpt.jpa.core.JpaModel
getJpaPlatform, getJpaProject, getJpaProjectManager, getResource, stateChanged
 
Methods inherited from interface org.eclipse.jpt.common.utility.model.Model
addChangeListener, addCollectionChangeListener, addListChangeListener, addPropertyChangeListener, addStateChangeListener, removeChangeListener, removeCollectionChangeListener, removeListChangeListener, removePropertyChangeListener, removeStateChangeListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.jpt.common.core.JptResourceTypeReference
getResourceType
 

Field Detail

PERSISTENT_TYPE_TRANSFORMER

static final org.eclipse.jpt.common.utility.transformer.Transformer<TypeMapping,PersistentType> PERSISTENT_TYPE_TRANSFORMER

QUERIES_TRANSFORMER

static final org.eclipse.jpt.common.utility.transformer.Transformer<TypeMapping,Iterable<Query>> QUERIES_TRANSFORMER

GENERATORS_TRANSFORMER

static final org.eclipse.jpt.common.utility.transformer.Transformer<TypeMapping,Iterable<Generator>> GENERATORS_TRANSFORMER

SUPER_TYPE_MAPPING_PROPERTY

static final String SUPER_TYPE_MAPPING_PROPERTY
String associated with changes to the super type mapping property

See Also:
Constant Field Values

ID_ATTRIBUTE_MAPPING_KEYS

static final String[] ID_ATTRIBUTE_MAPPING_KEYS
Method Detail

getPersistentType

PersistentType getPersistentType()

getJavaResourceType

JavaResourceType getJavaResourceType()
Return the corresponding java resource type, this can be null


getKey

String getKey()
Return a unique key for the type mapping. If this is defined in an extension they should be equal.


getName

String getName()
Return the name, specified or default if not specified.


isMapped

boolean isMapped()

getQueries

Iterable<Query> getQueries()

getGenerators

Iterable<Generator> getGenerators()

getSuperTypeMapping

IdTypeMapping getSuperTypeMapping()
Return the "super" TypeMapping from the "persistence" inheritance hierarchy. If the Java inheritance parent is not persistent, then continue up the hierarchy (the JPA spec allows non-persistent types to be part of the hierarchy.) Return null if the type mapping is the root.

Example:

 @Entity
 public abstract class Model {}
 
 public abstract class Animal extends Model {}
 
 @Entity
 public class Cat extends Animal {}
 
The "super" type mapping of the Cat type mapping is the Model type mapping. The "super" type mapping can either come from a Java annotated class from an XML mapping file.


getAncestors

Iterable<IdTypeMapping> getAncestors()
Return the type mapping's "persistence" inheritance hierarchy, excluding the type mapping itself. If there is an inheritance loop, the iterable will terminate before including this type mapping.


getInheritanceHierarchy

Iterable<? extends TypeMapping> getInheritanceHierarchy()
Return the type mapping's "persistence" inheritance hierarchy, including the type mapping itself. If there is an inheritance loop, the iterable will terminate before including this type mapping.


getPrimaryTableName

String getPrimaryTableName()
Return the type mapping's primary table name. Return null if a primary table is not applicable.


getPrimaryDbTable

Table getPrimaryDbTable()
Return the type mapping's primary database table. Return null if a primary table is not applicable.


getDbSchema

Schema getDbSchema()

getAssociatedTables

Iterable<Table> getAssociatedTables()
Return the type mapping's "associated" tables, which includes the primary table and the collection of secondary tables.


getAllAssociatedTables

Iterable<Table> getAllAssociatedTables()
Return the type mapping's "associated" tables, which includes the primary table and the collection of secondary tables, as well as all inherited "associated" tables.


getAllAssociatedTableNames

Iterable<String> getAllAssociatedTableNames()
Return the names of the type mapping's "associated" tables, which includes the primary table and the collection of secondary tables, as well as all the inherited "associated" tables.


resolveDbTable

Table resolveDbTable(String tableName)
Return the resolved associated db table with the specified name; i.e. the specified table must be among those associated with the type mapping otherwise return null.

NB: The spec does allow for columns or join columns to specify a schema and/or catalog; so the results can be unpredictable....


tableNameIsInvalid

boolean tableNameIsInvalid(String tableName)
Return whether the specified table is invalid for any annotations associated with the type mapping. The table name is case- sensitive when the database connection is missing or inactive; when the database connection is active, case-sensitivity is determined by the database.


getAttributeMappings

<T extends AttributeMapping> Iterable<T> getAttributeMappings()
A convenience method for getting the attribute mappings from PersistentType.attributes()


getAttributeMappings

<T extends AttributeMapping> Iterable<T> getAttributeMappings(String mappingKey)
Return attribute mappings of a particular mapping type that are declared on this type mapping


getAllAttributeMappings

Iterable<AttributeMapping> getAllAttributeMappings()
Return all the attribute mappings in the type mapping's inheritance hierarchy.


getNonTransientAttributeMappings

Iterable<AttributeMapping> getNonTransientAttributeMappings()
Return all the non-transient attribute mappings in the type mapping's inheritance hierarchy


getAllAttributeMappings

<T extends AttributeMapping> Iterable<T> getAllAttributeMappings(String mappingKey)
Return attribute mappings of a particular mapping type that are declared anywhere on this type mapping's hierarchy


attributeMappingKeyAllowed

boolean attributeMappingKeyAllowed(String attributeMappingKey)
Return whether the given attribute mapping key is valid for this particular type mapping (for example, id's are not valid for an embeddable type mapping)


getIdAttributeMappings

Iterable<AttributeMapping> getIdAttributeMappings()
Return all mappings that are mapped as id mappings

See Also:
TypeMapping.MappingIsIdMapping

getIdAttributeMapping

AttributeMapping getIdAttributeMapping()
Return the (single) mapping used as the id mapping for this type mapping. If there is more than one, return null.

See Also:
TypeMapping.MappingIsIdMapping

attributeIsDerivedId

boolean attributeIsDerivedId(String attributeName)
Return whether the attribute with the specified name is a derived ID.


getOverridableAttributeNames

Iterable<String> getOverridableAttributeNames()
Return an Iterator of attribute names that can be overridden by a sub type mapping.


getAllOverridableAttributeNames

Iterable<String> getAllOverridableAttributeNames()
Return an Iterator of all attribute names that can be overridden in this type mapping.


resolveOverriddenColumn

SpecifiedColumn resolveOverriddenColumn(String attributeName)
Return the column of the overridable attribute mapping (or attribute override) with the specified attribute name.

In JPA 2.0 this name can use dot-notation to designate nested attributes in embedded attribute mapping's embeddable type mapping.


getOverridableAssociationNames

Iterable<String> getOverridableAssociationNames()
Return an Iterator of associations names that can be overridden in this type mapping.


getAllOverridableAssociationNames

Iterable<String> getAllOverridableAssociationNames()
Return an Iterator of all associations names that can be overridden in this type mapping.


resolveOverriddenRelationship

SpecifiedRelationship resolveOverriddenRelationship(String attributeName)

validatesAgainstDatabase

boolean validatesAgainstDatabase()
Return whether any database metadata specific validation should occur. (For instance, if the connection is not active, then it should not.)


Dali Provisional API
Release 3.2

Copyright (c) 2012 Oracle. All rights reserved.