HHH-7450 mapkey
This commit is contained in:
parent
f100b3de03
commit
d6ab4a203a
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbIndexElement;
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbMapElement.JaxbMapKey;
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbMapKeyElement;
|
||||
import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource;
|
||||
import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource;
|
||||
import org.hibernate.metamodel.spi.source.RelationalValueSource;
|
||||
|
@ -43,7 +43,7 @@ public class MapAttributeIndexSource extends AbstractHbmSourceNode implements Pl
|
|||
/**
|
||||
* @param sourceMappingDocument
|
||||
*/
|
||||
public MapAttributeIndexSource( MappingDocument sourceMappingDocument, final JaxbMapKey mapKey ) {
|
||||
public MapAttributeIndexSource( MappingDocument sourceMappingDocument, final JaxbMapKeyElement mapKey ) {
|
||||
super( sourceMappingDocument );
|
||||
valueSources = Helper.buildValueSources( sourceMappingDocument(), new Helper.ValueSourcesAdapter() {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ package org.hibernate.metamodel.internal.source.hbm;
|
|||
import org.hibernate.cfg.NotYetImplementedException;
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbIndexElement;
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbMapElement;
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbMapElement.JaxbMapKey;
|
||||
import org.hibernate.internal.jaxb.mapping.hbm.JaxbMapKeyElement;
|
||||
import org.hibernate.metamodel.spi.source.AttributeSourceContainer;
|
||||
import org.hibernate.metamodel.spi.source.IndexedPluralAttributeSource;
|
||||
import org.hibernate.metamodel.spi.source.PluralAttributeNature;
|
||||
|
@ -48,7 +48,7 @@ public class MapAttributeSource extends AbstractPluralAttributeSourceImpl implem
|
|||
JaxbMapElement mapElement,
|
||||
AttributeSourceContainer container ) {
|
||||
super( sourceMappingDocument, mapElement, container );
|
||||
JaxbMapKey mapKey = mapElement.getMapKey();
|
||||
JaxbMapKeyElement mapKey = mapElement.getMapKey();
|
||||
if ( mapKey != null ) {
|
||||
this.indexSource = new MapAttributeIndexSource( sourceMappingDocument, mapKey );
|
||||
} else {
|
||||
|
|
|
@ -977,7 +977,61 @@ arbitrary number of queries, and import declarations of arbitrary classes.
|
|||
<xs:attribute name="unique-key" type="xs:string"/>
|
||||
<xs:attribute name="update" default="true" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="map-key-element">
|
||||
<xs:sequence>
|
||||
<xs:group minOccurs="0" maxOccurs="unbounded" ref="column-or-formula"/>
|
||||
<xs:element name="type" minOccurs="0" type="type-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="column" type="xs:string"/>
|
||||
<xs:attribute name="formula" type="xs:string"/>
|
||||
<xs:attribute name="length" type="xs:int"/>
|
||||
<xs:attribute name="node" type="xs:string"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="composite-map-key-element">
|
||||
<xs:sequence>
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="key-property" type="key-property-element"/>
|
||||
<xs:element name="key-many-to-one" type="key-many-to-one-element"/>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="map-key-many-to-many">
|
||||
<xs:sequence>
|
||||
<xs:group minOccurs="0" maxOccurs="unbounded" ref="column-or-formula"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" type="xs:string"/>
|
||||
<xs:attribute name="column" type="xs:string"/>
|
||||
<xs:attribute name="entity-name" type="xs:string"/>
|
||||
<xs:attribute name="foreign-key" type="xs:string"/>
|
||||
<xs:attribute name="formula" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="composite-index-element">
|
||||
<xs:sequence>
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="key-property" type="key-property-element"/>
|
||||
<xs:element name="key-many-to-one" type="key-many-to-one-element"/>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="index-many-to-many-element">
|
||||
<xs:sequence>
|
||||
<xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
<xs:attribute name="column" type="xs:string"/>
|
||||
<xs:attribute name="entity-name" type="xs:string"/>
|
||||
<xs:attribute name="foreign-key" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="index-many-to-any-element">
|
||||
<xs:sequence>
|
||||
<xs:element name="column" type="column-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id-type" use="required" type="xs:string"/>
|
||||
<xs:attribute name="meta-type" type="xs:string"/> <!--- default: Hibernate.CLASS -->
|
||||
</xs:complexType>
|
||||
<!-- Collection declarations nested inside a class declaration indicate a foreign key
|
||||
relationship from the collection table to the enclosing class. -->
|
||||
<xs:complexType name="map-element">
|
||||
|
@ -990,77 +1044,16 @@ arbitrary number of queries, and import declarations of arbitrary classes.
|
|||
<xs:element name="comment" minOccurs="0" type="xs:string"/>
|
||||
<xs:element name="key" type="key-element"/>
|
||||
<xs:choice>
|
||||
<xs:element name="map-key">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:group minOccurs="0" maxOccurs="unbounded" ref="column-or-formula"/>
|
||||
<xs:element name="type" minOccurs="0" type="type-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="column" type="xs:string"/>
|
||||
<xs:attribute name="formula" type="xs:string"/>
|
||||
<xs:attribute name="length" type="xs:int"/>
|
||||
<xs:attribute name="node" type="xs:string"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="map-key" type="map-key-element"/>
|
||||
<!-- Composite index of a map ie. a map keyed on components. -->
|
||||
<xs:element name="composite-map-key">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="key-property" type="key-property-element"/>
|
||||
<xs:element name="key-many-to-one" type="key-many-to-one-element"/>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="composite-map-key" type="composite-map-key-element"/>
|
||||
<!-- Many to many association mapped to the key of a map. ie. a map keyed
|
||||
on entities. -->
|
||||
<xs:element name="map-key-many-to-many">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:group minOccurs="0" maxOccurs="unbounded" ref="column-or-formula"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" type="xs:string"/>
|
||||
<xs:attribute name="column" type="xs:string"/>
|
||||
<xs:attribute name="entity-name" type="xs:string"/>
|
||||
<xs:attribute name="foreign-key" type="xs:string"/>
|
||||
<xs:attribute name="formula" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="map-key-many-to-many" type="map-key-many-to-many"/>
|
||||
<xs:element name="index" type="index-element"/>
|
||||
<xs:element name="composite-index">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="key-property" type="key-property-element"/>
|
||||
<xs:element name="key-many-to-one" type="key-many-to-one-element"/>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="index-many-to-many">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="class" use="required" type="xs:string"/>
|
||||
<xs:attribute name="column" type="xs:string"/>
|
||||
<xs:attribute name="entity-name" type="xs:string"/>
|
||||
<xs:attribute name="foreign-key" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="index-many-to-any">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="column" type="column-element"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id-type" use="required" type="xs:string"/>
|
||||
<xs:attribute name="meta-type" type="xs:string"/> <!--- default: Hibernate.CLASS -->
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="composite-index" type="composite-index-element"/>
|
||||
<xs:element name="index-many-to-many" type="index-many-to-many-element"/>
|
||||
<xs:element name="index-many-to-any" type="index-many-to-any-element"/>
|
||||
</xs:choice>
|
||||
<xs:choice>
|
||||
<xs:element name="element" type="element-element"/>
|
||||
|
@ -1111,6 +1104,11 @@ arbitrary number of queries, and import declarations of arbitrary classes.
|
|||
<xs:element name="parent" minOccurs="0" type="parent-element"/>
|
||||
<xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<simplify:as-element-property/>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:element name="property" type="property-element"/>
|
||||
<xs:element name="many-to-one" type="many-to-one-element"/>
|
||||
<xs:element name="any" type="any-element"/>
|
||||
|
|
|
@ -127,10 +127,10 @@
|
|||
<jaxb:bindings node="//xsd:complexType[@name='list-index-element']//xsd:attribute[@name='column']">
|
||||
<jaxb:property name="columnAttribute"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xsd:complexType[@name='map-element']//xsd:element[@name='map-key']//xsd:attribute[@name='type']">
|
||||
<jaxb:bindings node="//xsd:complexType[@name='map-key-element']//xsd:attribute[@name='type']">
|
||||
<jaxb:property name="typeAttribute"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xsd:complexType[@name='map-element']//xsd:element[@name='index-many-to-many']//xsd:attribute[@name='column']">
|
||||
<jaxb:bindings node="//xsd:complexType[@name='index-many-to-many-element']//xsd:attribute[@name='column']">
|
||||
<jaxb:property name="columnAttribute"/>
|
||||
</jaxb:bindings>
|
||||
<jaxb:bindings node="//xsd:complexType[@name='one-to-one-element']//xsd:attribute[@name='formula']">
|
||||
|
|
Loading…
Reference in New Issue