getParameters() {
- return parameters;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/InheritanceType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/InheritanceType.java
deleted file mode 100644
index 9bcd4792cd..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/InheritanceType.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import org.hibernate.MappingException;
-
-/**
- * The inheritance type for a given entity.
- *
- * Note, we are not using the JPA enum, because we need the ability to extend the types if we need to.
- *
- * @author Hardy Ferentschik
- */
-public enum InheritanceType {
- JOINED,
- SINGLE_TABLE,
- TABLE_PER_CLASS,
- NO_INHERITANCE;
-
- /**
- * @param jpaType The JPA inheritance type
- *
- * @return The inheritance type of this class.
- */
- public static InheritanceType get(javax.persistence.InheritanceType jpaType) {
- switch ( jpaType ) {
- case SINGLE_TABLE: {
- return InheritanceType.SINGLE_TABLE;
- }
- case JOINED: {
- return InheritanceType.JOINED;
- }
- case TABLE_PER_CLASS: {
- return InheritanceType.TABLE_PER_CLASS;
- }
- default: {
- throw new MappingException( "Unknown jpa inheritance type:" + jpaType.name() );
- }
- }
- }
-}
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/KeyValueBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/KeyValueBinding.java
deleted file mode 100644
index cc48595d02..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/KeyValueBinding.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public interface KeyValueBinding extends AttributeBinding {
- public boolean isKeyCascadeDeleteEnabled();
-
- public String getUnsavedValue();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToAnyCollectionElement.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToAnyCollectionElement.java
deleted file mode 100644
index 50e5edd443..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToAnyCollectionElement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-/**
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public class ManyToAnyCollectionElement extends AbstractCollectionElement {
- ManyToAnyCollectionElement(AbstractPluralAttributeBinding binding) {
- super( binding );
- }
-
- @Override
- public CollectionElementNature getCollectionElementNature() {
- return CollectionElementNature.MANY_TO_ANY;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToManyCollectionElement.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToManyCollectionElement.java
deleted file mode 100644
index ee5b93464a..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToManyCollectionElement.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import java.util.HashMap;
-
-import org.dom4j.Element;
-
-/**
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public class ManyToManyCollectionElement extends AbstractCollectionElement {
-
- private final java.util.Map manyToManyFilters = new HashMap();
- private String manyToManyWhere;
- private String manyToManyOrderBy;
-
-
- ManyToManyCollectionElement(AbstractPluralAttributeBinding binding) {
- super( binding );
- }
-
- @Override
- public CollectionElementNature getCollectionElementNature() {
- return CollectionElementNature.MANY_TO_MANY;
- }
-
- public void fromHbmXml(Element node){
- /*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- */
- }
-
- public String getManyToManyWhere() {
- return manyToManyWhere;
- }
-
- public void setManyToManyWhere(String manyToManyWhere) {
- this.manyToManyWhere = manyToManyWhere;
- }
-
- public String getManyToManyOrderBy() {
- return manyToManyOrderBy;
- }
-
- public void setManyToManyOrderBy(String manyToManyOrderBy) {
- this.manyToManyOrderBy = manyToManyOrderBy;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java
deleted file mode 100644
index 66a9f5376b..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.FetchMode;
-import org.hibernate.engine.FetchStyle;
-import org.hibernate.engine.FetchTiming;
-import org.hibernate.engine.spi.CascadeStyle;
-import org.hibernate.engine.spi.CascadeStyles;
-import org.hibernate.metamodel.domain.SingularAttribute;
-
-/**
- * TODO : javadoc
- *
- * @author Gail Badner
- * @author Steve Ebersole
- */
-public class ManyToOneAttributeBinding extends BasicAttributeBinding implements SingularAssociationAttributeBinding {
- private String referencedEntityName;
- private String referencedAttributeName;
- private AttributeBinding referencedAttributeBinding;
-
- private boolean isLogicalOneToOne;
- private String foreignKeyName;
-
- private CascadeStyle cascadeStyle;
- private FetchTiming fetchTiming;
- private FetchStyle fetchStyle;
-
- ManyToOneAttributeBinding(AttributeBindingContainer container, SingularAttribute attribute) {
- super( container, attribute, false, false );
- }
-
- @Override
- public boolean isAssociation() {
- return true;
- }
-
- @Override
- public final boolean isPropertyReference() {
- return referencedAttributeName != null;
- }
-
- @Override
- public final String getReferencedEntityName() {
- return referencedEntityName;
- }
-
- @Override
- public void setReferencedEntityName(String referencedEntityName) {
- this.referencedEntityName = referencedEntityName;
- }
-
- @Override
- public final String getReferencedAttributeName() {
- return referencedAttributeName;
- }
-
- @Override
- public void setReferencedAttributeName(String referencedEntityAttributeName) {
- this.referencedAttributeName = referencedEntityAttributeName;
- }
-
- @Override
- public CascadeStyle getCascadeStyle() {
- return cascadeStyle;
- }
-
- @Override
- public void setCascadeStyles(Iterable cascadeStyles) {
- List cascadeStyleList = new ArrayList();
- for ( CascadeStyle style : cascadeStyles ) {
- if ( style != CascadeStyles.NONE ) {
- cascadeStyleList.add( style );
- }
- }
- if ( cascadeStyleList.isEmpty() ) {
- cascadeStyle = CascadeStyles.NONE;
- }
- else if ( cascadeStyleList.size() == 1 ) {
- cascadeStyle = cascadeStyleList.get( 0 );
- }
- else {
- cascadeStyle = new CascadeStyles.MultipleCascadeStyle(
- cascadeStyleList.toArray( new CascadeStyle[ cascadeStyleList.size() ] )
- );
- }
- }
-
- @Override
- public FetchTiming getFetchTiming() {
- return fetchTiming;
- }
-
- @Override
- public void setFetchTiming(FetchTiming fetchTiming) {
- this.fetchTiming = fetchTiming;
- }
-
- @Override
- public FetchStyle getFetchStyle() {
- return fetchStyle;
- }
-
- @Override
- public void setFetchStyle(FetchStyle fetchStyle) {
- if ( fetchStyle == FetchStyle.SUBSELECT ) {
- throw new AssertionFailure( "Subselect fetching not yet supported for singular associations" );
- }
- this.fetchStyle = fetchStyle;
- }
-
- @Override
- public FetchMode getFetchMode() {
- if ( fetchStyle == FetchStyle.JOIN ) {
- return FetchMode.JOIN;
- }
- else if ( fetchStyle == FetchStyle.SELECT ) {
- return FetchMode.SELECT;
- }
- else if ( fetchStyle == FetchStyle.BATCH ) {
- // we need the subsequent select...
- return FetchMode.SELECT;
- }
-
- throw new AssertionFailure( "Unexpected fetch style : " + fetchStyle.name() );
- }
-
- @Override
- public final boolean isReferenceResolved() {
- return referencedAttributeBinding != null;
- }
-
- @Override
- public final void resolveReference(AttributeBinding referencedAttributeBinding) {
- if ( ! EntityBinding.class.isInstance( referencedAttributeBinding.getContainer() ) ) {
- throw new AssertionFailure( "Illegal attempt to resolve many-to-one reference based on non-entity attribute" );
- }
- final EntityBinding entityBinding = (EntityBinding) referencedAttributeBinding.getContainer();
- if ( !referencedEntityName.equals( entityBinding.getEntity().getName() ) ) {
- throw new IllegalStateException(
- "attempt to set EntityBinding with name: [" +
- entityBinding.getEntity().getName() +
- "; entity name should be: " + referencedEntityName
- );
- }
- if ( referencedAttributeName == null ) {
- referencedAttributeName = referencedAttributeBinding.getAttribute().getName();
- }
- else if ( !referencedAttributeName.equals( referencedAttributeBinding.getAttribute().getName() ) ) {
- throw new IllegalStateException(
- "Inconsistent attribute name; expected: " + referencedAttributeName +
- "actual: " + referencedAttributeBinding.getAttribute().getName()
- );
- }
- this.referencedAttributeBinding = referencedAttributeBinding;
-// buildForeignKey();
- }
-
- @Override
- public AttributeBinding getReferencedAttributeBinding() {
- if ( !isReferenceResolved() ) {
- throw new IllegalStateException( "Referenced AttributeBiding has not been resolved." );
- }
- return referencedAttributeBinding;
- }
-
- @Override
- public final EntityBinding getReferencedEntityBinding() {
- return (EntityBinding) referencedAttributeBinding.getContainer();
- }
-
-// private void buildForeignKey() {
-// // TODO: move this stuff to relational model
-// ForeignKey foreignKey = getValue().getTable()
-// .createForeignKey( referencedAttributeBinding.getValue().getTable(), foreignKeyName );
-// Iterator referencingValueIterator = getSimpleValues().iterator();
-// Iterator targetValueIterator = referencedAttributeBinding.getSimpleValues().iterator();
-// while ( referencingValueIterator.hasNext() ) {
-// if ( !targetValueIterator.hasNext() ) {
-// // TODO: improve this message
-// throw new MappingException(
-// "number of values in many-to-one reference is greater than number of values in target"
-// );
-// }
-// SimpleValue referencingValue = referencingValueIterator.next();
-// SimpleValue targetValue = targetValueIterator.next();
-// if ( Column.class.isInstance( referencingValue ) ) {
-// if ( !Column.class.isInstance( targetValue ) ) {
-// // TODO improve this message
-// throw new MappingException( "referencing value is a column, but target is not a column" );
-// }
-// foreignKey.addColumnMapping( Column.class.cast( referencingValue ), Column.class.cast( targetValue ) );
-// }
-// else if ( Column.class.isInstance( targetValue ) ) {
-// // TODO: improve this message
-// throw new MappingException( "referencing value is not a column, but target is a column." );
-// }
-// }
-// if ( targetValueIterator.hasNext() ) {
-// throw new MappingException( "target value has more simple values than referencing value" );
-// }
-// }
-//
-// public void validate() {
-// // can't check this until both the domain and relational states are initialized...
-// if ( getCascadeTypes().contains( CascadeType.DELETE_ORPHAN ) ) {
-// if ( !isLogicalOneToOne ) {
-// throw new MappingException(
-// "many-to-one attribute [" + locateAttribute().getName() + "] does not support orphan delete as it is not unique"
-// );
-// }
-// }
-// //TODO: validate that the entity reference is resolved
-// }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/MetaAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/MetaAttribute.java
deleted file mode 100644
index 18babda0e3..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/MetaAttribute.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A meta attribute is a named value or values.
- *
- * @author Gavin King
- */
-public class MetaAttribute implements Serializable {
- private final String name;
- private List values = new ArrayList();
-
- public MetaAttribute(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public List getValues() {
- return Collections.unmodifiableList(values);
- }
-
- public void addValue(String value) {
- values.add( value );
- }
-
- public String getValue() {
- if ( values.size() != 1 ) {
- throw new IllegalStateException( "no unique value" );
- }
- return values.get( 0 );
- }
-
- public boolean isMultiValued() {
- return values.size()>1;
- }
-
- public String toString() {
- return "[" + name + "=" + values + "]";
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/OneToManyCollectionElement.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/OneToManyCollectionElement.java
deleted file mode 100644
index a2b38037fd..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/OneToManyCollectionElement.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-/**
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public class OneToManyCollectionElement extends AbstractCollectionElement {
-
- OneToManyCollectionElement(AbstractPluralAttributeBinding binding) {
- super( binding );
- }
-
- @Override
- public CollectionElementNature getCollectionElementNature() {
- return CollectionElementNature.ONE_TO_MANY;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java
deleted file mode 100644
index df48c1e229..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import java.util.Comparator;
-
-import org.hibernate.metamodel.domain.PluralAttribute;
-import org.hibernate.metamodel.relational.TableSpecification;
-import org.hibernate.persister.collection.CollectionPersister;
-
-/**
- * @author Steve Ebersole
- */
-public interface PluralAttributeBinding extends AssociationAttributeBinding {
- // todo : really it is the element (and/or index) that can be associative not the collection itself...
-
- @Override
- public PluralAttribute getAttribute();
-
- public CollectionKey getCollectionKey();
-
- public AbstractCollectionElement getCollectionElement();
-
- public TableSpecification getCollectionTable();
-
- public boolean isMutable();
-
- public Caching getCaching();
-
- public Class extends CollectionPersister> getCollectionPersisterClass();
-
- public String getCustomLoaderName();
-
- public CustomSQL getCustomSqlInsert();
-
- public CustomSQL getCustomSqlUpdate();
-
- public CustomSQL getCustomSqlDelete();
-
- public CustomSQL getCustomSqlDeleteAll();
-
- public boolean isOrphanDelete();
-
- String getWhere();
-
- boolean isSorted();
-
- Comparator getComparator();
-
- int getBatchSize();
-
- java.util.Map getFilterMap();
-
- boolean isInverse();
-
- String getOrderBy();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SetBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SetBinding.java
deleted file mode 100644
index 98a0b05d02..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SetBinding.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import java.util.Comparator;
-
-import org.hibernate.metamodel.domain.PluralAttribute;
-
-/**
- * @author Steve Ebersole
- */
-public class SetBinding extends AbstractPluralAttributeBinding {
- private Comparator comparator;
-
- protected SetBinding(
- AttributeBindingContainer container,
- PluralAttribute attribute,
- CollectionElementNature collectionElementNature) {
- super( container, attribute, collectionElementNature );
- }
-
- public Comparator getComparator() {
- return comparator;
- }
-
- public void setComparator(Comparator comparator) {
- this.comparator = comparator;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleValueBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleValueBinding.java
deleted file mode 100644
index 0a8dd1afc3..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleValueBinding.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import org.hibernate.metamodel.relational.Column;
-import org.hibernate.metamodel.relational.DerivedValue;
-import org.hibernate.metamodel.relational.SimpleValue;
-
-/**
- * @author Steve Ebersole
- */
-public class SimpleValueBinding {
- private SimpleValue simpleValue;
- private boolean includeInInsert;
- private boolean includeInUpdate;
-
- public SimpleValueBinding() {
- this( true, true );
- }
-
- public SimpleValueBinding(SimpleValue simpleValue) {
- this();
- setSimpleValue( simpleValue );
- }
-
- public SimpleValueBinding(SimpleValue simpleValue, boolean includeInInsert, boolean includeInUpdate) {
- this( includeInInsert, includeInUpdate );
- setSimpleValue( simpleValue );
- }
-
- public SimpleValueBinding(boolean includeInInsert, boolean includeInUpdate) {
- this.includeInInsert = includeInInsert;
- this.includeInUpdate = includeInUpdate;
- }
-
- public SimpleValue getSimpleValue() {
- return simpleValue;
- }
-
- public void setSimpleValue(SimpleValue simpleValue) {
- this.simpleValue = simpleValue;
- if ( DerivedValue.class.isInstance( simpleValue ) ) {
- includeInInsert = false;
- includeInUpdate = false;
- }
- }
-
- public boolean isDerived() {
- return DerivedValue.class.isInstance( simpleValue );
- }
-
- public boolean isNullable() {
- return isDerived() || Column.class.cast( simpleValue ).isNullable();
- }
-
- /**
- * Is the value to be inserted as part of its binding here?
- *
- * NOTE that a column may be bound to multiple attributes. The purpose of this value is to track this
- * notion of "insertability" for this particular binding.
- *
- * @return {@code true} indicates the value should be included; {@code false} indicates it should not
- */
- public boolean isIncludeInInsert() {
- return includeInInsert;
- }
-
- public void setIncludeInInsert(boolean includeInInsert) {
- this.includeInInsert = includeInInsert;
- }
-
- public boolean isIncludeInUpdate() {
- return includeInUpdate;
- }
-
- public void setIncludeInUpdate(boolean includeInUpdate) {
- this.includeInUpdate = includeInUpdate;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAssociationAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAssociationAttributeBinding.java
deleted file mode 100644
index eb1e60c88d..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAssociationAttributeBinding.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-/**
- * Contract describing the attribute binding for singular associations ({@code many-to-one}, {@code one-to-one}).
- *
- * @author Gail Badner
- * @author Steve Ebersole
- */
-@SuppressWarnings( {"JavaDoc", "UnusedDeclaration"})
-public interface SingularAssociationAttributeBinding extends SingularAttributeBinding, AssociationAttributeBinding {
- /**
- * Is this association based on a property reference (non PK column(s) as target of FK)?
- *
- * Convenience form of checking {@link #getReferencedAttributeName()} for {@code null}.
- *
- * @return
- */
- public boolean isPropertyReference();
-
- /**
- * Obtain the name of the referenced entity.
- *
- * @return The referenced entity name
- */
- public String getReferencedEntityName();
-
- /**
- * Set the name of the
- * @param referencedEntityName
- */
- public void setReferencedEntityName(String referencedEntityName);
-
- public String getReferencedAttributeName();
- public void setReferencedAttributeName(String referencedAttributeName);
-
-
- // "resolvable"
- public void resolveReference(AttributeBinding attributeBinding);
- public boolean isReferenceResolved();
- public EntityBinding getReferencedEntityBinding();
- public AttributeBinding getReferencedAttributeBinding();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java
deleted file mode 100644
index 6baf951010..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import org.hibernate.mapping.PropertyGeneration;
-import org.hibernate.metamodel.relational.Value;
-
-/**
- * Specialized binding contract for singular (non-collection) attributes
- *
- * @author Steve Ebersole
- */
-public interface SingularAttributeBinding extends AttributeBinding {
- /**
- * Obtain the value bound here. This could potentially be a {@link org.hibernate.metamodel.relational.Tuple}
- * indicating multiple database values are bound, in which case access to the individual values can be achieved by
- * either casting this return to {@link org.hibernate.metamodel.relational.Tuple} and using its
- * {@link org.hibernate.metamodel.relational.Tuple#values()} method or using the {@link #getSimpleValueBindings()}
- * method here and accessing each bindings {@link SimpleValueBinding#getSimpleValue simple value}
- *
- * @return The bound value
- */
- public Value getValue();
-
- /**
- * Returns the number of {@link SimpleValueBinding} objects that will be returned by
- * {@link #getSimpleValueBindings()}
- *
- * @return the number of {@link SimpleValueBinding simple value bindings}
- *
- * @see #getSimpleValueBindings()
- */
- public int getSimpleValueSpan();
-
- public Iterable getSimpleValueBindings();
-
- public void setSimpleValueBindings(Iterable simpleValueBindings);
-
- /**
- * Convenience method to determine if any {@link SimpleValueBinding simple value bindings} are derived values
- * (formula mappings).
- *
- * @return {@code true} indicates that the binding contains a derived value; {@code false} indicates it does not.
- */
- public boolean hasDerivedValue();
-
- /**
- * Convenience method to determine if all {@link SimpleValueBinding simple value bindings} allow nulls.
- *
- * @return {@code true} indicates that all values allow {@code null}; {@code false} indicates one or more do not
- */
- public boolean isNullable();
-
- /**
- * Obtain the generation strategy for this attribute/value.
- *
- * @return The generation strategy
- */
- public PropertyGeneration getGeneration();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/TypeDef.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/TypeDef.java
deleted file mode 100644
index a272eec5ad..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/TypeDef.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.binding;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Represents the metamodel view of a typedef (type definition).
- *
- * @author John Verhaeg
- */
-public class TypeDef implements Serializable {
- private final String name;
- private final String typeClass;
- private final Map parameters;
-
- public TypeDef(String name, String typeClass, Map parameters) {
- this.name = name;
- this.typeClass = typeClass;
- this.parameters = parameters;
- }
-
- public String getName() {
- return name;
- }
-
- public String getTypeClass() {
- return typeClass;
- }
-
- public Map getParameters() {
- return Collections.unmodifiableMap(parameters);
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/AbstractAttributeContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/AbstractAttributeContainer.java
deleted file mode 100644
index 3258f7de70..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/AbstractAttributeContainer.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.hibernate.cfg.NotYetImplementedException;
-import org.hibernate.internal.util.StringHelper;
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Convenient base class for {@link AttributeContainer}. Because in our model all
- * {@link AttributeContainer AttributeContainers} are also {@link Hierarchical} we also implement that here
- * as well.
- *
- * @author Steve Ebersole
- */
-public abstract class AbstractAttributeContainer implements AttributeContainer, Hierarchical {
- private final String name;
- private final String className;
- private final ValueHolder> classReference;
- private final Hierarchical superType;
- private LinkedHashSet attributeSet = new LinkedHashSet();
- private HashMap attributeMap = new HashMap();
-
- public AbstractAttributeContainer(String name, String className, ValueHolder> classReference, Hierarchical superType) {
- this.name = name;
- this.className = className;
- this.classReference = classReference;
- this.superType = superType;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getClassName() {
- return className;
- }
-
- @Override
- public Class> getClassReference() {
- return classReference.getValue();
- }
-
- @Override
- public ValueHolder> getClassReferenceUnresolved() {
- return classReference;
- }
-
- @Override
- public Hierarchical getSuperType() {
- return superType;
- }
-
- @Override
- public Set attributes() {
- return Collections.unmodifiableSet( attributeSet );
- }
-
- @Override
- public String getRoleBaseName() {
- return getClassName();
- }
-
- @Override
- public Attribute locateAttribute(String name) {
- return attributeMap.get( name );
- }
-
- @Override
- public SingularAttribute locateSingularAttribute(String name) {
- return (SingularAttribute) locateAttribute( name );
- }
-
- @Override
- public SingularAttribute createSingularAttribute(String name) {
- SingularAttribute attribute = new SingularAttributeImpl( name, this );
- addAttribute( attribute );
- return attribute;
- }
-
- @Override
- public SingularAttribute createVirtualSingularAttribute(String name) {
- throw new NotYetImplementedException();
- }
-
- @Override
- public SingularAttribute locateComponentAttribute(String name) {
- return (SingularAttributeImpl) locateAttribute( name );
- }
-
- @Override
- public SingularAttribute createComponentAttribute(String name, Component component) {
- SingularAttributeImpl attribute = new SingularAttributeImpl( name, this );
- attribute.resolveType( component );
- addAttribute( attribute );
- return attribute;
- }
-
- @Override
- public PluralAttribute locatePluralAttribute(String name) {
- return (PluralAttribute) locateAttribute( name );
- }
-
- protected PluralAttribute createPluralAttribute(String name, PluralAttributeNature nature) {
- PluralAttribute attribute = nature.isIndexed()
- ? new IndexedPluralAttributeImpl( name, nature, this )
- : new PluralAttributeImpl( name, nature, this );
- addAttribute( attribute );
- return attribute;
- }
-
- @Override
- public PluralAttribute locateBag(String name) {
- return locatePluralAttribute( name );
- }
-
- @Override
- public PluralAttribute createBag(String name) {
- return createPluralAttribute( name, PluralAttributeNature.BAG );
- }
-
- @Override
- public PluralAttribute locateSet(String name) {
- return locatePluralAttribute( name );
- }
-
- @Override
- public PluralAttribute createSet(String name) {
- return createPluralAttribute( name, PluralAttributeNature.SET );
- }
-
- @Override
- public IndexedPluralAttribute locateList(String name) {
- return (IndexedPluralAttribute) locatePluralAttribute( name );
- }
-
- @Override
- public IndexedPluralAttribute createList(String name) {
- return (IndexedPluralAttribute) createPluralAttribute( name, PluralAttributeNature.LIST );
- }
-
- @Override
- public IndexedPluralAttribute locateMap(String name) {
- return (IndexedPluralAttribute) locatePluralAttribute( name );
- }
-
- @Override
- public IndexedPluralAttribute createMap(String name) {
- return (IndexedPluralAttribute) createPluralAttribute( name, PluralAttributeNature.MAP );
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append( "AbstractAttributeContainer" );
- sb.append( "{name='" ).append( name ).append( '\'' );
- sb.append( ", superType=" ).append( superType );
- sb.append( '}' );
- return sb.toString();
- }
-
- protected void addAttribute(Attribute attribute) {
- // todo : how to best "secure" this?
- if ( attributeMap.put( attribute.getName(), attribute ) != null ) {
- throw new IllegalArgumentException( "Attribute with name [" + attribute.getName() + "] already registered" );
- }
- attributeSet.add( attribute );
- }
-
- // todo : inner classes for now..
-
- public static class SingularAttributeImpl implements SingularAttribute {
- private final AttributeContainer attributeContainer;
- private final String name;
- private Type type;
-
- public SingularAttributeImpl(String name, AttributeContainer attributeContainer) {
- this.name = name;
- this.attributeContainer = attributeContainer;
- }
-
- public boolean isTypeResolved() {
- return type != null;
- }
-
- public void resolveType(Type type) {
- if ( type == null ) {
- throw new IllegalArgumentException( "Attempt to resolve with null type" );
- }
- this.type = type;
- }
-
- @Override
- public Type getSingularAttributeType() {
- return type;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public AttributeContainer getAttributeContainer() {
- return attributeContainer;
- }
-
- @Override
- public boolean isSingular() {
- return true;
- }
- }
-
- public static class PluralAttributeImpl implements PluralAttribute {
- private final AttributeContainer attributeContainer;
- private final PluralAttributeNature nature;
- private final String name;
-
- private Type elementType;
-
- public PluralAttributeImpl(String name, PluralAttributeNature nature, AttributeContainer attributeContainer) {
- this.name = name;
- this.nature = nature;
- this.attributeContainer = attributeContainer;
- }
-
- @Override
- public AttributeContainer getAttributeContainer() {
- return attributeContainer;
- }
-
- @Override
- public boolean isSingular() {
- return false;
- }
-
- @Override
- public PluralAttributeNature getNature() {
- return nature;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getRole() {
- return StringHelper.qualify( attributeContainer.getRoleBaseName(), name );
- }
-
- @Override
- public Type getElementType() {
- return elementType;
- }
-
- @Override
- public void setElementType(Type elementType) {
- this.elementType = elementType;
- }
- }
-
- public static class IndexedPluralAttributeImpl extends PluralAttributeImpl implements IndexedPluralAttribute {
- private Type indexType;
-
- public IndexedPluralAttributeImpl(String name, PluralAttributeNature nature, AttributeContainer attributeContainer) {
- super( name, nature, attributeContainer );
- }
-
- @Override
- public Type getIndexType() {
- return indexType;
- }
-
- @Override
- public void setIndexType(Type indexType) {
- this.indexType = indexType;
- }
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Attribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Attribute.java
deleted file mode 100644
index c58bd8778f..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Attribute.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-/**
- * Describes an attribute.
- *
- * @author Steve Ebersole
- */
-public interface Attribute {
- /**
- * Retrieve the attribute name.
- *
- * @return The attribute name.
- */
- public String getName();
-
- /**
- * Retrieve the declaring container for this attribute (entity/component).
- *
- * @return The attribute container.
- */
- public AttributeContainer getAttributeContainer();
-
- /**
- * An attribute can be either:
- * - singular - castable to {@link SingularAttribute}
- * - plural - castable to {@link PluralAttribute}
- *
- *
- * @return True if attribute is singular; false if plural.
- */
- public boolean isSingular();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/AttributeContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/AttributeContainer.java
deleted file mode 100644
index 6024c758e4..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/AttributeContainer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import java.util.Set;
-
-/**
- * Basic contract for any container holding attributes. This allows polymorphic handling of both
- * components and entities in terms of the attributes they hold.
- *
- * @author Steve Ebersole
- */
-public interface AttributeContainer extends Type {
- /**
- * Obtain the name of this container in terms of creating attribute role names.
- *
- * NOTE : A role uniquely names each attribute. The role name is the name of the attribute prefixed by the "path"
- * to its container.
- *
- * @return The container base name for role construction.
- */
- public String getRoleBaseName();
-
- /**
- * Retrieve an attribute by name.
- *
- * @param name The name of the attribute to retrieve.
- *
- * @return The attribute matching the given name, or null.
- */
- public Attribute locateAttribute(String name);
-
- /**
- * Retrieve the attributes contained in this container.
- *
- * @return The contained attributes
- */
- public Set attributes();
-
- public SingularAttribute locateSingularAttribute(String name);
- public SingularAttribute createSingularAttribute(String name);
- public SingularAttribute createVirtualSingularAttribute(String name);
-
- public SingularAttribute locateComponentAttribute(String name);
- public SingularAttribute createComponentAttribute(String name, Component component);
-
- public PluralAttribute locatePluralAttribute(String name);
-
- public PluralAttribute locateBag(String name);
- public PluralAttribute createBag(String name);
-
- public PluralAttribute locateSet(String name);
- public PluralAttribute createSet(String name);
-
- public IndexedPluralAttribute locateList(String name);
- public IndexedPluralAttribute createList(String name);
-
- public IndexedPluralAttribute locateMap(String name);
- public IndexedPluralAttribute createMap(String name);
-
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/BasicType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/BasicType.java
deleted file mode 100644
index 682ce46afd..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/BasicType.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Models a basic type.
- *
- * @author Steve Ebersole
- */
-public class BasicType implements Type {
- private final String name;
- private final ValueHolder> classReference;
-
- public BasicType(String name, ValueHolder> classReference) {
- this.name = name;
- this.classReference = classReference;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getClassName() {
- return name;
- }
-
- @Override
- public Class> getClassReference() {
- return classReference.getValue();
- }
-
- @Override
- public ValueHolder> getClassReferenceUnresolved() {
- return classReference;
- }
-
- @Override
- public boolean isAssociation() {
- return false;
- }
-
- @Override
- public boolean isComponent() {
- return false;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Component.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Component.java
deleted file mode 100644
index e300355a43..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Component.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Models the notion of a component (what JPA calls an Embeddable).
- *
- * NOTE : Components are not currently really hierarchical. But that is a feature I want to add.
- *
- * @author Steve Ebersole
- */
-public class Component extends AbstractAttributeContainer {
- public Component(String name, String className, ValueHolder> classReference, Hierarchical superType) {
- super( name, className, classReference, superType );
- }
-
- @Override
- public boolean isAssociation() {
- return false;
- }
-
- @Override
- public boolean isComponent() {
- return true;
- }
-
- @Override
- public String getRoleBaseName() {
- // todo : this is not really completely accurate atm
- // the role base here should really be the role of the component attribute.
- return getClassName();
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Entity.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Entity.java
deleted file mode 100644
index fc6b41f6a3..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Entity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Models the notion of an entity
- *
- * @author Steve Ebersole
- * @author Hardy Ferentschik
- */
-public class Entity extends AbstractAttributeContainer {
- /**
- * Constructor for the entity
- *
- * @param entityName The name of the entity
- * @param className The name of this entity's java class
- * @param classReference The reference to this entity's {@link Class}
- * @param superType The super type for this entity. If there is not super type {@code null} needs to be passed.
- */
- public Entity(String entityName, String className, ValueHolder> classReference, Hierarchical superType) {
- super( entityName, className, classReference, superType );
- }
-
- @Override
- public boolean isAssociation() {
- return true;
- }
-
- @Override
- public boolean isComponent() {
- return false;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Hierarchical.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Hierarchical.java
deleted file mode 100644
index fd587b0a1f..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Hierarchical.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-/**
- * Additional contract for things that can occur in an inheritance hierarchy (specifically ones we would
- * need to traverse).
- *
- * @author Steve Ebersole
- */
-public interface Hierarchical extends AttributeContainer {
- /**
- * Retrieve the super type.
- *
- * @return The super type, or null if no super type.
- */
- public Hierarchical getSuperType();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/IndexedPluralAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/IndexedPluralAttribute.java
deleted file mode 100644
index 5a15664925..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/IndexedPluralAttribute.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public interface IndexedPluralAttribute extends PluralAttribute {
- public Type getIndexType();
- public void setIndexType(Type indexType);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/JavaType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/JavaType.java
deleted file mode 100644
index 1b89606989..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/JavaType.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Models the naming of a Java type where we may not have access to that type's {@link Class} reference. Generally
- * speaking this is the case in various hibernate-tools and reverse-engineering use cases.
- *
- * @author Steve Ebersole
- */
-public class JavaType {
- private final String name;
- private final ValueHolder> classReference;
-
- public JavaType(final String name, final ClassLoaderService classLoaderService) {
- this.name = name;
- this.classReference = new ValueHolder>(
- new ValueHolder.DeferredInitializer>() {
- @Override
- public Class> initialize() {
- return classLoaderService.classForName( name );
- }
- }
- );
- }
-
- public JavaType(Class> theClass) {
- this.name = theClass.getName();
- this.classReference = new ValueHolder>( theClass );
- }
-
- public String getName() {
- return name;
- }
-
- public Class> getClassReference() {
- return classReference.getValue();
- }
-
- @Override
- public String toString() {
- return new StringBuilder( super.toString() )
- .append( "[name=" ).append( name ).append( "]" )
- .toString();
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/NonEntity.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/NonEntity.java
deleted file mode 100644
index 973dc8af6e..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/NonEntity.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Models the concept class in the hierarchy with no persistent attributes.
- *
- * @author Hardy Ferentschik
- */
-public class NonEntity extends AbstractAttributeContainer {
- /**
- * Constructor for the non-entity
- *
- * @param entityName The name of the non-entity
- * @param className The name of this non-entity's java class
- * @param classReference The reference to this non-entity's {@link Class}
- * @param superType The super type for this non-entity. If there is not super type {@code null} needs to be passed.
- */
- public NonEntity(String entityName, String className, ValueHolder> classReference, Hierarchical superType) {
- super( entityName, className, classReference, superType );
- }
-
- @Override
- public boolean isAssociation() {
- return true;
- }
-
- @Override
- public boolean isComponent() {
- return false;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/PluralAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/PluralAttribute.java
deleted file mode 100644
index 4914f05da1..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/PluralAttribute.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public interface PluralAttribute extends Attribute {
- public String getRole();
- public PluralAttributeNature getNature();
- public Type getElementType();
- public void setElementType(Type elementType);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/PluralAttributeNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/PluralAttributeNature.java
deleted file mode 100644
index 492299ad68..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/PluralAttributeNature.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Identifies the specific semantic of a plural valued attribute.
- *
- * @author Steve Ebersole
- */
-public enum PluralAttributeNature {
- BAG( "bag", Collection.class ),
- IDBAG( "idbag", Collection.class ),
- SET( "set", Set.class ),
- LIST( "list", List.class ),
- MAP( "map", Map.class );
-
- private final String name;
- private final Class javaContract;
- private final boolean indexed;
-
- PluralAttributeNature(String name, Class javaContract) {
- this.name = name;
- this.javaContract = javaContract;
- this.indexed = Map.class.isAssignableFrom( javaContract ) || List.class.isAssignableFrom( javaContract );
- }
-
- public String getName() {
- return name;
- }
-
- public Class getJavaContract() {
- return javaContract;
- }
-
- public boolean isIndexed() {
- return indexed;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/SingularAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/SingularAttribute.java
deleted file mode 100644
index f27b61fced..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/SingularAttribute.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-/**
- * A single valued (non-collection) attribute
- *
- * @author Steve Ebersole
- */
-public interface SingularAttribute extends Attribute {
- /**
- * Retrieve the attribute type descriptor.
- *
- * @return THe attribute type.
- */
- public Type getSingularAttributeType();
-
- public boolean isTypeResolved();
-
- public void resolveType(Type type);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Superclass.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Superclass.java
deleted file mode 100644
index 4a5a095339..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Superclass.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Models the concept of a (intermediate) superclass
- *
- * @author Steve Ebersole
- */
-public class Superclass extends AbstractAttributeContainer {
- /**
- * Constructor for the entity
- *
- * @param entityName The name of the entity
- * @param className The name of this entity's java class
- * @param classReference The reference to this entity's {@link Class}
- * @param superType The super type for this entity. If there is not super type {@code null} needs to be passed.
- */
- public Superclass(String entityName, String className, ValueHolder> classReference, Hierarchical superType) {
- super( entityName, className, classReference, superType );
- }
-
- @Override
- public boolean isAssociation() {
- return true;
- }
-
- @Override
- public boolean isComponent() {
- return false;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Type.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Type.java
deleted file mode 100644
index 58d0f9592a..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/Type.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-import org.hibernate.internal.util.ValueHolder;
-
-/**
- * Basic information about a Java type, in regards to its role in particular set of mappings.
- *
- * @author Steve Ebersole
- */
-public interface Type {
- /**
- * Obtain the name of the type.
- *
- * @return The name
- */
- public String getName();
-
- /**
- * Obtain the java class name for this type.
- *
- * @return The class name
- */
- public String getClassName();
-
- /**
- * Obtain the java {@link Class} reference for this type
- *
- * @return The {@link Class} reference
- *
- * @throws org.hibernate.boot.registry.classloading.spi.ClassLoadingException Indicates the class reference
- * could not be determined. Generally this is the case in reverse-engineering scenarios where the specified
- * domain model classes do not yet exist.
- */
- public Class> getClassReference();
-
- public ValueHolder> getClassReferenceUnresolved();
-
- public boolean isAssociation();
-
- public boolean isComponent();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/TypeNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/TypeNature.java
deleted file mode 100644
index 09350d2a80..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/TypeNature.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.domain;
-
-/**
- * Describes the type of a type :/
- *
- * @author Steve Ebersole
- */
-public enum TypeNature {
- BASIC( "basic" ),
- COMPONENT( "component" ),
- ENTITY( "entity" ),
- SUPERCLASS( "superclass" ),
- NON_ENTITY( "non-entity" );
-
- private final String name;
-
- private TypeNature(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public String toString() {
- return super.toString() + "[" + getName() + "]";
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/package.html b/hibernate-core/src/main/java/org/hibernate/metamodel/domain/package.html
deleted file mode 100644
index cb880cc0eb..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/domain/package.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
- This package defines metadata modeling of a logical domain model. Specifically note that
- this package does not in any way attempt to encapsulate data modeling information such
- cardinality or associations. Also note that the top-level logical model is represetation (entity-mode)
- agnostic.
-
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/package.html b/hibernate-core/src/main/java/org/hibernate/metamodel/package.html
deleted file mode 100644
index 08f331856d..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/package.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
- NOTE: This package is currently unfinished and therefore considered experimental and unsupported.
-
-
- This package defines the new Hibernate metamodel as well as the code used to build that metamodel from user sources
- (HBM mapping files, annotations, etc).
-
-
-
\ No newline at end of file
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractAuxiliaryDatabaseObject.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractAuxiliaryDatabaseObject.java
deleted file mode 100644
index 8b2b58c0a6..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractAuxiliaryDatabaseObject.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Convenience base class for {@link org.hibernate.mapping.AuxiliaryDatabaseObject}s.
- *
- * This implementation performs dialect scoping checks strictly based on
- * dialect name comparisons. Custom implementations might want to do
- * instanceof-type checks.
- *
- * @author Steve Ebersole
- */
-public abstract class AbstractAuxiliaryDatabaseObject implements AuxiliaryDatabaseObject {
- // Use a UUID in identifier prefix because this object is not qualified by a schema/catalog
- // (not sure this matters...)
- private static final String EXPORT_IDENTIFIER_PREFIX = "auxiliary-object-" + UUID.randomUUID();
- private static final AtomicInteger counter = new AtomicInteger( 0 );
- private final String exportIdentifier;
- private final Set dialectScopes;
-
- protected AbstractAuxiliaryDatabaseObject(Set dialectScopes) {
- this.dialectScopes = dialectScopes == null ? new HashSet() : dialectScopes;
- this.exportIdentifier =
- new StringBuilder( EXPORT_IDENTIFIER_PREFIX )
- .append( '.' )
- .append( counter.getAndIncrement() )
- .toString();
- }
-
- public void addDialectScope(String dialectName) {
- dialectScopes.add( dialectName );
- }
-
- public Iterable getDialectScopes() {
- return dialectScopes;
- }
-
- public boolean appliesToDialect(Dialect dialect) {
- // empty means no scoping
- return dialectScopes.isEmpty() || dialectScopes.contains( dialect.getClass().getName() );
- }
-
- @Override
- public String getExportIdentifier() {
- return exportIdentifier;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractConstraint.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractConstraint.java
deleted file mode 100644
index bad9ae1c74..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractConstraint.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Support for writing {@link Constraint} implementations
- *
- * @todo do we need to support defining these on particular schemas/catalogs?
- *
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public abstract class AbstractConstraint implements Constraint {
- private final TableSpecification table;
- private final String name;
- private List columns = new ArrayList();
-
- protected AbstractConstraint(TableSpecification table, String name) {
- this.table = table;
- this.name = name;
- }
-
- public TableSpecification getTable() {
- return table;
- }
-
- public String getName() {
- return name;
- }
-
- public Iterable getColumns() {
- return columns;
- }
-
- protected int getColumnSpan() {
- return columns.size();
- }
-
- protected List internalColumnAccess() {
- return columns;
- }
-
- public void addColumn(Column column) {
- internalAddColumn( column );
- }
-
- protected void internalAddColumn(Column column) {
- if ( column.getTable() != getTable() ) {
- throw new AssertionFailure(
- String.format(
- "Unable to add column to constraint; tables [%s, %s] did not match",
- column.getTable().toLoggableString(),
- getTable().toLoggableString()
- )
- );
- }
- columns.add( column );
- }
-
- protected boolean isCreationVetoed(Dialect dialect) {
- return false;
- }
-
- protected abstract String sqlConstraintStringInAlterTable(Dialect dialect);
-
- public String[] sqlDropStrings(Dialect dialect) {
- if ( isCreationVetoed( dialect ) ) {
- return null;
- }
- else {
- return new String[] {
- new StringBuilder()
- .append( "alter table " )
- .append( getTable().getQualifiedName( dialect ) )
- .append( " drop constraint " )
- .append( dialect.quote( getName() ) )
- .toString()
- };
- }
- }
-
- public String[] sqlCreateStrings(Dialect dialect) {
- if ( isCreationVetoed( dialect ) ) {
- return null;
- }
- else {
- return new String[] {
- new StringBuilder( "alter table " )
- .append( getTable().getQualifiedName( dialect ) )
- .append( sqlConstraintStringInAlterTable( dialect ) )
- .toString()
- };
- }
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractSimpleValue.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractSimpleValue.java
deleted file mode 100644
index 8bec29682f..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractSimpleValue.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.internal.CoreMessageLogger;
-import org.hibernate.metamodel.ValidationException;
-
-import org.jboss.logging.Logger;
-
-/**
- * Basic support for {@link SimpleValue} implementations.
- *
- * @author Steve Ebersole
- */
-public abstract class AbstractSimpleValue implements SimpleValue {
-
- private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, AbstractSimpleValue.class.getName());
-
- private final TableSpecification table;
- private final int position;
- private Datatype datatype;
-
- protected AbstractSimpleValue(TableSpecification table, int position) {
- this.table = table;
- this.position = position;
- }
-
- @Override
- public TableSpecification getTable() {
- return table;
- }
-
- public int getPosition() {
- return position;
- }
-
- @Override
- public Datatype getDatatype() {
- return datatype;
- }
-
- @Override
- public void setDatatype(Datatype datatype) {
- LOG.debugf( "setting datatype for column %s : %s", toLoggableString(), datatype );
- if ( this.datatype != null && ! this.datatype.equals( datatype ) ) {
- LOG.debugf( "overriding previous datatype : %s", this.datatype );
- }
- this.datatype = datatype;
- }
-
- @Override
- public void validateJdbcTypes(JdbcCodes typeCodes) {
- // todo : better compatibility testing...
- if ( datatype.getTypeCode() != typeCodes.nextJdbcCde() ) {
- throw new ValidationException( "Mismatched types" );
- }
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractTableSpecification.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractTableSpecification.java
deleted file mode 100644
index 3165c6b107..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AbstractTableSpecification.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Convenience base class for implementing the {@link ValueContainer} contract centralizing commonality
- * between modeling tables, views and inline views.
- *
- * @author Steve Ebersole
- */
-public abstract class AbstractTableSpecification implements TableSpecification {
- private final static AtomicInteger tableCounter = new AtomicInteger( 0 );
- private final int tableNumber;
-
- private final LinkedHashMap values = new LinkedHashMap();
-
- private final PrimaryKey primaryKey = new PrimaryKey( this );
- private final List foreignKeys = new ArrayList();
-
- public AbstractTableSpecification() {
- this.tableNumber = tableCounter.getAndIncrement();
- }
-
- @Override
- public int getTableNumber() {
- return tableNumber;
- }
-
- @Override
- public Iterable values() {
- return values.values();
- }
-
- @Override
- public Column locateOrCreateColumn(String name) {
- if(values.containsKey( name )){
- return (Column) values.get( name );
- }
- final Column column = new Column( this, values.size(), name );
- values.put( name, column );
- return column;
- }
-
- @Override
- public DerivedValue locateOrCreateDerivedValue(String fragment) {
- if(values.containsKey( fragment )){
- return (DerivedValue) values.get( fragment );
- }
- final DerivedValue value = new DerivedValue( this, values.size(), fragment );
- values.put( fragment, value );
- return value;
- }
-
- @Override
- public Tuple createTuple(String name) {
- return new Tuple( this, name );
- }
-
- @Override
- public Iterable getForeignKeys() {
- return foreignKeys;
- }
-
- @Override
- public ForeignKey createForeignKey(TableSpecification targetTable, String name) {
- ForeignKey fk = new ForeignKey( this, targetTable, name );
- foreignKeys.add( fk );
- return fk;
- }
-
- @Override
- public PrimaryKey getPrimaryKey() {
- return primaryKey;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AuxiliaryDatabaseObject.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AuxiliaryDatabaseObject.java
deleted file mode 100644
index 9b0b6dc770..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/AuxiliaryDatabaseObject.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.io.Serializable;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Auxiliary database objects (i.e., triggers, stored procedures, etc) defined
- * in the mappings. Allows Hibernate to manage their lifecycle as part of
- * creating/dropping the schema.
- *
- * @author Steve Ebersole
- */
-public interface AuxiliaryDatabaseObject extends Exportable, Serializable {
- /**
- * Does this database object apply to the given dialect?
- *
- * @param dialect The dialect to check against.
- * @return True if this database object does apply to the given dialect.
- */
- boolean appliesToDialect(Dialect dialect);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/BasicAuxiliaryDatabaseObjectImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/BasicAuxiliaryDatabaseObjectImpl.java
deleted file mode 100644
index 07389d08ca..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/BasicAuxiliaryDatabaseObjectImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.Set;
-
-import org.hibernate.dialect.Dialect;
-import org.hibernate.internal.util.StringHelper;
-
-/**
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public class BasicAuxiliaryDatabaseObjectImpl extends AbstractAuxiliaryDatabaseObject {
- private static final String CATALOG_NAME_PLACEHOLDER = "${catalog}";
- private static final String SCHEMA_NAME_PLACEHOLDER = "${schema}";
- private final Schema defaultSchema;
- private final String createString;
- private final String dropString;
-
- public BasicAuxiliaryDatabaseObjectImpl(
- Schema defaultSchema,
- String createString,
- String dropString,
- Set dialectScopes) {
- super( dialectScopes );
- // keep track of the default schema and the raw create/drop strings;
- // we may want to allow copying into a database with a different default schema in the future;
- this.defaultSchema = defaultSchema;
- this.createString = createString;
- this.dropString = dropString;
- }
-
- @Override
- public String[] sqlCreateStrings(Dialect dialect) {
- return new String[] { injectCatalogAndSchema( createString, defaultSchema ) };
- }
-
- @Override
- public String[] sqlDropStrings(Dialect dialect) {
- return new String[] { injectCatalogAndSchema( dropString, defaultSchema ) };
- }
-
- private static String injectCatalogAndSchema(String ddlString, Schema schema) {
- String rtn = StringHelper.replace( ddlString, CATALOG_NAME_PLACEHOLDER, schema.getName().getCatalog().getName() );
- rtn = StringHelper.replace( rtn, SCHEMA_NAME_PLACEHOLDER, schema.getName().getSchema().getName() );
- return rtn;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/CheckConstraint.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/CheckConstraint.java
deleted file mode 100644
index 52c0a5c129..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/CheckConstraint.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public class CheckConstraint {
- private final Table table;
- private String name;
- private String condition;
-
- public CheckConstraint(Table table) {
- this.table = table;
- }
-
- public CheckConstraint(Table table, String name, String condition) {
- this.table = table;
- this.name = name;
- this.condition = condition;
- }
-
- public String getCondition() {
- return condition;
- }
-
- public void setCondition(String condition) {
- this.condition = condition;
- }
-
- /**
- * Obtain the table to which this constraint applies.
- *
- * @return The constrained table.
- */
- public Table getTable() {
- return table;
- }
-
- /**
- * Obtain the constraint name.
- *
- * @return the name.
- */
- public String getName() {
- return name;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java
deleted file mode 100644
index 577712bc44..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.MappingException;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.internal.util.StringHelper;
-import org.hibernate.metamodel.relational.state.ColumnRelationalState;
-
-/**
- * Models a physical column
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class Column extends AbstractSimpleValue {
- private final Identifier columnName;
- private boolean nullable;
- private boolean unique;
-
- private String defaultValue;
- private String checkCondition;
- private String sqlType;
-
- private String readFragment;
- private String writeFragment;
-
- private String comment;
-
- private Size size = new Size();
-
- protected Column(TableSpecification table, int position, String name) {
- this( table, position, Identifier.toIdentifier( name ) );
- }
-
- protected Column(TableSpecification table, int position, Identifier name) {
- super( table, position );
- this.columnName = name;
- }
-
- public void initialize(ColumnRelationalState state, boolean forceNonNullable, boolean forceUnique) {
- size.initialize( state.getSize() );
- nullable = ! forceNonNullable && state.isNullable();
- unique = ! forceUnique && state.isUnique();
- checkCondition = state.getCheckCondition();
- defaultValue = state.getDefault();
- sqlType = state.getSqlType();
-
- // TODO: this should go into binding instead (I think???)
- writeFragment = state.getCustomWriteFragment();
- readFragment = state.getCustomReadFragment();
- comment = state.getComment();
- for ( String uniqueKey : state.getUniqueKeys() ) {
- getTable().getOrCreateUniqueKey( uniqueKey ).addColumn( this );
- }
- for ( String index : state.getIndexes() ) {
- getTable().getOrCreateIndex( index ).addColumn( this );
- }
- }
-
- public Identifier getColumnName() {
- return columnName;
- }
-
- public boolean isNullable() {
- return nullable;
- }
-
- public void setNullable(boolean nullable) {
- this.nullable = nullable;
- }
-
- public boolean isUnique() {
- return unique;
- }
-
- public void setUnique(boolean unique) {
- this.unique = unique;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public String getCheckCondition() {
- return checkCondition;
- }
-
- public void setCheckCondition(String checkCondition) {
- this.checkCondition = checkCondition;
- }
-
- public String getSqlType() {
- return sqlType;
- }
-
- public void setSqlType(String sqlType) {
- this.sqlType = sqlType;
- }
-
- public String getReadFragment() {
- return readFragment;
- }
-
- public void setReadFragment(String readFragment) {
- this.readFragment = readFragment;
- }
-
- public String getWriteFragment() {
- return writeFragment;
- }
-
- public void setWriteFragment(String writeFragment) {
- this.writeFragment = writeFragment;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public Size getSize() {
- return size;
- }
-
- public void setSize(Size size) {
- this.size = size;
- }
-
- @Override
- public String toLoggableString() {
- return getTable().getLoggableValueQualifier() + '.' + getColumnName();
- }
-
- @Override
- public String getAlias(Dialect dialect) {
- String alias = columnName.getName();
- int lastLetter = StringHelper.lastIndexOfLetter( columnName.getName() );
- if ( lastLetter == -1 ) {
- alias = "column";
- }
- boolean useRawName =
- columnName.getName().equals( alias ) &&
- alias.length() <= dialect.getMaxAliasLength() &&
- ! columnName.isQuoted() &&
- ! columnName.getName().toLowerCase().equals( "rowid" );
- if ( ! useRawName ) {
- String unique =
- new StringBuilder()
- .append( getPosition() )
- .append( '_' )
- .append( getTable().getTableNumber() )
- .append( '_' )
- .toString();
- if ( unique.length() >= dialect.getMaxAliasLength() ) {
- throw new MappingException(
- "Unique suffix [" + unique + "] length must be less than maximum [" + dialect.getMaxAliasLength() + "]"
- );
- }
- if ( alias.length() + unique.length() > dialect.getMaxAliasLength()) {
- alias = alias.substring( 0, dialect.getMaxAliasLength() - unique.length() );
- }
- alias = alias + unique;
- }
- return alias;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Constraint.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Constraint.java
deleted file mode 100644
index 5587ebcbd6..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Constraint.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-/**
- * Basic contract for the types of constraints we fully support as metadata constructs:
- * - primary key
- * - foreign key
- * - unique constraint
- *
- *
- * @author Steve Ebersole
- */
-public interface Constraint extends Exportable {
- /**
- * Obtain the table to which this constraint applies.
- *
- * @return The constrained table.
- */
- public TableSpecification getTable();
-
- /**
- * Obtain the constraint name.
- *
- * @return the name.
- */
- public String getName();
-
- /**
- * Obtain the columns that are part of this constraint.
- *
- * @return The constrained columns.
- */
- public Iterable getColumns();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Database.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Database.java
deleted file mode 100644
index 3291b967ed..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Database.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hibernate.MappingException;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.internal.util.StringHelper;
-import org.hibernate.internal.util.collections.ArrayHelper;
-import org.hibernate.metamodel.Metadata;
-
-/**
- * Represents a database and manages the named schema/catalog pairs defined within.
- *
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public class Database {
- private final Schema.Name implicitSchemaName;
-
- private final Map schemaMap = new HashMap();
- private final List auxiliaryDatabaseObjects = new ArrayList();
-
- public Database(Metadata.Options options) {
- String schemaName = options.getDefaultSchemaName();
- String catalogName = options.getDefaultCatalogName();
- if ( options.isGloballyQuotedIdentifiers() ) {
- schemaName = StringHelper.quote( schemaName );
- catalogName = StringHelper.quote( catalogName );
- }
- implicitSchemaName = new Schema.Name( schemaName, catalogName );
- makeSchema( implicitSchemaName );
- }
-
- public Schema getDefaultSchema() {
- return schemaMap.get( implicitSchemaName );
- }
-
- public Schema locateSchema(Schema.Name name) {
- if ( name.getSchema() == null && name.getCatalog() == null ) {
- return getDefaultSchema();
- }
- Schema schema = schemaMap.get( name );
- if ( schema == null ) {
- schema = makeSchema( name );
- }
- return schema;
- }
-
- private Schema makeSchema(Schema.Name name) {
- Schema schema;
- schema = new Schema( name );
- schemaMap.put( name, schema );
- return schema;
- }
-
- public Schema getSchema(Identifier schema, Identifier catalog) {
- return locateSchema( new Schema.Name( schema, catalog ) );
- }
-
- public Schema getSchema(String schema, String catalog) {
- return locateSchema( new Schema.Name( Identifier.toIdentifier( schema ), Identifier.toIdentifier( catalog ) ) );
- }
-
- public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) {
- if ( auxiliaryDatabaseObject == null ) {
- throw new IllegalArgumentException( "Auxiliary database object is null." );
- }
- auxiliaryDatabaseObjects.add( auxiliaryDatabaseObject );
- }
-
- public Iterable getAuxiliaryDatabaseObjects() {
- return auxiliaryDatabaseObjects;
- }
-
- public String[] generateSchemaCreationScript(Dialect dialect) {
- Set exportIdentifiers = new HashSet( 50 );
- List script = new ArrayList( 50 );
-
- for ( Schema schema : schemaMap.values() ) {
- // TODO: create schema/catalog???
- for ( Table table : schema.getTables() ) {
- addSqlCreateStrings( dialect, exportIdentifiers, script, table );
- }
- }
-
- for ( Schema schema : schemaMap.values() ) {
- for ( Table table : schema.getTables() ) {
-
- for ( UniqueKey uniqueKey : table.getUniqueKeys() ) {
- addSqlCreateStrings( dialect, exportIdentifiers, script, uniqueKey );
- }
-
- for ( Index index : table.getIndexes() ) {
- addSqlCreateStrings( dialect, exportIdentifiers, script, index );
- }
-
- if ( dialect.hasAlterTable() ) {
- for ( ForeignKey foreignKey : table.getForeignKeys() ) {
- // only add the foreign key if its target is a physical table
- if ( Table.class.isInstance( foreignKey.getTargetTable() ) ) {
- addSqlCreateStrings( dialect, exportIdentifiers, script, foreignKey );
- }
- }
- }
-
- }
- }
-
- // TODO: add sql create strings from PersistentIdentifierGenerator.sqlCreateStrings()
-
- for ( AuxiliaryDatabaseObject auxiliaryDatabaseObject : auxiliaryDatabaseObjects ) {
- if ( auxiliaryDatabaseObject.appliesToDialect( dialect ) ) {
- addSqlCreateStrings( dialect, exportIdentifiers, script, auxiliaryDatabaseObject );
- }
- }
-
- return ArrayHelper.toStringArray( script );
- }
-
- public String[] generateDropSchemaScript(Dialect dialect) {
- Set exportIdentifiers = new HashSet( 50 );
- List script = new ArrayList( 50 );
-
-
- // drop them in reverse order in case db needs it done that way...
- for ( int i = auxiliaryDatabaseObjects.size() - 1 ; i >= 0 ; i-- ) {
- AuxiliaryDatabaseObject object = auxiliaryDatabaseObjects.get( i );
- if ( object.appliesToDialect( dialect ) ) {
- addSqlDropStrings( dialect, exportIdentifiers, script, object );
- }
- }
-
- if ( dialect.dropConstraints() ) {
- for ( Schema schema : schemaMap.values() ) {
- for ( Table table : schema.getTables() ) {
- for ( ForeignKey foreignKey : table.getForeignKeys() ) {
- // only include foreign key if the target table is physical
- if ( foreignKey.getTargetTable() instanceof Table ) {
- addSqlDropStrings( dialect, exportIdentifiers, script, foreignKey );
- }
- }
- }
- }
- }
-
- for ( Schema schema : schemaMap.values() ) {
- for ( Table table : schema.getTables() ) {
- addSqlDropStrings( dialect, exportIdentifiers, script, table );
- }
- }
-
- // TODO: add sql drop strings from PersistentIdentifierGenerator.sqlCreateStrings()
-
- // TODO: drop schemas/catalogs???
-
- return ArrayHelper.toStringArray( script );
- }
-
- private static void addSqlDropStrings(
- Dialect dialect,
- Set exportIdentifiers,
- List script,
- Exportable exportable) {
- addSqlStrings(
- exportIdentifiers, script, exportable.getExportIdentifier(), exportable.sqlDropStrings( dialect )
- );
- }
-
- private static void addSqlCreateStrings(
- Dialect dialect,
- Set exportIdentifiers,
- List script,
- Exportable exportable) {
- addSqlStrings(
- exportIdentifiers, script, exportable.getExportIdentifier(), exportable.sqlCreateStrings( dialect )
- );
- }
-
- private static void addSqlStrings(
- Set exportIdentifiers,
- List script,
- String exportIdentifier,
- String[] sqlStrings) {
- if ( sqlStrings == null ) {
- return;
- }
- if ( exportIdentifiers.contains( exportIdentifier ) ) {
- throw new MappingException(
- "SQL strings added more than once for: " + exportIdentifier
- );
- }
- exportIdentifiers.add( exportIdentifier );
- script.addAll( Arrays.asList( sqlStrings ) );
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java
deleted file mode 100644
index f0f5189b6d..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-/**
- * Models a JDBC {@link java.sql.Types DATATYPE}
- *
- * @todo Do we somehow link this in with {@link org.hibernate.internal.util.jdbc.TypeInfo} ?
- *
- * @author Steve Ebersole
- */
-public class Datatype {
- private final int typeCode;
- private final String typeName;
- private final Class javaType;
- private final int hashCode;
-
- public Datatype(int typeCode, String typeName, Class javaType) {
- this.typeCode = typeCode;
- this.typeName = typeName;
- this.javaType = javaType;
- this.hashCode = generateHashCode();
- }
-
- private int generateHashCode() {
- int result = typeCode;
- if ( typeName != null ) {
- result = 31 * result + typeName.hashCode();
- }
- if ( javaType != null ) {
- result = 31 * result + javaType.hashCode();
- }
- return result;
- }
-
- public int getTypeCode() {
- return typeCode;
- }
-
- public String getTypeName() {
- return typeName;
- }
-
- public Class getJavaType() {
- return javaType;
- }
-
- @Override
- public boolean equals(Object o) {
- if ( this == o ) {
- return true;
- }
- if ( o == null || getClass() != o.getClass() ) {
- return false;
- }
-
- Datatype datatype = (Datatype) o;
-
- return typeCode == datatype.typeCode
- && javaType.equals( datatype.javaType )
- && typeName.equals( datatype.typeName );
-
- }
-
- @Override
- public int hashCode() {
- return hashCode;
- }
-
- @Override
- public String toString() {
- return super.toString() + "[code=" + typeCode + ", name=" + typeName + ", javaClass=" + javaType.getName() + "]";
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/DerivedValue.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/DerivedValue.java
deleted file mode 100644
index 2f39332ac7..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/DerivedValue.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models a value expression. It is the result of a formula mapping.
- *
- * @author Steve Ebersole
- */
-public class DerivedValue extends AbstractSimpleValue {
- private final String expression;
-
- public DerivedValue(TableSpecification table, int position, String expression) {
- super( table, position );
- this.expression = expression;
- }
-
- @Override
- public String toLoggableString() {
- return getTable().toLoggableString() + ".{derived-column}";
- }
-
- @Override
- public String getAlias(Dialect dialect) {
- return "formula" + Integer.toString( getPosition() ) + '_';
- }
-
- /**
- * Get the value expression.
- * @return the value expression
- */
- public String getExpression() {
- return expression;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Exportable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Exportable.java
deleted file mode 100644
index 7d720c2322..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Exportable.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Contract for entities (in the ERD sense) which can be exported via {@code CREATE}, {@code ALTER}, etc
- *
- * @author Steve Ebersole
- */
-public interface Exportable {
- /**
- * Get a unique identifier to make sure we are not exporting the same database structure multiple times.
- *
- * @return The exporting identifier.
- */
- public String getExportIdentifier();
-
- /**
- * Gets the SQL strings for creating the database object.
- *
- * @param dialect The dialect for which to generate the SQL creation strings
- *
- * @return the SQL strings for creating the database object.
- */
- public String[] sqlCreateStrings(Dialect dialect);
-
- /**
- * Gets the SQL strings for dropping the database object.
- *
- * @param dialect The dialect for which to generate the SQL drop strings
- *
- * @return the SQL strings for dropping the database object.
- */
- public String[] sqlDropStrings(Dialect dialect);
-
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java
deleted file mode 100644
index bcb8c84510..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.MappingException;
-import org.hibernate.dialect.Dialect;
-
-import org.jboss.logging.Logger;
-
-/**
- * Models the notion of a foreign key.
- *
- * Note that this need not mean a physical foreign key; we just mean a relationship between 2 table
- * specifications.
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class ForeignKey extends AbstractConstraint implements Constraint, Exportable {
- private static final Logger LOG = Logger.getLogger( ForeignKey.class );
-
- private static final String ON_DELETE = " on delete ";
- private static final String ON_UPDATE = " on update ";
-
- private final TableSpecification targetTable;
- private List targetColumns;
-
- private ReferentialAction deleteRule = ReferentialAction.NO_ACTION;
- private ReferentialAction updateRule = ReferentialAction.NO_ACTION;
-
- protected ForeignKey(TableSpecification sourceTable, TableSpecification targetTable, String name) {
- super( sourceTable, name );
- this.targetTable = targetTable;
- }
-
- protected ForeignKey(TableSpecification sourceTable, TableSpecification targetTable) {
- this( sourceTable, targetTable, null );
- }
-
- public TableSpecification getSourceTable() {
- return getTable();
- }
-
- public TableSpecification getTargetTable() {
- return targetTable;
- }
-
- public Iterable getSourceColumns() {
- return getColumns();
- }
-
- public Iterable getTargetColumns() {
- return targetColumns == null
- ? getTargetTable().getPrimaryKey().getColumns()
- : targetColumns;
- }
-
- @Override
- public void addColumn(Column column) {
- addColumnMapping( column, null );
- }
-
- public void addColumnMapping(Column sourceColumn, Column targetColumn) {
- if ( targetColumn == null ) {
- if ( targetColumns != null ) {
- LOG.debugf(
- "Attempt to map column [%s] to no target column after explicit target column(s) named for FK [name=%s]",
- sourceColumn.toLoggableString(),
- getName()
- );
- }
- }
- else {
- checkTargetTable( targetColumn );
- if ( targetColumns == null ) {
- if (!internalColumnAccess().isEmpty()) {
- LOG.debugf(
- "Value mapping mismatch as part of FK [table=%s, name=%s] while adding source column [%s]",
- getTable().toLoggableString(),
- getName(),
- sourceColumn.toLoggableString()
- );
- }
- targetColumns = new ArrayList();
- }
- targetColumns.add( targetColumn );
- }
- internalAddColumn( sourceColumn );
- }
-
- private void checkTargetTable(Column targetColumn) {
- if ( targetColumn.getTable() != getTargetTable() ) {
- throw new AssertionFailure(
- String.format(
- "Unable to add column to constraint; tables [%s, %s] did not match",
- targetColumn.getTable().toLoggableString(),
- getTargetTable().toLoggableString()
- )
- );
- }
- }
-
- @Override
- public String getExportIdentifier() {
- return getSourceTable().getLoggableValueQualifier() + ".FK-" + getName();
- }
-
- public ReferentialAction getDeleteRule() {
- return deleteRule;
- }
-
- public void setDeleteRule(ReferentialAction deleteRule) {
- this.deleteRule = deleteRule;
- }
-
- public ReferentialAction getUpdateRule() {
- return updateRule;
- }
-
- public void setUpdateRule(ReferentialAction updateRule) {
- this.updateRule = updateRule;
- }
-
- @Override
- public String[] sqlDropStrings(Dialect dialect) {
- return new String[] {
- "alter table " +
- getTable().getQualifiedName( dialect ) +
- dialect.getDropForeignKeyString() +
- getName()
- };
- }
-
- public String sqlConstraintStringInAlterTable(Dialect dialect) {
- String[] columnNames = new String[ getColumnSpan() ];
- String[] targetColumnNames = new String[ getColumnSpan() ];
- int i=0;
- Iterator itTargetColumn = getTargetColumns().iterator();
- for ( Column column : getColumns() ) {
- if ( ! itTargetColumn.hasNext() ) {
- throw new MappingException( "More constraint columns that foreign key target columns." );
- }
- columnNames[i] = column.getColumnName().encloseInQuotesIfQuoted( dialect );
- targetColumnNames[i] = ( itTargetColumn.next() ).getColumnName().encloseInQuotesIfQuoted( dialect );
- i++;
- }
- if ( itTargetColumn.hasNext() ) {
- throw new MappingException( "More foreign key target columns than constraint columns." );
- }
- StringBuilder sb =
- new StringBuilder(
- dialect.getAddForeignKeyConstraintString(
- getName(),
- columnNames,
- targetTable.getQualifiedName( dialect ),
- targetColumnNames,
- this.targetColumns == null
- )
- );
- // TODO: If a dialect does not support cascade-delete, can it support other actions? (HHH-6428)
- // For now, assume not.
- if ( dialect.supportsCascadeDelete() ) {
- if ( deleteRule != ReferentialAction.NO_ACTION ) {
- sb.append( ON_DELETE ).append( deleteRule.getActionString() );
- }
- if ( updateRule != ReferentialAction.NO_ACTION ) {
- sb.append( ON_UPDATE ).append( updateRule.getActionString() );
- }
- }
- return sb.toString();
- }
-
- public static enum ReferentialAction {
- NO_ACTION( "no action" ),
- CASCADE( "cascade" ),
- SET_NULL( "set null" ),
- SET_DEFAULT( "set default" ),
- RESTRICT( "restrict" );
-
- private final String actionString;
-
- private ReferentialAction(String actionString) {
- this.actionString = actionString;
- }
-
- public String getActionString() {
- return actionString;
- }
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Identifier.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Identifier.java
deleted file mode 100644
index 3cd04f9479..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Identifier.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-
-import org.hibernate.dialect.Dialect;
-import org.hibernate.internal.util.StringHelper;
-
-/**
- * Models an identifier (name).
- *
- * @author Steve Ebersole
- */
-public class Identifier {
- private final String name;
- private final boolean isQuoted;
-
- /**
- * Means to generate an {@link Identifier} instance from its simple name
- *
- * @param name The name
- *
- * @return The identifier form of the name.
- */
- public static Identifier toIdentifier(String name) {
- if ( StringHelper.isEmpty( name ) ) {
- return null;
- }
- final String trimmedName = name.trim();
- if ( isQuoted( trimmedName ) ) {
- final String bareName = trimmedName.substring( 1, trimmedName.length() - 1 );
- return new Identifier( bareName, true );
- }
- else {
- return new Identifier( trimmedName, false );
- }
- }
-
- public static boolean isQuoted(String name) {
- return name.startsWith( "`" ) && name.endsWith( "`" );
- }
-
- /**
- * Constructs an identifier instance.
- *
- * @param name The identifier text.
- * @param quoted Is this a quoted identifier?
- */
- public Identifier(String name, boolean quoted) {
- if ( StringHelper.isEmpty( name ) ) {
- throw new IllegalIdentifierException( "Identifier text cannot be null" );
- }
- if ( isQuoted( name ) ) {
- throw new IllegalIdentifierException( "Identifier text should not contain quote markers (`)" );
- }
- this.name = name;
- this.isQuoted = quoted;
- }
-
- /**
- * Get the identifiers name (text)
- *
- * @return The name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Is this a quoted identifier>
- *
- * @return True if this is a quote identifier; false otherwise.
- */
- public boolean isQuoted() {
- return isQuoted;
- }
-
- /**
- * If this is a quoted identifier, then return the identifier name
- * enclosed in dialect-specific open- and end-quotes; otherwise,
- * simply return the identifier name.
- *
- * @param dialect The dialect whose dialect-specific quoting should be used.
- * @return if quoted, identifier name enclosed in dialect-specific open- and end-quotes; otherwise, the
- * identifier name.
- */
- public String encloseInQuotesIfQuoted(Dialect dialect) {
- return isQuoted ?
- new StringBuilder( name.length() + 2 )
- .append( dialect.openQuote() )
- .append( name )
- .append( dialect.closeQuote() )
- .toString() :
- name;
- }
-
- @Override
- public String toString() {
- return isQuoted
- ? '`' + getName() + '`'
- : getName();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( this == o ) {
- return true;
- }
- if ( o == null || getClass() != o.getClass() ) {
- return false;
- }
-
- Identifier that = (Identifier) o;
-
- return isQuoted == that.isQuoted
- && name.equals( that.name );
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/IllegalIdentifierException.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/IllegalIdentifierException.java
deleted file mode 100644
index 80ccba8ecc..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/IllegalIdentifierException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.HibernateException;
-
-/**
- * Indicates an attempted use of a name that was deemed illegal
- *
- * @author Steve Ebersole
- */
-public class IllegalIdentifierException extends HibernateException {
- public IllegalIdentifierException(String s) {
- super( s );
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/InLineView.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/InLineView.java
deleted file mode 100644
index 23651e8d82..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/InLineView.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.Collections;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * A data container defined by a SELECT statement. This translates into an inline view in the
- * SQL statements: select ... from (select ... from logical_table_table ...) ...
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class InLineView extends AbstractTableSpecification {
- private final Schema schema;
- private final String logicalName;
- private final String select;
-
- public InLineView(Schema schema, String logicalName, String select) {
- this.schema = schema;
- this.logicalName = logicalName;
- this.select = select;
- }
-
- public Schema getSchema() {
- return schema;
- }
-
- public String getSelect() {
- return select;
- }
-
- @Override
- public String getLoggableValueQualifier() {
- return logicalName;
- }
-
- @Override
- public Iterable getIndexes() {
- return Collections.emptyList();
- }
-
- @Override
- public Index getOrCreateIndex(String name) {
- throw new UnsupportedOperationException( "Cannot create index on inline view" );
- }
-
- @Override
- public Iterable getUniqueKeys() {
- return Collections.emptyList();
- }
-
- @Override
- public UniqueKey getOrCreateUniqueKey(String name) {
- throw new UnsupportedOperationException( "Cannot create unique-key on inline view" );
- }
-
- @Override
- public Iterable getCheckConstraints() {
- return Collections.emptyList();
- }
-
- @Override
- public void addCheckConstraint(String checkCondition) {
- throw new UnsupportedOperationException( "Cannot create check constraint on inline view" );
- }
-
- @Override
- public Iterable getComments() {
- return Collections.emptyList();
- }
-
- @Override
- public void addComment(String comment) {
- throw new UnsupportedOperationException( "Cannot comment on inline view" );
- }
-
- @Override
- public String getQualifiedName(Dialect dialect) {
- return new StringBuilder( select.length() + 4 )
- .append( "( " )
- .append( select )
- .append( " )" )
- .toString();
- }
-
- @Override
- public String toLoggableString() {
- return "{inline-view}";
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Index.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Index.java
deleted file mode 100644
index 2eb119c914..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Index.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-import org.hibernate.internal.util.StringHelper;
-
-/**
- * Models a SQL INDEX
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class Index extends AbstractConstraint implements Constraint {
- protected Index(Table table, String name) {
- super( table, name );
- }
-
-
- @Override
- public String getExportIdentifier() {
- StringBuilder sb = new StringBuilder( getTable().getLoggableValueQualifier());
- sb.append( ".IDX" );
- for ( Column column : getColumns() ) {
- sb.append( '_' ).append( column.getColumnName().getName() );
- }
- return sb.toString();
- }
-
- public String[] sqlCreateStrings(Dialect dialect) {
- return new String[] {
- buildSqlCreateIndexString(
- dialect, getName(), getTable(), getColumns(), false
- )
- };
- }
-
- public static String buildSqlCreateIndexString(
- Dialect dialect,
- String name,
- TableSpecification table,
- Iterable columns,
- boolean unique
- ) {
- StringBuilder buf = new StringBuilder( "create" )
- .append( unique ?
- " unique" :
- "" )
- .append( " index " )
- .append( dialect.qualifyIndexName() ?
- name :
- StringHelper.unqualify( name ) )
- .append( " on " )
- .append( table.getQualifiedName( dialect ) )
- .append( " (" );
- boolean first = true;
- for ( Column column : columns ) {
- if ( first ) {
- first = false;
- }
- else {
- buf.append( ", " );
- }
- buf.append( ( column.getColumnName().encloseInQuotesIfQuoted( dialect ) ) );
- }
- buf.append( ")" );
- return buf.toString();
- }
-
- public static String buildSqlDropIndexString(
- Dialect dialect,
- TableSpecification table,
- String name
- ) {
- return "drop index " +
- StringHelper.qualify(
- table.getQualifiedName( dialect ),
- name
- );
- }
-
- public String sqlConstraintStringInAlterTable(Dialect dialect) {
- StringBuilder buf = new StringBuilder( " index (" );
- boolean first = true;
- for ( Column column : getColumns() ) {
- if ( first ) {
- first = false;
- }
- else {
- buf.append( ", " );
- }
- buf.append( column.getColumnName().encloseInQuotesIfQuoted( dialect ) );
- }
- return buf.append( ')' ).toString();
- }
-
- public String[] sqlDropStrings(Dialect dialect) {
- return new String[] {
- new StringBuilder( "drop index " )
- .append(
- StringHelper.qualify(
- getTable().getQualifiedName( dialect ),
- getName()
- )
- ).toString()
- };
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Loggable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Loggable.java
deleted file mode 100644
index b49008d244..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Loggable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-/**
- * Marker for things which can be logged.
- *
- * @author Steve Ebersole
- */
-public interface Loggable {
- /**
- * Obtain the string representation of this value usable in log statements.
- *
- * @return The loggable representation
- */
- public String toLoggableString();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ObjectName.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ObjectName.java
deleted file mode 100644
index b27b73ac27..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ObjectName.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.HibernateException;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models the qualified name of a database object.
- *
- * Some things to keep in mind wrt catalog/schema:
- * 1) {@link java.sql.DatabaseMetaData#isCatalogAtStart}
- * 2) {@link java.sql.DatabaseMetaData#getCatalogSeparator()}
- *
- * @author Steve Ebersole
- */
-public class ObjectName {
- // todo - should depend on DatabaseMetaData. For now hard coded (HF)
- private static String SEPARATOR = ".";
-
- private final Identifier schema;
- private final Identifier catalog;
- private final Identifier name;
-
- private final String identifier;
- private final int hashCode;
-
- /**
- * Tries to create an {@code ObjectName} from a name.
- *
- * @param objectName simple or qualified name of the database object.
- */
- public ObjectName(String objectName) {
- this(
- extractSchema( objectName ),
- extractCatalog( objectName ),
- extractName( objectName )
- );
- }
-
- public ObjectName(Identifier name) {
- this( null, null, name );
- }
-
- public ObjectName(Schema schema, String name) {
- this( schema.getName().getSchema(), schema.getName().getCatalog(), Identifier.toIdentifier( name ) );
- }
-
- public ObjectName(Schema schema, Identifier name) {
- this( schema.getName().getSchema(), schema.getName().getCatalog(), name );
- }
-
- public ObjectName(String schemaName, String catalogName, String name) {
- this(
- Identifier.toIdentifier( schemaName ),
- Identifier.toIdentifier( catalogName ),
- Identifier.toIdentifier( name )
- );
- }
-
- /**
- * Creates a qualified name reference.
- *
- * @param schema The in which the object is defined (optional)
- * @param catalog The catalog in which the object is defined (optional)
- * @param name The name (required)
- */
- public ObjectName(Identifier schema, Identifier catalog, Identifier name) {
- if ( name == null ) {
- // Identifier cannot be constructed with an 'empty' name
- throw new IllegalIdentifierException( "Object name must be specified" );
- }
- this.name = name;
- this.schema = schema;
- this.catalog = catalog;
-
- this.identifier = qualify(
- schema == null ? null : schema.toString(),
- catalog == null ? null : catalog.toString(),
- name.toString()
- );
-
- int tmpHashCode = schema != null ? schema.hashCode() : 0;
- tmpHashCode = 31 * tmpHashCode + ( catalog != null ? catalog.hashCode() : 0 );
- tmpHashCode = 31 * tmpHashCode + name.hashCode();
- this.hashCode = tmpHashCode;
- }
-
- public Identifier getSchema() {
- return schema;
- }
-
- public Identifier getCatalog() {
- return catalog;
- }
-
- public Identifier getName() {
- return name;
- }
-
- public String toText() {
- return identifier;
- }
-
- public String toText(Dialect dialect) {
- if ( dialect == null ) {
- throw new IllegalArgumentException( "dialect must be non-null." );
- }
- return qualify(
- encloseInQuotesIfQuoted( schema, dialect ),
- encloseInQuotesIfQuoted( catalog, dialect ),
- encloseInQuotesIfQuoted( name, dialect )
- );
- }
-
- private static String encloseInQuotesIfQuoted(Identifier identifier, Dialect dialect) {
- return identifier == null ?
- null :
- identifier.encloseInQuotesIfQuoted( dialect );
- }
-
- private static String qualify(String schema, String catalog, String name) {
- StringBuilder buff = new StringBuilder( name );
- if ( catalog != null ) {
- buff.insert( 0, catalog + '.' );
- }
- if ( schema != null ) {
- buff.insert( 0, schema + '.' );
- }
- return buff.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( this == o ) {
- return true;
- }
- if ( o == null || getClass() != o.getClass() ) {
- return false;
- }
-
- ObjectName that = (ObjectName) o;
-
- return name.equals( that.name )
- && areEqual( catalog, that.catalog )
- && areEqual( schema, that.schema );
- }
-
- @Override
- public int hashCode() {
- return hashCode;
- }
-
-
- @Override
- public String toString() {
- return "ObjectName{" +
- "name='" + name + '\'' +
- ", schema='" + schema + '\'' +
- ", catalog='" + catalog + '\'' +
- '}';
- }
-
- private boolean areEqual(Identifier one, Identifier other) {
- return one == null
- ? other == null
- : one.equals( other );
- }
-
- private static String extractSchema(String qualifiedName) {
- if ( qualifiedName == null ) {
- return null;
- }
- String[] tokens = qualifiedName.split( SEPARATOR );
- if ( tokens.length == 0 || tokens.length == 1 ) {
- return null;
- }
- else if ( tokens.length == 2 ) {
- // todo - this case needs to be refined w/ help of DatabaseMetaData (HF)
- return null;
- }
- else if ( tokens.length == 3 ) {
- return tokens[0];
- }
- else {
- throw new HibernateException( "Unable to parse object name: " + qualifiedName );
- }
- }
-
- private static String extractCatalog(String qualifiedName) {
- if ( qualifiedName == null ) {
- return null;
- }
- String[] tokens = qualifiedName.split( SEPARATOR );
- if ( tokens.length == 0 || tokens.length == 1 ) {
- return null;
- }
- else if ( tokens.length == 2 ) {
- // todo - this case needs to be refined w/ help of DatabaseMetaData (HF)
- return null;
- }
- else if ( tokens.length == 3 ) {
- return tokens[1];
- }
- else {
- throw new HibernateException( "Unable to parse object name: " + qualifiedName );
- }
- }
-
- private static String extractName(String qualifiedName) {
- if ( qualifiedName == null ) {
- return null;
- }
- String[] tokens = qualifiedName.split( SEPARATOR );
- if ( tokens.length == 0 ) {
- return qualifiedName;
- }
- else {
- return tokens[tokens.length - 1];
- }
- }
-}
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PrimaryKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PrimaryKey.java
deleted file mode 100644
index 3962571ef4..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/PrimaryKey.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models a table's primary key.
- *
- * NOTE : This need not be a physical primary key; we just mean a column or columns which uniquely identify rows in
- * the table. Of course it is recommended to define proper integrity constraints, including primary keys.
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class PrimaryKey extends AbstractConstraint implements Constraint, Exportable {
- // IMPL NOTE : I override the name behavior here because:
- // (1) primary keys are not required to be named.
- // (2) because a primary key is required for each table, it is easier to allow setting the constraint name
- // later in terms of building the metamodel
- //
- // todo : default name? {TABLE_NAME}_PK maybe?
- private String name;
-
- protected PrimaryKey(TableSpecification table) {
- super( table, null );
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String getExportIdentifier() {
- return getTable().getLoggableValueQualifier() + ".PK";
- }
-
- public String sqlConstraintStringInCreateTable(Dialect dialect) {
- StringBuilder buf = new StringBuilder("primary key (");
- boolean first = true;
- for ( Column column : getColumns() ) {
- if ( first ) {
- first = false;
- }
- else {
- buf.append(", ");
- }
- buf.append( column.getColumnName().encloseInQuotesIfQuoted( dialect ) );
- }
- return buf.append(')').toString();
- }
-
- public String sqlConstraintStringInAlterTable(Dialect dialect) {
- StringBuilder buf = new StringBuilder(
- dialect.getAddPrimaryKeyConstraintString( getName() )
- ).append('(');
- boolean first = true;
- for ( Column column : getColumns() ) {
- if ( first ) {
- first = false;
- }
- else {
- buf.append(", ");
- }
- buf.append( column.getColumnName().encloseInQuotesIfQuoted( dialect ) );
- }
- return buf.append(')').toString();
- }
-
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Schema.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Schema.java
deleted file mode 100644
index 25a36aac8b..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Schema.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Represents a named schema/catalog pair and manages objects defined within.
- *
- * @author Steve Ebersole
- */
-public class Schema {
- private final Name name;
- private Map inLineViews = new HashMap();
- private Map tables = new HashMap();
-
- public Schema(Name name) {
- this.name = name;
- }
-
- public Schema(Identifier schema, Identifier catalog) {
- this( new Name( schema, catalog ) );
- }
-
- public Name getName() {
- return name;
- }
-
- public Table locateTable(Identifier name) {
- return tables.get( name );
- }
-
- public Table createTable(Identifier name) {
- Table table = new Table( this, name );
- tables.put( name, table );
- return table;
- }
-
- public Table locateOrCreateTable(Identifier name) {
- final Table existing = locateTable( name );
- if ( existing == null ) {
- return createTable( name );
- }
- return existing;
- }
-
- public Iterable getTables() {
- return tables.values();
- }
-
- public InLineView getInLineView(String logicalName) {
- return inLineViews.get( logicalName );
- }
-
- public InLineView createInLineView(String logicalName, String subSelect) {
- InLineView inLineView = new InLineView( this, logicalName, subSelect );
- inLineViews.put( logicalName, inLineView );
- return inLineView;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append( "Schema" );
- sb.append( "{name=" ).append( name );
- sb.append( '}' );
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( this == o ) {
- return true;
- }
- if ( o == null || getClass() != o.getClass() ) {
- return false;
- }
-
- Schema schema = (Schema) o;
-
- if ( name != null ? !name.equals( schema.name ) : schema.name != null ) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return name != null ? name.hashCode() : 0;
- }
-
- public static class Name {
- private final Identifier schema;
- private final Identifier catalog;
-
- public Name(Identifier schema, Identifier catalog) {
- this.schema = schema;
- this.catalog = catalog;
- }
-
- public Name(String schema, String catalog) {
- this( Identifier.toIdentifier( schema ), Identifier.toIdentifier( catalog ) );
- }
-
- public Identifier getSchema() {
- return schema;
- }
-
- public Identifier getCatalog() {
- return catalog;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append( "Name" );
- sb.append( "{schema=" ).append( schema );
- sb.append( ", catalog=" ).append( catalog );
- sb.append( '}' );
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( this == o ) {
- return true;
- }
- if ( o == null || getClass() != o.getClass() ) {
- return false;
- }
-
- Name name = (Name) o;
-
- if ( catalog != null ? !catalog.equals( name.catalog ) : name.catalog != null ) {
- return false;
- }
- if ( schema != null ? !schema.equals( name.schema ) : name.schema != null ) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = schema != null ? schema.hashCode() : 0;
- result = 31 * result + ( catalog != null ? catalog.hashCode() : 0 );
- return result;
- }
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Sequence.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Sequence.java
deleted file mode 100644
index fcaf7b886d..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Sequence.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.MappingException;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models a database {@code SEQUENCE}.
- *
- * @author Steve Ebersole
- */
-public class Sequence implements Exportable {
- private final Schema schema;
- private final String name;
- private final String qualifiedName;
- private int initialValue = 1;
- private int incrementSize = 1;
-
- public Sequence(Schema schema, String name) {
- this.schema = schema;
- this.name = name;
- this.qualifiedName = new ObjectName( schema, name ).toText();
- }
-
- public Sequence(Schema schema, String name, int initialValue, int incrementSize) {
- this( schema, name );
- this.initialValue = initialValue;
- this.incrementSize = incrementSize;
- }
-
- public Schema getSchema() {
- return schema;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String getExportIdentifier() {
- return qualifiedName;
- }
-
- public int getInitialValue() {
- return initialValue;
- }
-
- public int getIncrementSize() {
- return incrementSize;
- }
-
- @Override
- public String[] sqlCreateStrings(Dialect dialect) throws MappingException {
- return dialect.getCreateSequenceStrings( name, initialValue,incrementSize );
- }
-
- @Override
- public String[] sqlDropStrings(Dialect dialect) throws MappingException {
- return dialect.getDropSequenceStrings( name );
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/SimpleValue.java
deleted file mode 100644
index 8cc4854bc9..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/SimpleValue.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models a simple, non-compound value.
- *
- * @author Steve Ebersole
- */
-public interface SimpleValue extends Value {
- /**
- * Retrieve the datatype of this value.
- *
- * @return The value's datatype
- */
- public Datatype getDatatype();
-
- /**
- * Set the datatype of this value.
- *
- * @param datatype The value's datatype
- */
- public void setDatatype(Datatype datatype);
-
- /**
- * For any column name, generate an alias that is unique
- * to that column name, unique across tables, and within
- * alias size constraints determined by
- * {@link org.hibernate.dialect.Dialect#getMaxAliasLength()}.
- *
- * @param dialect the dialect.
- * @return the alias.
- */
- public String getAlias(Dialect dialect);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java
deleted file mode 100644
index f88c2fdf08..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models the concept of a relational TABLE (or VIEW).
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class Table extends AbstractTableSpecification implements Exportable {
- private final Schema database;
- private final Identifier tableName;
- private final ObjectName objectName;
- private final String qualifiedName;
-
- private final LinkedHashMap indexes = new LinkedHashMap();
- private final LinkedHashMap uniqueKeys = new LinkedHashMap();
- private final List checkConstraints = new ArrayList();
- private final List comments = new ArrayList();
-
- public Table(Schema database, String tableName) {
- this( database, Identifier.toIdentifier( tableName ) );
- }
-
- public Table(Schema database, Identifier tableName) {
- this.database = database;
- this.tableName = tableName;
- objectName = new ObjectName( database.getName().getSchema(), database.getName().getCatalog(), tableName );
- this.qualifiedName = objectName.toText();
- }
-
- @Override
- public Schema getSchema() {
- return database;
- }
-
- public Identifier getTableName() {
- return tableName;
- }
-
- @Override
- public String getLoggableValueQualifier() {
- return qualifiedName;
- }
-
- @Override
- public String getExportIdentifier() {
- return qualifiedName;
- }
-
- @Override
- public String toLoggableString() {
- return qualifiedName;
- }
-
- @Override
- public Iterable getIndexes() {
- return indexes.values();
- }
-
- public Index getOrCreateIndex(String name) {
- if( indexes.containsKey( name ) ){
- return indexes.get( name );
- }
- Index index = new Index( this, name );
- indexes.put(name, index );
- return index;
- }
-
- @Override
- public Iterable getUniqueKeys() {
- return uniqueKeys.values();
- }
-
- public UniqueKey getOrCreateUniqueKey(String name) {
- if( uniqueKeys.containsKey( name ) ){
- return uniqueKeys.get( name );
- }
- UniqueKey uniqueKey = new UniqueKey( this, name );
- uniqueKeys.put(name, uniqueKey );
- return uniqueKey;
- }
-
- @Override
- public Iterable getCheckConstraints() {
- return checkConstraints;
- }
-
- @Override
- public void addCheckConstraint(String checkCondition) {
- //todo ? StringHelper.isEmpty( checkCondition );
- //todo default name?
- checkConstraints.add( new CheckConstraint( this, "", checkCondition ) );
- }
-
- @Override
- public Iterable getComments() {
- return comments;
- }
-
- @Override
- public void addComment(String comment) {
- comments.add( comment );
- }
-
- @Override
- public String getQualifiedName(Dialect dialect) {
- return objectName.toText( dialect );
- }
-
- public String[] sqlCreateStrings(Dialect dialect) {
- boolean hasPrimaryKey = getPrimaryKey().getColumns().iterator().hasNext();
- StringBuilder buf =
- new StringBuilder(
- hasPrimaryKey ? dialect.getCreateTableString() : dialect.getCreateMultisetTableString() )
- .append( ' ' )
- .append( objectName.toText( dialect ) )
- .append( " (" );
-
-
- // TODO: fix this when identity columns are supported by new metadata (HHH-6436)
- // for now, assume false
- //boolean identityColumn = idValue != null && idValue.isIdentityColumn( metadata.getIdentifierGeneratorFactory(), dialect );
- boolean isPrimaryKeyIdentity = false;
-
- // Try to find out the name of the primary key to create it as identity if the IdentityGenerator is used
- String pkColName = null;
- if ( hasPrimaryKey && isPrimaryKeyIdentity ) {
- Column pkColumn = getPrimaryKey().getColumns().iterator().next();
- pkColName = pkColumn.getColumnName().encloseInQuotesIfQuoted( dialect );
- }
-
- boolean isFirst = true;
- for ( SimpleValue simpleValue : values() ) {
- if ( ! Column.class.isInstance( simpleValue ) ) {
- continue;
- }
- if ( isFirst ) {
- isFirst = false;
- }
- else {
- buf.append( ", " );
- }
- Column col = ( Column ) simpleValue;
- String colName = col.getColumnName().encloseInQuotesIfQuoted( dialect );
-
- buf.append( colName ).append( ' ' );
-
- if ( isPrimaryKeyIdentity && colName.equals( pkColName ) ) {
- // to support dialects that have their own identity data type
- if ( dialect.hasDataTypeInIdentityColumn() ) {
- buf.append( getTypeString( col, dialect ) );
- }
- buf.append( ' ' )
- .append( dialect.getIdentityColumnString( col.getDatatype().getTypeCode() ) );
- }
- else {
- buf.append( getTypeString( col, dialect ) );
-
- String defaultValue = col.getDefaultValue();
- if ( defaultValue != null ) {
- buf.append( " default " ).append( defaultValue );
- }
-
- if ( col.isNullable() ) {
- buf.append( dialect.getNullColumnString() );
- }
- else {
- buf.append( " not null" );
- }
-
- }
-
- if ( col.isUnique() ) {
- UniqueKey uk = getOrCreateUniqueKey( col.getColumnName()
- .encloseInQuotesIfQuoted( dialect ) + '_' );
- uk.addColumn( col );
- buf.append( dialect.getUniqueDelegate()
- .getColumnDefinitionUniquenessFragment( col ) );
- }
-
- if ( col.getCheckCondition() != null && dialect.supportsColumnCheck() ) {
- buf.append( " check (" )
- .append( col.getCheckCondition() )
- .append( ")" );
- }
-
- String columnComment = col.getComment();
- if ( columnComment != null ) {
- buf.append( dialect.getColumnComment( columnComment ) );
- }
- }
- if ( hasPrimaryKey ) {
- buf.append( ", " )
- .append( getPrimaryKey().sqlConstraintStringInCreateTable( dialect ) );
- }
-
- buf.append( dialect.getUniqueDelegate().getTableCreationUniqueConstraintsFragment( this ) );
-
- if ( dialect.supportsTableCheck() ) {
- for ( CheckConstraint checkConstraint : checkConstraints ) {
- buf.append( ", check (" )
- .append( checkConstraint )
- .append( ')' );
- }
- }
-
- buf.append( ')' );
- buf.append( dialect.getTableTypeString() );
-
- String[] sqlStrings = new String[ comments.size() + 1 ];
- sqlStrings[ 0 ] = buf.toString();
-
- for ( int i = 0 ; i < comments.size(); i++ ) {
- sqlStrings[ i + 1 ] = dialect.getTableComment( comments.get( i ) );
- }
-
- return sqlStrings;
- }
-
- private static String getTypeString(Column col, Dialect dialect) {
- String typeString = null;
- if ( col.getSqlType() != null ) {
- typeString = col.getSqlType();
- }
- else {
- Size size = col.getSize() == null ?
- new Size( ) :
- col.getSize();
-
- typeString = dialect.getTypeName(
- col.getDatatype().getTypeCode(),
- size.getLength(),
- size.getPrecision(),
- size.getScale()
- );
- }
- return typeString;
- }
-
- @Override
- public String[] sqlDropStrings(Dialect dialect) {
- return new String[] { dialect.getDropTableString( getQualifiedName( dialect ) ) };
- }
-
- @Override
- public String toString() {
- return "Table{name=" + qualifiedName + '}';
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/TableSpecification.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/TableSpecification.java
deleted file mode 100644
index 69fbd02d55..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/TableSpecification.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-
-/**
- * Models what ANSI SQL terms a table specification which is a table or a view or an inline view.
- *
- * @author Steve Ebersole
- */
-public interface TableSpecification extends ValueContainer, Loggable {
- /**
- * Obtain a reference to the schema to which this table specification belongs.
- *
- * @return The schema to which this table specification belongs.
- */
- public Schema getSchema();
-
- /**
- * Get the table number.
- *
- * @return the table number.
- */
- public int getTableNumber();
-
- /**
- * Get the primary key definition for this table spec.
- *
- * @return The PK definition.
- */
- public PrimaryKey getPrimaryKey();
-
- /**
- * Factory method for creating a {@link Column} associated with this container.
- *
- * @param name The column name
- *
- * @return The generated column
- */
- public Column locateOrCreateColumn(String name);
-
- /**
- * Factory method for creating a {@link Column} associated with this container.
- *
- * @param name The column name
- *
- * @return The generated column
- */
- public Tuple createTuple(String name);
-
- /**
- * Factory method for creating a {@link DerivedValue} associated with this container.
- *
- * @param fragment The value expression
- *
- * @return The generated value.
- */
- public DerivedValue locateOrCreateDerivedValue(String fragment);
-
- public Iterable getForeignKeys();
-
- public ForeignKey createForeignKey(TableSpecification targetTable, String name);
-
- public Iterable getIndexes();
-
- public Index getOrCreateIndex(String name);
-
- public Iterable getUniqueKeys();
-
- public UniqueKey getOrCreateUniqueKey(String name);
-
- public Iterable getCheckConstraints();
-
- public void addCheckConstraint(String checkCondition);
-
- public Iterable getComments();
-
- public void addComment(String comment);
-
- public String getQualifiedName(Dialect dialect);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Tuple.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Tuple.java
deleted file mode 100644
index c566dead53..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Tuple.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import java.util.LinkedHashSet;
-
-/**
- * Models a compound value (a tuple or row-value-constructor is SQL terms). It is both a {@link Value} and
- * a {@link ValueContainer} simultaneously.
- *
- * IMPL NOTE : in terms of the tables themselves, SQL has no notion of a tuple/compound-value. We simply model
- * it this way because:
- *
- * - it is a cleaner mapping to the logical model
- * - it allows more meaningful traversals from simple values back up to table through any intermediate tuples
- * because it gives us a better understanding of the model.
- * - it better conveys intent
- * - it adds richness to the model
- *
- *
- * @author Steve Ebersole
- */
-public class Tuple implements Value, ValueContainer, Loggable {
- private final TableSpecification table;
- private final String name;
- private final LinkedHashSet values = new LinkedHashSet();
-
- public Tuple(TableSpecification table, String name) {
- this.table = table;
- this.name = name;
- }
-
- @Override
- public TableSpecification getTable() {
- return table;
- }
-
- public int valuesSpan() {
- return values.size();
- }
-
- @Override
- public Iterable values() {
- return values;
- }
-
- public void addValue(SimpleValue value) {
- if ( ! value.getTable().equals( getTable() ) ) {
- throw new IllegalArgumentException( "Tuple can only group values from same table" );
- }
- values.add( value );
- }
-
- @Override
- public String getLoggableValueQualifier() {
- return getTable().getLoggableValueQualifier() + '.' + name + "{tuple}";
- }
-
- @Override
- public String toLoggableString() {
- return getLoggableValueQualifier();
- }
-
- @Override
- public void validateJdbcTypes(JdbcCodes typeCodes) {
- for ( Value value : values() ) {
- value.validateJdbcTypes( typeCodes );
- }
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java
deleted file mode 100644
index f130f2ebe9..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-import org.hibernate.dialect.Dialect;
-import org.hibernate.internal.util.StringHelper;
-
-/**
- * Models a SQL INDEX defined as UNIQUE
- *
- * @author Gavin King
- * @author Steve Ebersole
- */
-public class UniqueKey extends AbstractConstraint implements Constraint {
- protected UniqueKey(Table table, String name) {
- super( table, name );
- }
-
- @Override
- public String getExportIdentifier() {
- StringBuilder sb = new StringBuilder( getTable().getLoggableValueQualifier() );
- sb.append( ".UK" );
- for ( Column column : getColumns() ) {
- sb.append( '_' ).append( column.getColumnName().getName() );
- }
- return sb.toString();
- }
-
- @Override
- public String[] sqlCreateStrings(Dialect dialect) {
- String s = dialect.getUniqueDelegate().getAlterTableToAddUniqueKeyCommand( this );
- return StringHelper.toArrayElement( s );
- }
-
- @Override
- public String[] sqlDropStrings(Dialect dialect) {
- String s = dialect.getUniqueDelegate().getAlterTableToDropUniqueKeyCommand( this );
- return StringHelper.toArrayElement( s );
- }
-
- @Override
- protected String sqlConstraintStringInAlterTable(Dialect dialect) {
- // not used
- return "";
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java
deleted file mode 100644
index 0549bb7cc1..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-/**
- * Models a value within a {@link ValueContainer}. This will generally be either a {@link Column column} or a
- * {@link DerivedValue derived value}, but we also allow the notion of {@link Tuple} at this level
- *
- * @author Steve Ebersole
- */
-public interface Value {
- /**
- * Retrieve the table that owns this value.
- *
- * @return The owning table.
- */
- public TableSpecification getTable();
-
- /**
- * Obtain the string representation of this value usable in log statements.
- *
- * @return The loggable representation
- */
- public String toLoggableString();
-
- /**
- * Used to track JDBC type usage throughout a series of potential recursive calls to component
- * values since we do not know ahead of time which values correspond to which indexes of the
- * jdbc type array.
- */
- public static class JdbcCodes {
- private final int[] typeCodes;
- private int index = 0;
-
- public JdbcCodes(int[] typeCodes) {
- this.typeCodes = typeCodes;
- }
-
- public int nextJdbcCde() {
- return typeCodes[index++];
- }
-
- public int getIndex() {
- return index;
- }
- }
-
- /**
- * Validate the value against the incoming JDBC type code array, both in terms of number of types
- * and compatibility of types.
- *
- * @param typeCodes The type codes.
- *
- * @throws org.hibernate.metamodel.ValidationException if validaton fails.
- */
- public void validateJdbcTypes(JdbcCodes typeCodes);
-
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ValueContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ValueContainer.java
deleted file mode 100644
index 5523716f4e..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ValueContainer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational;
-
-/**
- * Contract for data containers (what the ANSI SQL spec calls "table specifications") to which we can map
- * entity state. The two flavors here are {@link Table physical table} and {@link InLineView inline view}, but a
- * {@link Tuple} is a conceptual value container as well.
- *
- * @author Steve Ebersole
- */
-public interface ValueContainer {
- /**
- * Obtain an iterator over this containers current set of value definitions.
- *
- * @return Iterator over value definitions.
- */
- public Iterable values();
-
- /**
- * Get a qualifier which can be used to qualify {@link Value values} belonging to this container in
- * their logging.
- *
- * @return The qualifier
- */
- public String getLoggableValueQualifier();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/package.html b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/package.html
deleted file mode 100644
index 4dd12a5ff3..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/package.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- This package defines the metamodel of a relational database schema.
-
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ColumnRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ColumnRelationalState.java
deleted file mode 100644
index ae141bcbd8..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ColumnRelationalState.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational.state;
-
-import java.util.Set;
-
-import org.hibernate.cfg.NamingStrategy;
-import org.hibernate.metamodel.relational.Size;
-
-/**
- * @author Gail Badner
- */
-public interface ColumnRelationalState extends SimpleValueRelationalState {
- NamingStrategy getNamingStrategy();
-
- boolean isGloballyQuotedIdentifiers();
-
- String getExplicitColumnName();
-
- boolean isUnique();
-
- Size getSize();
-
- boolean isNullable();
-
- String getCheckCondition();
-
- String getDefault();
-
- String getSqlType();
-
- String getCustomWriteFragment();
-
- String getCustomReadFragment();
-
- String getComment();
-
- Set getUniqueKeys();
-
- Set getIndexes();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/DerivedValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/DerivedValueRelationalState.java
deleted file mode 100644
index 19021f58c3..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/DerivedValueRelationalState.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational.state;
-
-/**
- * @author Gail Badner
- */
-public interface DerivedValueRelationalState extends SimpleValueRelationalState {
- String getFormula();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ManyToOneRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ManyToOneRelationalState.java
deleted file mode 100644
index c441b3e621..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ManyToOneRelationalState.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational.state;
-
-/**
- * @author Gail Badner
- */
-public interface ManyToOneRelationalState extends ValueRelationalState {
- boolean isLogicalOneToOne();
-
- String getForeignKeyName();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/SimpleValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/SimpleValueRelationalState.java
deleted file mode 100644
index a0ea13a92c..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/SimpleValueRelationalState.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational.state;
-
-/**
- * @author Gail Badner
- */
-public interface SimpleValueRelationalState extends ValueRelationalState {
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/TupleRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/TupleRelationalState.java
deleted file mode 100644
index 6bec20e59e..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/TupleRelationalState.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational.state;
-
-import java.util.List;
-
-/**
- * @author Gail Badner
- */
-public interface TupleRelationalState extends ValueRelationalState {
- List getRelationalStates();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ValueRelationalState.java
deleted file mode 100644
index d8fb1ff8bd..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/state/ValueRelationalState.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.relational.state;
-
-/**
- * @author Gail Badner
- */
-public interface ValueRelationalState {
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/BindingContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/BindingContext.java
deleted file mode 100644
index 6fbcfc0c0c..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/BindingContext.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source;
-
-import org.hibernate.cfg.NamingStrategy;
-import org.hibernate.internal.util.ValueHolder;
-import org.hibernate.metamodel.domain.Type;
-import org.hibernate.service.ServiceRegistry;
-
-/**
- * @author Steve Ebersole
- */
-public interface BindingContext {
- public ServiceRegistry getServiceRegistry();
-
- public NamingStrategy getNamingStrategy();
-
- public MappingDefaults getMappingDefaults();
-
- public MetadataImplementor getMetadataImplementor();
-
- public Class locateClassByName(String name);
-
- public Type makeJavaType(String className);
-
- public boolean isGloballyQuotedIdentifiers();
-
- public ValueHolder> makeClassReference(String className);
-
- public String qualifyClassName(String name);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/LocalBindingContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/LocalBindingContext.java
deleted file mode 100644
index 818beba54c..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/LocalBindingContext.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source;
-
-import org.hibernate.internal.jaxb.Origin;
-
-/**
- * @author Steve Ebersole
- */
-public interface LocalBindingContext extends BindingContext {
- public Origin getOrigin();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingDefaults.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingDefaults.java
deleted file mode 100644
index bb66dc64f0..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingDefaults.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source;
-
-import org.hibernate.cache.spi.access.AccessType;
-
-/**
- * Defines a (contextual) set of values to use as defaults in the absence of related mapping information. The
- * context here is conceptually a stack. The "global" level is configuration settings.
- *
- * @author Steve Ebersole
- * @author Gail Badner
- */
-public interface MappingDefaults {
- /**
- * Identifies the default package name to use if none specified in the mapping. Really only pertinent for
- * {@code hbm.xml} mappings.
- *
- * @return The default package name.
- */
- public String getPackageName();
-
- /**
- * Identifies the default database schema name to use if none specified in the mapping.
- *
- * @return The default schema name
- */
- public String getSchemaName();
-
- /**
- * Identifies the default database catalog name to use if none specified in the mapping.
- *
- * @return The default catalog name
- */
- public String getCatalogName();
-
- /**
- * Identifies the default column name to use for the identifier column if none specified in the mapping.
- *
- * @return The default identifier column name
- */
- public String getIdColumnName();
-
- /**
- * Identifies the default column name to use for the discriminator column if none specified in the mapping.
- *
- * @return The default discriminator column name
- */
- public String getDiscriminatorColumnName();
-
- /**
- * Identifies the default cascade style to apply to associations if none specified in the mapping.
- *
- * @return The default cascade style
- */
- public String getCascadeStyle();
-
- /**
- * Identifies the default {@link org.hibernate.property.PropertyAccessor} name to use if none specified in the
- * mapping.
- *
- * @return The default property accessor name
- * @see org.hibernate.property.PropertyAccessorFactory
- */
- public String getPropertyAccessorName();
-
- /**
- * Identifies whether associations are lazy by default if not specified in the mapping.
- *
- * @return The default association laziness
- */
- public boolean areAssociationsLazy();
-
- /**
- * The default cache access type to use
- *
- * @return The default cache access type.
- */
- public AccessType getCacheAccessType();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingException.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingException.java
deleted file mode 100644
index 47bd55cf87..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.metamodel.source;
-
-import org.hibernate.HibernateException;
-import org.hibernate.internal.jaxb.Origin;
-
-/**
- * Indicates a problem parsing a mapping document.
- *
- * @author Steve Ebersole
- */
-public class MappingException extends HibernateException {
- private final Origin origin;
-
- public MappingException(String message, Origin origin) {
- super( message );
- this.origin = origin;
- }
-
- public MappingException(String message, Throwable root, Origin origin) {
- super( message, root );
- this.origin = origin;
- }
-
- public Origin getOrigin() {
- return origin;
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingNotFoundException.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingNotFoundException.java
deleted file mode 100644
index a0702f165e..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MappingNotFoundException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.metamodel.source;
-
-import org.hibernate.internal.jaxb.Origin;
-
-/**
- * @author Steve Ebersole
- */
-public class MappingNotFoundException extends MappingException {
- public MappingNotFoundException(String message, Origin origin) {
- super( message, origin );
- }
-
- public MappingNotFoundException(Origin origin) {
- super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), origin );
- }
-
- public MappingNotFoundException(String message, Throwable root, Origin origin) {
- super( message, root, origin );
- }
-
- public MappingNotFoundException(Throwable root, Origin origin) {
- super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), root, origin );
- }
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetaAttributeContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetaAttributeContext.java
deleted file mode 100644
index 461c031863..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetaAttributeContext.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.hibernate.metamodel.binding.MetaAttribute;
-
-/**
- * @author Steve Ebersole
- */
-public class MetaAttributeContext {
- private final MetaAttributeContext parentContext;
- private final ConcurrentHashMap metaAttributeMap = new ConcurrentHashMap();
-
- public MetaAttributeContext() {
- this( null );
- }
-
- public MetaAttributeContext(MetaAttributeContext parentContext) {
- this.parentContext = parentContext;
- }
-
-
- // read contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- public Iterable getKeys() {
- HashSet keys = new HashSet();
- addKeys( keys );
- return keys;
- }
-
- private void addKeys(Set keys) {
- keys.addAll( metaAttributeMap.keySet() );
- if ( parentContext != null ) {
- // recursive call
- parentContext.addKeys( keys );
- }
- }
-
- public Iterable getLocalKeys() {
- return metaAttributeMap.keySet();
- }
-
- public MetaAttribute getMetaAttribute(String key) {
- MetaAttribute value = getLocalMetaAttribute( key );
- if ( value == null ) {
- // recursive call
- value = parentContext.getMetaAttribute( key );
- }
- return value;
- }
-
- public MetaAttribute getLocalMetaAttribute(String key) {
- return metaAttributeMap.get( key );
- }
-
-
- // write contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- public void add(MetaAttribute metaAttribute) {
- metaAttributeMap.put( metaAttribute.getName(), metaAttribute );
- }
-
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataImplementor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataImplementor.java
deleted file mode 100644
index 985272bc47..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataImplementor.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source;
-
-import org.hibernate.engine.ResultSetMappingDefinition;
-import org.hibernate.engine.spi.FilterDefinition;
-import org.hibernate.engine.spi.Mapping;
-import org.hibernate.engine.spi.NamedQueryDefinition;
-import org.hibernate.engine.spi.NamedSQLQueryDefinition;
-import org.hibernate.metamodel.Metadata;
-import org.hibernate.metamodel.binding.EntityBinding;
-import org.hibernate.metamodel.binding.FetchProfile;
-import org.hibernate.metamodel.binding.IdGenerator;
-import org.hibernate.metamodel.binding.PluralAttributeBinding;
-import org.hibernate.metamodel.binding.TypeDef;
-import org.hibernate.metamodel.relational.Database;
-import org.hibernate.service.ServiceRegistry;
-import org.hibernate.type.TypeResolver;
-
-/**
- * @author Steve Ebersole
- */
-public interface MetadataImplementor extends Metadata, BindingContext, Mapping {
- public ServiceRegistry getServiceRegistry();
-
- public Database getDatabase();
-
- public TypeResolver getTypeResolver();
-
- public void addImport(String entityName, String entityName1);
-
- public void addEntity(EntityBinding entityBinding);
-
- public void addCollection(PluralAttributeBinding collectionBinding);
-
- public void addFetchProfile(FetchProfile profile);
-
- public void addTypeDefinition(TypeDef typeDef);
-
- public void addFilterDefinition(FilterDefinition filterDefinition);
-
- public void addIdGenerator(IdGenerator generator);
-
- public void registerIdentifierGenerator(String name, String clazz);
-
- public void addNamedNativeQuery(NamedSQLQueryDefinition def);
-
- public void addNamedQuery(NamedQueryDefinition def);
-
- public void addResultSetMapping(ResultSetMappingDefinition resultSetMappingDefinition);
-
- // todo : this needs to move to AnnotationBindingContext
- public void setGloballyQuotedIdentifiers(boolean b);
-
- public MetaAttributeContext getGlobalMetaAttributeContext();
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSourceProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSourceProcessor.java
deleted file mode 100644
index 985d28aac0..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSourceProcessor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source;
-
-import java.util.List;
-
-import org.hibernate.metamodel.MetadataSources;
-
-/**
- * Handles the processing of metadata sources in a dependency-ordered manner.
- *
- * @author Steve Ebersole
- */
-public interface MetadataSourceProcessor {
- /**
- * Prepare for processing the given sources.
- *
- * @param sources The metadata sources.
- */
- public void prepare(MetadataSources sources);
-
- /**
- * Process the independent metadata. These have no dependency on other types of metadata being processed.
- *
- * @param sources The metadata sources.
- *
- * @see #prepare
- */
- public void processIndependentMetadata(MetadataSources sources);
-
- /**
- * Process the parts of the metadata that depend on type information (type definitions) having been processed
- * and available.
- *
- * @param sources The metadata sources.
- *
- * @see #processIndependentMetadata
- */
- public void processTypeDependentMetadata(MetadataSources sources);
-
- /**
- * Process the mapping (entities, et al) metadata.
- *
- * @param sources The metadata sources.
- * @param processedEntityNames Collection of any already processed entity names.
- *
- * @see #processTypeDependentMetadata
- */
- public void processMappingMetadata(MetadataSources sources, List processedEntityNames);
-
- /**
- * Process the parts of the metadata that depend on mapping (entities, et al) information having been
- * processed and available.
- *
- * @param sources The metadata sources.
- *
- * @see #processMappingMetadata
- */
- public void processMappingDependentMetadata(MetadataSources sources);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBindingContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBindingContext.java
deleted file mode 100644
index dc8dbe7843..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBindingContext.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import org.hibernate.metamodel.source.BindingContext;
-
-import org.jboss.jandex.ClassInfo;
-import org.jboss.jandex.Index;
-
-import com.fasterxml.classmate.ResolvedType;
-import com.fasterxml.classmate.ResolvedTypeWithMembers;
-
-/**
- * Defines an interface for providing additional annotation related context information.
- *
- * @author Steve Ebersole
- * @author Hardy Ferentschik
- */
-public interface AnnotationBindingContext extends BindingContext {
- Index getIndex();
-
- ClassInfo getClassInfo(String name);
-
- void resolveAllTypes(String className);
-
- ResolvedType getResolvedType(Class> clazz);
-
- ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type);
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBindingContextImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBindingContextImpl.java
deleted file mode 100644
index 20dd10da9b..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBindingContextImpl.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
-import org.hibernate.cfg.NamingStrategy;
-import org.hibernate.internal.util.ValueHolder;
-import org.hibernate.metamodel.domain.Type;
-import org.hibernate.metamodel.source.MappingDefaults;
-import org.hibernate.metamodel.source.MetadataImplementor;
-import org.hibernate.service.ServiceRegistry;
-
-import org.jboss.jandex.ClassInfo;
-import org.jboss.jandex.DotName;
-import org.jboss.jandex.Index;
-
-import com.fasterxml.classmate.MemberResolver;
-import com.fasterxml.classmate.ResolvedType;
-import com.fasterxml.classmate.ResolvedTypeWithMembers;
-import com.fasterxml.classmate.TypeResolver;
-
-/**
- * @author Steve Ebersole
- */
-public class AnnotationBindingContextImpl implements AnnotationBindingContext {
- private final MetadataImplementor metadata;
- private final ValueHolder classLoaderService;
- private final Index index;
- private final TypeResolver typeResolver = new TypeResolver();
- private final Map, ResolvedType> resolvedTypeCache = new HashMap, ResolvedType>();
-
- public AnnotationBindingContextImpl(MetadataImplementor metadata, Index index) {
- this.metadata = metadata;
- this.classLoaderService = new ValueHolder(
- new ValueHolder.DeferredInitializer() {
- @Override
- public ClassLoaderService initialize() {
- return AnnotationBindingContextImpl.this.metadata
- .getServiceRegistry()
- .getService( ClassLoaderService.class );
- }
- }
- );
- this.index = index;
- }
-
- @Override
- public Index getIndex() {
- return index;
- }
-
- @Override
- public ClassInfo getClassInfo(String name) {
- DotName dotName = DotName.createSimple( name );
- return index.getClassByName( dotName );
- }
-
- @Override
- public void resolveAllTypes(String className) {
- // the resolved type for the top level class in the hierarchy
- Class> clazz = classLoaderService.getValue().classForName( className );
- ResolvedType resolvedType = typeResolver.resolve( clazz );
- while ( resolvedType != null ) {
- // todo - check whether there is already something in the map
- resolvedTypeCache.put( clazz, resolvedType );
- resolvedType = resolvedType.getParentClass();
- if ( resolvedType != null ) {
- clazz = resolvedType.getErasedType();
- }
- }
- }
-
- @Override
- public ResolvedType getResolvedType(Class> clazz) {
- // todo - error handling
- return resolvedTypeCache.get( clazz );
- }
-
- @Override
- public ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type) {
- // todo : is there a reason we create this resolver every time?
- MemberResolver memberResolver = new MemberResolver( typeResolver );
- return memberResolver.resolve( type, null, null );
- }
-
- @Override
- public ServiceRegistry getServiceRegistry() {
- return getMetadataImplementor().getServiceRegistry();
- }
-
- @Override
- public NamingStrategy getNamingStrategy() {
- return metadata.getNamingStrategy();
- }
-
- @Override
- public MappingDefaults getMappingDefaults() {
- return metadata.getMappingDefaults();
- }
-
- @Override
- public MetadataImplementor getMetadataImplementor() {
- return metadata;
- }
-
- @Override
- public Class locateClassByName(String name) {
- return classLoaderService.getValue().classForName( name );
- }
-
- private Map nameToJavaTypeMap = new HashMap();
-
- @Override
- public Type makeJavaType(String className) {
- Type javaType = nameToJavaTypeMap.get( className );
- if ( javaType == null ) {
- javaType = metadata.makeJavaType( className );
- nameToJavaTypeMap.put( className, javaType );
- }
- return javaType;
- }
-
- @Override
- public ValueHolder> makeClassReference(String className) {
- return new ValueHolder>( locateClassByName( className ) );
- }
-
- @Override
- public String qualifyClassName(String name) {
- return name;
- }
-
- @Override
- public boolean isGloballyQuotedIdentifiers() {
- return metadata.isGloballyQuotedIdentifiers();
- }
-
-}
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationMetadataSourceProcessorImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationMetadataSourceProcessorImpl.java
deleted file mode 100644
index cf375fb65a..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationMetadataSourceProcessorImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.HibernateException;
-import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
-import org.hibernate.internal.jaxb.JaxbRoot;
-import org.hibernate.internal.jaxb.mapping.orm.JaxbEntityMappings;
-import org.hibernate.metamodel.MetadataSources;
-import org.hibernate.metamodel.source.MetadataImplementor;
-import org.hibernate.metamodel.source.MetadataSourceProcessor;
-import org.hibernate.metamodel.source.annotations.global.FetchProfileBinder;
-import org.hibernate.metamodel.source.annotations.global.FilterDefBinder;
-import org.hibernate.metamodel.source.annotations.global.IdGeneratorBinder;
-import org.hibernate.metamodel.source.annotations.global.QueryBinder;
-import org.hibernate.metamodel.source.annotations.global.TableBinder;
-import org.hibernate.metamodel.source.annotations.global.TypeDefBinder;
-import org.hibernate.metamodel.source.annotations.xml.PseudoJpaDotNames;
-import org.hibernate.metamodel.source.annotations.xml.mocker.EntityMappingsMocker;
-import org.hibernate.metamodel.source.binder.Binder;
-import org.hibernate.metamodel.source.binder.EntityHierarchy;
-import org.hibernate.metamodel.source.internal.MetadataImpl;
-
-import org.jboss.jandex.Index;
-import org.jboss.jandex.Indexer;
-import org.jboss.logging.Logger;
-
-/**
- * Main class responsible to creating and binding the Hibernate meta-model from annotations.
- * This binder only has to deal with the (jandex) annotation index/repository. XML configuration is already processed
- * and pseudo annotations are created.
- *
- * @author Hardy Ferentschik
- * @author Steve Ebersole
- */
-public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProcessor {
- private static final Logger LOG = Logger.getLogger( AnnotationMetadataSourceProcessorImpl.class );
-
- private final MetadataImplementor metadata;
- private AnnotationBindingContext bindingContext;
-
- public AnnotationMetadataSourceProcessorImpl(MetadataImpl metadata) {
- this.metadata = metadata;
- }
-
- @Override
- @SuppressWarnings( { "unchecked" })
- public void prepare(MetadataSources sources) {
- // create a jandex index from the annotated classes
- Indexer indexer = new Indexer();
- for ( Class> clazz : sources.getAnnotatedClasses() ) {
- indexClass( indexer, clazz.getName().replace( '.', '/' ) + ".class" );
- }
-
- // add package-info from the configured packages
- for ( String packageName : sources.getAnnotatedPackages() ) {
- indexClass( indexer, packageName.replace( '.', '/' ) + "/package-info.class" );
- }
-
- Index index = indexer.complete();
-
- List> mappings = new ArrayList>();
- for ( JaxbRoot> root : sources.getJaxbRootList() ) {
- if ( root.getRoot() instanceof JaxbEntityMappings ) {
- mappings.add( (JaxbRoot) root );
- }
- }
- if ( !mappings.isEmpty() ) {
- index = parseAndUpdateIndex( mappings, index );
- }
-
- if ( index.getAnnotations( PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS ) != null ) {
- // todo : this needs to move to AnnotationBindingContext
- // what happens right now is that specifying this in an orm.xml causes it to effect all orm.xmls
- metadata.setGloballyQuotedIdentifiers( true );
- }
- bindingContext = new AnnotationBindingContextImpl( metadata, index );
- }
-
- @Override
- public void processIndependentMetadata(MetadataSources sources) {
- assertBindingContextExists();
- TypeDefBinder.bind( bindingContext );
- }
-
- private void assertBindingContextExists() {
- if ( bindingContext == null ) {
- throw new AssertionFailure( "The binding context should exist. Has prepare been called!?" );
- }
- }
-
- @Override
- public void processTypeDependentMetadata(MetadataSources sources) {
- assertBindingContextExists();
- IdGeneratorBinder.bind( bindingContext );
- }
-
- @Override
- public void processMappingMetadata(MetadataSources sources, List processedEntityNames) {
- assertBindingContextExists();
- // need to order our annotated entities into an order we can process
- Set hierarchies = EntityHierarchyBuilder.createEntityHierarchies( bindingContext );
-
- Binder binder = new Binder( bindingContext.getMetadataImplementor(), new ArrayList() );
- for ( EntityHierarchy hierarchy : hierarchies ) {
- binder.processEntityHierarchy( hierarchy );
- }
- }
-
- @Override
- public void processMappingDependentMetadata(MetadataSources sources) {
- TableBinder.bind( bindingContext );
- FetchProfileBinder.bind( bindingContext );
- QueryBinder.bind( bindingContext );
- FilterDefBinder.bind( bindingContext );
- }
-
- private Index parseAndUpdateIndex(List> mappings, Index annotationIndex) {
- List list = new ArrayList( mappings.size() );
- for ( JaxbRoot jaxbRoot : mappings ) {
- list.add( jaxbRoot.getRoot() );
- }
- return new EntityMappingsMocker( list, annotationIndex, metadata.getServiceRegistry() ).mockNewIndex();
- }
-
- private void indexClass(Indexer indexer, String className) {
- InputStream stream = metadata.getServiceRegistry().getService( ClassLoaderService.class ).locateResourceStream(
- className
- );
- try {
- indexer.index( stream );
- }
- catch ( IOException e ) {
- throw new HibernateException( "Unable to open input stream for class " + className, e );
- }
- }
-}
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityHierarchyBuilder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityHierarchyBuilder.java
deleted file mode 100644
index 1584c5c0d0..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityHierarchyBuilder.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.persistence.AccessType;
-
-import org.hibernate.AnnotationException;
-import org.hibernate.internal.util.collections.CollectionHelper;
-import org.hibernate.metamodel.binding.InheritanceType;
-import org.hibernate.metamodel.source.annotations.entity.EntityClass;
-import org.hibernate.metamodel.source.annotations.entity.RootEntitySourceImpl;
-import org.hibernate.metamodel.source.annotations.entity.SubclassEntitySourceImpl;
-import org.hibernate.metamodel.source.binder.EntityHierarchy;
-import org.hibernate.metamodel.source.binder.EntitySource;
-import org.hibernate.metamodel.source.binder.SubclassEntitySource;
-
-import org.jboss.jandex.AnnotationInstance;
-import org.jboss.jandex.ClassInfo;
-import org.jboss.jandex.DotName;
-import org.jboss.jandex.FieldInfo;
-import org.jboss.jandex.Index;
-import org.jboss.jandex.MethodInfo;
-
-/**
- * Given a (jandex) annotation index build processes all classes with JPA relevant annotations and pre-orders
- * JPA entities respectively their inheritance hierarchy.
- *
- * @author Hardy Ferentschik
- */
-public class EntityHierarchyBuilder {
- private static final DotName OBJECT = DotName.createSimple( Object.class.getName() );
-
- /**
- * Pre-processes the annotated entities from the index and create a set of entity hierarchies which can be bound
- * to the metamodel.
- *
- * @param bindingContext The binding context, giving access to needed services and information
- *
- * @return a set of {@code EntityHierarchy} instances.
- */
- public static Set createEntityHierarchies(AnnotationBindingContext bindingContext) {
- Set hierarchies = new HashSet();
-
- List processedEntities = new ArrayList();
- Map> classToDirectSubClassMap = new HashMap>();
- Index index = bindingContext.getIndex();
- for ( ClassInfo info : index.getKnownClasses() ) {
- if ( !isEntityClass( info ) ) {
- continue;
- }
-
- if ( processedEntities.contains( info.name() ) ) {
- continue;
- }
-
- ClassInfo rootClassInfo = findRootEntityClassInfo( index, info );
- List rootClassWithAllSubclasses = new ArrayList();
- // the root entity might have some mapped super classes which we have to take into consideration
- // for inheritance type and default access
- addMappedSuperclasses( index, rootClassInfo, rootClassWithAllSubclasses );
-
- // collect the current root entity and all its subclasses
- processHierarchy(
- bindingContext,
- rootClassInfo,
- rootClassWithAllSubclasses,
- processedEntities,
- classToDirectSubClassMap
- );
-
- AccessType defaultAccessType = determineDefaultAccessType( rootClassWithAllSubclasses );
- InheritanceType hierarchyInheritanceType = determineInheritanceType(
- rootClassInfo,
- rootClassWithAllSubclasses
- );
-
- // create the root entity source
- EntityClass rootEntityClass = new EntityClass(
- rootClassInfo,
- null,
- defaultAccessType,
- hierarchyInheritanceType,
- bindingContext
- );
- RootEntitySourceImpl rootSource = new RootEntitySourceImpl( rootEntityClass );
-
- addSubclassEntitySources(
- bindingContext,
- classToDirectSubClassMap,
- defaultAccessType,
- hierarchyInheritanceType,
- rootEntityClass,
- rootSource
- );
-
-
- hierarchies.add( new EntityHierarchyImpl( rootSource, hierarchyInheritanceType ) );
- }
- return hierarchies;
- }
-
- private static void addSubclassEntitySources(AnnotationBindingContext bindingContext,
- Map> classToDirectSubClassMap,
- AccessType defaultAccessType,
- InheritanceType hierarchyInheritanceType,
- EntityClass entityClass,
- EntitySource entitySource) {
- List subClassInfoList = classToDirectSubClassMap.get( DotName.createSimple( entitySource.getClassName() ) );
- if ( subClassInfoList == null ) {
- return;
- }
- for ( ClassInfo subClassInfo : subClassInfoList ) {
- EntityClass subclassEntityClass = new EntityClass(
- subClassInfo,
- entityClass,
- defaultAccessType,
- hierarchyInheritanceType,
- bindingContext
- );
- SubclassEntitySource subclassEntitySource = new SubclassEntitySourceImpl( subclassEntityClass );
- entitySource.add( subclassEntitySource );
- addSubclassEntitySources(
- bindingContext,
- classToDirectSubClassMap,
- defaultAccessType,
- hierarchyInheritanceType,
- subclassEntityClass,
- subclassEntitySource
- );
- }
- }
-
- /**
- * Finds the root entity starting at the entity given by {@code info}. The root entity is not the highest superclass
- * in a java type sense, but the highest superclass which is also an entity (annotated w/ {@code @Entity}.
- *
- * @param index the annotation repository
- * @param info the class info representing an entity
- *
- * @return Finds the root entity starting at the entity given by {@code info}
- */
- private static ClassInfo findRootEntityClassInfo(Index index, ClassInfo info) {
- ClassInfo rootEntity = info;
-
- DotName superName = info.superName();
- ClassInfo tmpInfo;
- // walk up the hierarchy until java.lang.Object
- while ( !OBJECT.equals( superName ) ) {
- tmpInfo = index.getClassByName( superName );
- if ( isEntityClass( tmpInfo ) ) {
- rootEntity = tmpInfo;
- }
- superName = tmpInfo.superName();
- }
- return rootEntity;
- }
-
- private static void addMappedSuperclasses(Index index, ClassInfo info, List classInfoList) {
- DotName superName = info.superName();
- ClassInfo tmpInfo;
- // walk up the hierarchy until java.lang.Object
- while ( !OBJECT.equals( superName ) ) {
- tmpInfo = index.getClassByName( superName );
- if ( isMappedSuperclass( tmpInfo ) ) {
- classInfoList.add( tmpInfo );
- }
- superName = tmpInfo.superName();
- }
- }
-
- /**
- * This method does several things.
- *
- * - Collect all java subclasses (recursive) of {@code classInfo} in {@code rootClassWithAllSubclasses}.
- * - Keeping track of all processed classed annotated with {@code @Entity}
- * - Building up a map of class to direct subclass list
- *
- *
- * @param bindingContext the binding context
- * @param classInfo the current class info
- * @param rootClassWithAllSubclasses used to collect all classes in the hierarchy starting at {@code classInfo}
- * @param processedEntities Used to keep track of all processed entities
- * @param classToDirectSubclassMap Create a map of class to direct subclass
- */
- private static void processHierarchy(AnnotationBindingContext bindingContext,
- ClassInfo classInfo,
- List rootClassWithAllSubclasses,
- List processedEntities,
- Map> classToDirectSubclassMap) {
- processedEntities.add( classInfo.name() );
- rootClassWithAllSubclasses.add( classInfo );
- List subClasses = bindingContext.getIndex().getKnownDirectSubclasses( classInfo.name() );
-
- // if there are no more subclasses we reached the leaf class. In order to properly resolve generics we
- // need to resolve the type information using this leaf class
- if ( subClasses.isEmpty() ) {
- bindingContext.resolveAllTypes( classInfo.name().toString() );
- }
-
- for ( ClassInfo subClassInfo : subClasses ) {
- addSubClassToSubclassMap( classInfo.name(), subClassInfo, classToDirectSubclassMap );
- processHierarchy(
- bindingContext,
- subClassInfo,
- rootClassWithAllSubclasses,
- processedEntities,
- classToDirectSubclassMap
- );
- }
- }
-
- private static void addSubClassToSubclassMap(DotName name, ClassInfo subClassInfo, Map> classToDirectSubclassMap) {
- if ( classToDirectSubclassMap.containsKey( name ) ) {
- classToDirectSubclassMap.get( name ).add( subClassInfo );
- }
- else {
- List subclassList = new ArrayList();
- subclassList.add( subClassInfo );
- classToDirectSubclassMap.put( name, subclassList );
- }
- }
-
- /**
- * Checks whether the class info represents an entity.
- *
- * @param info the jandex class info
- *
- * @return {@code true} if the class represented by {@code info} is annotated with {@code @Entity}, {@code false} otherwise.
- */
- private static boolean isEntityClass(ClassInfo info) {
- if ( info == null ) {
- return false;
- }
-
- // we are only interested in building the class hierarchies for @Entity
- AnnotationInstance jpaEntityAnnotation = JandexHelper.getSingleAnnotation( info, JPADotNames.ENTITY );
- if ( jpaEntityAnnotation == null ) {
- return false;
- }
-
- // some sanity checks
- AnnotationInstance mappedSuperClassAnnotation = JandexHelper.getSingleAnnotation(
- info, JPADotNames.MAPPED_SUPERCLASS
- );
- String className = info.toString();
- assertNotEntityAndMappedSuperClass( jpaEntityAnnotation, mappedSuperClassAnnotation, className );
-
- AnnotationInstance embeddableAnnotation = JandexHelper.getSingleAnnotation(
- info, JPADotNames.EMBEDDABLE
- );
- assertNotEntityAndEmbeddable( jpaEntityAnnotation, embeddableAnnotation, className );
-
- return true;
- }
-
- /**
- * Checks whether the class info represents a mapped superclass.
- *
- * @param info the jandex class info
- *
- * @return {@code true} if the class represented by {@code info} is annotated with {@code @MappedSuperclass}, {@code false} otherwise.
- */
- private static boolean isMappedSuperclass(ClassInfo info) {
- if ( info == null ) {
- return false;
- }
-
- // we are only interested in building the class hierarchies for @Entity
- AnnotationInstance mappedSuperclassAnnotation = JandexHelper.getSingleAnnotation(
- info,
- JPADotNames.MAPPED_SUPERCLASS
- );
- return mappedSuperclassAnnotation != null;
- }
-
- private static void assertNotEntityAndMappedSuperClass(AnnotationInstance jpaEntityAnnotation, AnnotationInstance mappedSuperClassAnnotation, String className) {
- if ( jpaEntityAnnotation != null && mappedSuperClassAnnotation != null ) {
- throw new AnnotationException(
- "An entity cannot be annotated with both @Entity and @MappedSuperclass. " + className + " has both annotations."
- );
- }
- }
-
- private static void assertNotEntityAndEmbeddable(AnnotationInstance jpaEntityAnnotation, AnnotationInstance embeddableAnnotation, String className) {
- if ( jpaEntityAnnotation != null && embeddableAnnotation != null ) {
- throw new AnnotationException(
- "An entity cannot be annotated with both @Entity and @Embeddable. " + className + " has both annotations."
- );
- }
- }
-
- /**
- * @param classes the classes in the hierarchy
- *
- * @return Returns the default access type for the configured class hierarchy independent of explicit
- * {@code AccessType} annotations. The default access type is determined by the placement of the
- * annotations.
- */
- private static AccessType determineDefaultAccessType(List classes) {
- AccessType accessTypeByEmbeddedIdPlacement = null;
- AccessType accessTypeByIdPlacement = null;
- for ( ClassInfo info : classes ) {
- List idAnnotations = info.annotations().get( JPADotNames.ID );
- List embeddedIdAnnotations = info.annotations().get( JPADotNames.EMBEDDED_ID );
-
- if ( CollectionHelper.isNotEmpty( embeddedIdAnnotations ) ) {
- accessTypeByEmbeddedIdPlacement = determineAccessTypeByIdPlacement( embeddedIdAnnotations );
- }
- if ( CollectionHelper.isNotEmpty( idAnnotations ) ) {
- accessTypeByIdPlacement = determineAccessTypeByIdPlacement( idAnnotations );
- }
- }
- if ( accessTypeByEmbeddedIdPlacement != null ) {
- return accessTypeByEmbeddedIdPlacement;
- }
- else if ( accessTypeByIdPlacement != null ) {
- return accessTypeByIdPlacement;
- }
- else {
- return throwIdNotFoundAnnotationException( classes );
- }
- }
-
- private static AccessType determineAccessTypeByIdPlacement(List idAnnotations) {
- AccessType accessType = null;
- for ( AnnotationInstance annotation : idAnnotations ) {
- AccessType tmpAccessType;
- if ( annotation.target() instanceof FieldInfo ) {
- tmpAccessType = AccessType.FIELD;
- }
- else if ( annotation.target() instanceof MethodInfo ) {
- tmpAccessType = AccessType.PROPERTY;
- }
- else {
- throw new AnnotationException( "Invalid placement of @Id annotation" );
- }
-
- if ( accessType == null ) {
- accessType = tmpAccessType;
- }
- else {
- if ( !accessType.equals( tmpAccessType ) ) {
- throw new AnnotationException( "Inconsistent placement of @Id annotation within hierarchy " );
- }
- }
- }
- return accessType;
- }
-
- private static InheritanceType determineInheritanceType(ClassInfo rootClassInfo, List classes) {
- if(classes.size() == 1) {
- return InheritanceType.NO_INHERITANCE;
- }
-
- // if we have more than one entity class the default is SINGLE_TABLE
- InheritanceType inheritanceType = InheritanceType.SINGLE_TABLE;
- AnnotationInstance inheritanceAnnotation = JandexHelper.getSingleAnnotation(
- rootClassInfo, JPADotNames.INHERITANCE
- );
- if ( inheritanceAnnotation != null ) {
- String enumName = inheritanceAnnotation.value( "strategy" ).asEnum();
- javax.persistence.InheritanceType jpaInheritanceType = Enum.valueOf(
- javax.persistence.InheritanceType.class, enumName
- );
- inheritanceType = InheritanceType.get( jpaInheritanceType );
- }
-
- // sanity check that the is no other @Inheritance annotation in the hierarchy
- for ( ClassInfo info : classes ) {
- if ( rootClassInfo.equals( info ) ) {
- continue;
- }
- inheritanceAnnotation = JandexHelper.getSingleAnnotation(
- info, JPADotNames.INHERITANCE
- );
- if ( inheritanceAnnotation != null ) {
- throw new AnnotationException(
- String.format(
- "The inheritance type for %s must be specified on the root entity %s",
- hierarchyListString( classes ),
- rootClassInfo.name().toString()
- )
- );
- }
- }
-
- return inheritanceType;
- }
-
- private static AccessType throwIdNotFoundAnnotationException(List classes) {
- StringBuilder builder = new StringBuilder();
- builder.append( "Unable to determine identifier attribute for class hierarchy consisting of the classe(s) " );
- builder.append( hierarchyListString( classes ) );
- throw new AnnotationException( builder.toString() );
- }
-
- private static String hierarchyListString(List classes) {
- StringBuilder builder = new StringBuilder();
- builder.append( "[" );
-
- int count = 0;
- for ( ClassInfo info : classes ) {
- builder.append( info.name().toString() );
- if ( count < classes.size() - 1 ) {
- builder.append( ", " );
- }
- count++;
- }
- builder.append( "]" );
- return builder.toString();
- }
-}
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityHierarchyImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityHierarchyImpl.java
deleted file mode 100644
index 2d970afbb6..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityHierarchyImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import org.hibernate.metamodel.binding.InheritanceType;
-import org.hibernate.metamodel.source.binder.EntityHierarchy;
-import org.hibernate.metamodel.source.binder.RootEntitySource;
-
-/**
- * @author Hardy Ferentschik
- */
-public class EntityHierarchyImpl implements EntityHierarchy {
- private final RootEntitySource rootEntitySource;
- private final InheritanceType inheritanceType;
-
- public EntityHierarchyImpl(RootEntitySource source, InheritanceType inheritanceType) {
- this.rootEntitySource = source;
- this.inheritanceType = inheritanceType;
- }
-
- @Override
- public InheritanceType getHierarchyInheritanceType() {
- return inheritanceType;
- }
-
- @Override
- public RootEntitySource getRootEntitySource() {
- return rootEntitySource;
- }
-}
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EnumConversionHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EnumConversionHelper.java
deleted file mode 100644
index 98ae17a720..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EnumConversionHelper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import javax.persistence.CascadeType;
-import javax.persistence.GenerationType;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.FetchMode;
-import org.hibernate.engine.spi.CascadeStyle;
-import org.hibernate.engine.spi.CascadeStyles;
-import org.hibernate.id.MultipleHiLoPerTableGenerator;
-import org.hibernate.internal.util.collections.CollectionHelper;
-
-/**
- * Helper class which converts between different enum types.
- *
- * @author Hardy Ferentschik
- */
-public class EnumConversionHelper {
- private EnumConversionHelper() {
- }
-
- public static String generationTypeToGeneratorStrategyName(GenerationType generatorEnum, boolean useNewGeneratorMappings) {
- switch ( generatorEnum ) {
- case IDENTITY:
- return "identity";
- case AUTO:
- return useNewGeneratorMappings
- ? "enhanced-sequence"
- : "native";
- case TABLE:
- return useNewGeneratorMappings
- ? "enhanced-table"
- : MultipleHiLoPerTableGenerator.class.getName();
- case SEQUENCE:
- return useNewGeneratorMappings
- ? "enhanced-sequence"
- : "seqhilo";
- }
- throw new AssertionFailure( "Unknown GeneratorType: " + generatorEnum );
- }
-
- public static CascadeStyle cascadeTypeToCascadeStyle(CascadeType cascadeType) {
- switch ( cascadeType ) {
- case ALL: {
- return CascadeStyles.ALL;
- }
- case PERSIST: {
- return CascadeStyles.PERSIST;
- }
- case MERGE: {
- return CascadeStyles.MERGE;
- }
- case REMOVE: {
- return CascadeStyles.DELETE;
- }
- case REFRESH: {
- return CascadeStyles.REFRESH;
- }
- case DETACH: {
- return CascadeStyles.EVICT;
- }
- default: {
- throw new AssertionFailure( "Unknown cascade type" );
- }
- }
- }
-
- public static FetchMode annotationFetchModeToHibernateFetchMode(org.hibernate.annotations.FetchMode annotationFetchMode) {
- switch ( annotationFetchMode ) {
- case JOIN: {
- return FetchMode.JOIN;
- }
- case SELECT: {
- return FetchMode.SELECT;
- }
- case SUBSELECT: {
- // todo - is this correct? can the conversion be made w/o any additional information, eg
- // todo - association nature
- return FetchMode.SELECT;
- }
- default: {
- throw new AssertionFailure( "Unknown fetch mode" );
- }
- }
- }
-
- public static Set cascadeTypeToCascadeStyleSet(Set cascadeTypes) {
- if ( CollectionHelper.isEmpty( cascadeTypes ) ) {
- return Collections.emptySet();
- }
- Set cascadeStyleSet = new HashSet();
- for ( CascadeType cascadeType : cascadeTypes ) {
- cascadeStyleSet.add( cascadeTypeToCascadeStyle( cascadeType ) );
- }
- return cascadeStyleSet;
- }
-}
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/HibernateDotNames.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/HibernateDotNames.java
deleted file mode 100644
index 932b672d00..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/HibernateDotNames.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import org.hibernate.annotations.AccessType;
-import org.hibernate.annotations.Any;
-import org.hibernate.annotations.AnyMetaDef;
-import org.hibernate.annotations.AnyMetaDefs;
-import org.hibernate.annotations.BatchSize;
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.Cascade;
-import org.hibernate.annotations.Check;
-import org.hibernate.annotations.CollectionId;
-import org.hibernate.annotations.ColumnTransformer;
-import org.hibernate.annotations.ColumnTransformers;
-import org.hibernate.annotations.Columns;
-import org.hibernate.annotations.DiscriminatorFormula;
-import org.hibernate.annotations.DiscriminatorOptions;
-import org.hibernate.annotations.Entity;
-import org.hibernate.annotations.Fetch;
-import org.hibernate.annotations.FetchProfile;
-import org.hibernate.annotations.FetchProfiles;
-import org.hibernate.annotations.Filter;
-import org.hibernate.annotations.FilterDef;
-import org.hibernate.annotations.FilterDefs;
-import org.hibernate.annotations.FilterJoinTable;
-import org.hibernate.annotations.FilterJoinTables;
-import org.hibernate.annotations.Filters;
-import org.hibernate.annotations.ForeignKey;
-import org.hibernate.annotations.Formula;
-import org.hibernate.annotations.Generated;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.GenericGenerators;
-import org.hibernate.annotations.Immutable;
-import org.hibernate.annotations.Index;
-import org.hibernate.annotations.IndexColumn;
-import org.hibernate.annotations.JoinColumnOrFormula;
-import org.hibernate.annotations.JoinColumnsOrFormulas;
-import org.hibernate.annotations.JoinFormula;
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyToOne;
-import org.hibernate.annotations.Loader;
-import org.hibernate.annotations.ManyToAny;
-import org.hibernate.annotations.MapKeyType;
-import org.hibernate.annotations.MetaValue;
-import org.hibernate.annotations.NamedNativeQueries;
-import org.hibernate.annotations.NamedNativeQuery;
-import org.hibernate.annotations.NamedQueries;
-import org.hibernate.annotations.NamedQuery;
-import org.hibernate.annotations.NaturalId;
-import org.hibernate.annotations.NotFound;
-import org.hibernate.annotations.OnDelete;
-import org.hibernate.annotations.OptimisticLock;
-import org.hibernate.annotations.OrderBy;
-import org.hibernate.annotations.ParamDef;
-import org.hibernate.annotations.Parameter;
-import org.hibernate.annotations.Parent;
-import org.hibernate.annotations.Persister;
-import org.hibernate.annotations.Proxy;
-import org.hibernate.annotations.RowId;
-import org.hibernate.annotations.SQLDelete;
-import org.hibernate.annotations.SQLDeleteAll;
-import org.hibernate.annotations.SQLInsert;
-import org.hibernate.annotations.SQLUpdate;
-import org.hibernate.annotations.Sort;
-import org.hibernate.annotations.Source;
-import org.hibernate.annotations.Subselect;
-import org.hibernate.annotations.Synchronize;
-import org.hibernate.annotations.Table;
-import org.hibernate.annotations.Tables;
-import org.hibernate.annotations.Target;
-import org.hibernate.annotations.Tuplizer;
-import org.hibernate.annotations.Tuplizers;
-import org.hibernate.annotations.Type;
-import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
-import org.hibernate.annotations.Where;
-import org.hibernate.annotations.WhereJoinTable;
-
-import org.jboss.jandex.DotName;
-
-/**
- * Defines the dot names for the Hibernate specific mapping annotations.
- *
- * @author Hardy Ferentschik
- */
-public interface HibernateDotNames {
- DotName ACCESS_TYPE = DotName.createSimple( AccessType.class.getName() );
- DotName ANY = DotName.createSimple( Any.class.getName() );
- DotName ANY_META_DEF = DotName.createSimple( AnyMetaDef.class.getName() );
- DotName ANY_META_DEFS = DotName.createSimple( AnyMetaDefs.class.getName() );
- DotName BATCH_SIZE = DotName.createSimple( BatchSize.class.getName() );
- DotName CACHE = DotName.createSimple( Cache.class.getName() );
- DotName CASCADE = DotName.createSimple( Cascade.class.getName() );
- DotName CHECK = DotName.createSimple( Check.class.getName() );
- DotName COLLECTION_ID = DotName.createSimple( CollectionId.class.getName() );
- DotName COLUMNS = DotName.createSimple( Columns.class.getName() );
- DotName COLUMN_TRANSFORMER = DotName.createSimple( ColumnTransformer.class.getName() );
- DotName COLUMN_TRANSFORMERS = DotName.createSimple( ColumnTransformers.class.getName() );
- DotName DISCRIMINATOR_FORMULA = DotName.createSimple( DiscriminatorFormula.class.getName() );
- DotName DISCRIMINATOR_OPTIONS = DotName.createSimple( DiscriminatorOptions.class.getName() );
- DotName ENTITY = DotName.createSimple( Entity.class.getName() );
- DotName FETCH = DotName.createSimple( Fetch.class.getName() );
- DotName FETCH_PROFILE = DotName.createSimple( FetchProfile.class.getName() );
- DotName FETCH_PROFILES = DotName.createSimple( FetchProfiles.class.getName() );
- DotName FILTER = DotName.createSimple( Filter.class.getName() );
- DotName FILTER_DEF = DotName.createSimple( FilterDef.class.getName() );
- DotName FILTER_DEFS = DotName.createSimple( FilterDefs.class.getName() );
- DotName FILTER_JOIN_TABLE = DotName.createSimple( FilterJoinTable.class.getName() );
- DotName FILTER_JOIN_TABLES = DotName.createSimple( FilterJoinTables.class.getName() );
- DotName FILTERS = DotName.createSimple( Filters.class.getName() );
- DotName FOREIGN_KEY = DotName.createSimple( ForeignKey.class.getName() );
- DotName FORMULA = DotName.createSimple( Formula.class.getName() );
- DotName GENERATED = DotName.createSimple( Generated.class.getName() );
- DotName GENERIC_GENERATOR = DotName.createSimple( GenericGenerator.class.getName() );
- DotName GENERIC_GENERATORS = DotName.createSimple( GenericGenerators.class.getName() );
- DotName IMMUTABLE = DotName.createSimple( Immutable.class.getName() );
- DotName INDEX = DotName.createSimple( Index.class.getName() );
- DotName INDEX_COLUMN = DotName.createSimple( IndexColumn.class.getName() );
- DotName JOIN_COLUMN_OR_FORMULA = DotName.createSimple( JoinColumnOrFormula.class.getName() );
- DotName JOIN_COLUMNS_OR_FORMULAS = DotName.createSimple( JoinColumnsOrFormulas.class.getName() );
- DotName JOIN_FORMULA = DotName.createSimple( JoinFormula.class.getName() );
- DotName LAZY_COLLECTION = DotName.createSimple( LazyCollection.class.getName() );
- DotName LAZY_TO_ONE = DotName.createSimple( LazyToOne.class.getName() );
- DotName LOADER = DotName.createSimple( Loader.class.getName() );
- DotName MANY_TO_ANY = DotName.createSimple( ManyToAny.class.getName() );
- DotName MAP_KEY_TYPE = DotName.createSimple( MapKeyType.class.getName() );
- DotName META_VALUE = DotName.createSimple( MetaValue.class.getName() );
- DotName NAMED_NATIVE_QUERIES = DotName.createSimple( NamedNativeQueries.class.getName() );
- DotName NAMED_NATIVE_QUERY = DotName.createSimple( NamedNativeQuery.class.getName() );
- DotName NAMED_QUERIES = DotName.createSimple( NamedQueries.class.getName() );
- DotName NAMED_QUERY = DotName.createSimple( NamedQuery.class.getName() );
- DotName NATURAL_ID = DotName.createSimple( NaturalId.class.getName() );
- DotName NOT_FOUND = DotName.createSimple( NotFound.class.getName() );
- DotName ON_DELETE = DotName.createSimple( OnDelete.class.getName() );
- DotName OPTIMISTIC_LOCK = DotName.createSimple( OptimisticLock.class.getName() );
- DotName ORDER_BY = DotName.createSimple( OrderBy.class.getName() );
- DotName PARAM_DEF = DotName.createSimple( ParamDef.class.getName() );
- DotName PARAMETER = DotName.createSimple( Parameter.class.getName() );
- DotName PARENT = DotName.createSimple( Parent.class.getName() );
- DotName PERSISTER = DotName.createSimple( Persister.class.getName() );
- DotName PROXY = DotName.createSimple( Proxy.class.getName() );
- DotName ROW_ID = DotName.createSimple( RowId.class.getName() );
- DotName SORT = DotName.createSimple( Sort.class.getName() );
- DotName SOURCE = DotName.createSimple( Source.class.getName() );
- DotName SQL_DELETE = DotName.createSimple( SQLDelete.class.getName() );
- DotName SQL_DELETE_ALL = DotName.createSimple( SQLDeleteAll.class.getName() );
- DotName SQL_INSERT = DotName.createSimple( SQLInsert.class.getName() );
- DotName SQL_UPDATE = DotName.createSimple( SQLUpdate.class.getName() );
- DotName SUB_SELECT = DotName.createSimple( Subselect.class.getName() );
- DotName SYNCHRONIZE = DotName.createSimple( Synchronize.class.getName() );
- DotName TABLE = DotName.createSimple( Table.class.getName() );
- DotName TABLES = DotName.createSimple( Tables.class.getName() );
- DotName TARGET = DotName.createSimple( Target.class.getName() );
- DotName TUPLIZER = DotName.createSimple( Tuplizer.class.getName() );
- DotName TUPLIZERS = DotName.createSimple( Tuplizers.class.getName() );
- DotName TYPE = DotName.createSimple( Type.class.getName() );
- DotName TYPE_DEF = DotName.createSimple( TypeDef.class.getName() );
- DotName TYPE_DEFS = DotName.createSimple( TypeDefs.class.getName() );
- DotName WHERE = DotName.createSimple( Where.class.getName() );
- DotName WHERE_JOIN_TABLE = DotName.createSimple( WhereJoinTable.class.getName() );
-}
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/JPADotNames.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/JPADotNames.java
deleted file mode 100644
index 20aa8a30e1..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/JPADotNames.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import javax.persistence.Access;
-import javax.persistence.AccessType;
-import javax.persistence.AssociationOverride;
-import javax.persistence.AssociationOverrides;
-import javax.persistence.AttributeOverride;
-import javax.persistence.AttributeOverrides;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.CascadeType;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ColumnResult;
-import javax.persistence.Convert;
-import javax.persistence.Converter;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorType;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.ElementCollection;
-import javax.persistence.Embeddable;
-import javax.persistence.Embedded;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.EntityListeners;
-import javax.persistence.EntityResult;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.ExcludeDefaultListeners;
-import javax.persistence.ExcludeSuperclassListeners;
-import javax.persistence.FetchType;
-import javax.persistence.FieldResult;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinColumns;
-import javax.persistence.JoinTable;
-import javax.persistence.Lob;
-import javax.persistence.LockModeType;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.MapKey;
-import javax.persistence.MapKeyClass;
-import javax.persistence.MapKeyColumn;
-import javax.persistence.MapKeyEnumerated;
-import javax.persistence.MapKeyJoinColumn;
-import javax.persistence.MapKeyJoinColumns;
-import javax.persistence.MapKeyTemporal;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.MapsId;
-import javax.persistence.NamedNativeQueries;
-import javax.persistence.NamedNativeQuery;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.OrderBy;
-import javax.persistence.OrderColumn;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContexts;
-import javax.persistence.PersistenceProperty;
-import javax.persistence.PersistenceUnit;
-import javax.persistence.PersistenceUnits;
-import javax.persistence.PostLoad;
-import javax.persistence.PostPersist;
-import javax.persistence.PostRemove;
-import javax.persistence.PostUpdate;
-import javax.persistence.PrePersist;
-import javax.persistence.PreRemove;
-import javax.persistence.PreUpdate;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.PrimaryKeyJoinColumns;
-import javax.persistence.QueryHint;
-import javax.persistence.SecondaryTable;
-import javax.persistence.SecondaryTables;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.SqlResultSetMapping;
-import javax.persistence.SqlResultSetMappings;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.Version;
-
-import org.jboss.jandex.DotName;
-
-/**
- * Defines the dot names for the JPA annotations
- *
- * @author Hardy Ferentschik
- */
-public interface JPADotNames {
- DotName ACCESS = DotName.createSimple( Access.class.getName() );
- DotName ACCESS_TYPE = DotName.createSimple( AccessType.class.getName() );
- DotName ASSOCIATION_OVERRIDE = DotName.createSimple( AssociationOverride.class.getName() );
- DotName ASSOCIATION_OVERRIDES = DotName.createSimple( AssociationOverrides.class.getName() );
- DotName ATTRIBUTE_OVERRIDE = DotName.createSimple( AttributeOverride.class.getName() );
- DotName ATTRIBUTE_OVERRIDES = DotName.createSimple( AttributeOverrides.class.getName() );
- DotName BASIC = DotName.createSimple( Basic.class.getName() );
- DotName CACHEABLE = DotName.createSimple( Cacheable.class.getName() );
- DotName CASCADE_TYPE = DotName.createSimple( CascadeType.class.getName() );
- DotName COLLECTION_TABLE = DotName.createSimple( CollectionTable.class.getName() );
- DotName COLUMN = DotName.createSimple( Column.class.getName() );
- DotName COLUMN_RESULT = DotName.createSimple( ColumnResult.class.getName() );
- DotName CONVERT = DotName.createSimple( Convert.class.getName() );
- DotName CONVERTER = DotName.createSimple( Converter.class.getName() );
- DotName DISCRIMINATOR_COLUMN = DotName.createSimple( DiscriminatorColumn.class.getName() );
- DotName DISCRIMINATOR_TYPE = DotName.createSimple( DiscriminatorType.class.getName() );
- DotName DISCRIMINATOR_VALUE = DotName.createSimple( DiscriminatorValue.class.getName() );
- DotName ELEMENT_COLLECTION = DotName.createSimple( ElementCollection.class.getName() );
- DotName EMBEDDABLE = DotName.createSimple( Embeddable.class.getName() );
- DotName EMBEDDED = DotName.createSimple( Embedded.class.getName() );
- DotName EMBEDDED_ID = DotName.createSimple( EmbeddedId.class.getName() );
- DotName ENTITY = DotName.createSimple( Entity.class.getName() );
- DotName ENTITY_LISTENERS = DotName.createSimple( EntityListeners.class.getName() );
- DotName ENTITY_RESULT = DotName.createSimple( EntityResult.class.getName() );
- DotName ENUMERATED = DotName.createSimple( Enumerated.class.getName() );
- DotName ENUM_TYPE = DotName.createSimple( EnumType.class.getName() );
- DotName EXCLUDE_DEFAULT_LISTENERS = DotName.createSimple( ExcludeDefaultListeners.class.getName() );
- DotName EXCLUDE_SUPERCLASS_LISTENERS = DotName.createSimple( ExcludeSuperclassListeners.class.getName() );
- DotName FETCH_TYPE = DotName.createSimple( FetchType.class.getName() );
- DotName FIELD_RESULT = DotName.createSimple( FieldResult.class.getName() );
- DotName GENERATION_TYPE = DotName.createSimple( GenerationType.class.getName() );
- DotName GENERATED_VALUE = DotName.createSimple( GeneratedValue.class.getName() );
- DotName ID = DotName.createSimple( Id.class.getName() );
- DotName ID_CLASS = DotName.createSimple( IdClass.class.getName() );
- DotName INHERITANCE_TYPE = DotName.createSimple( InheritanceType.class.getName() );
- DotName JOIN_COLUMN = DotName.createSimple( JoinColumn.class.getName() );
- DotName INHERITANCE = DotName.createSimple( Inheritance.class.getName() );
- DotName JOIN_COLUMNS = DotName.createSimple( JoinColumns.class.getName() );
- DotName JOIN_TABLE = DotName.createSimple( JoinTable.class.getName() );
- DotName LOB = DotName.createSimple( Lob.class.getName() );
- DotName LOCK_MODE_TYPE = DotName.createSimple( LockModeType.class.getName() );
- DotName MANY_TO_MANY = DotName.createSimple( ManyToMany.class.getName() );
- DotName MANY_TO_ONE = DotName.createSimple( ManyToOne.class.getName() );
- DotName MAP_KEY = DotName.createSimple( MapKey.class.getName() );
- DotName MAP_KEY_CLASS = DotName.createSimple( MapKeyClass.class.getName() );
- DotName MAP_KEY_COLUMN = DotName.createSimple( MapKeyColumn.class.getName() );
- DotName MAP_KEY_ENUMERATED = DotName.createSimple( MapKeyEnumerated.class.getName() );
- DotName MAP_KEY_JOIN_COLUMN = DotName.createSimple( MapKeyJoinColumn.class.getName() );
- DotName MAP_KEY_JOIN_COLUMNS = DotName.createSimple( MapKeyJoinColumns.class.getName() );
- DotName MAP_KEY_TEMPORAL = DotName.createSimple( MapKeyTemporal.class.getName() );
- DotName MAPPED_SUPERCLASS = DotName.createSimple( MappedSuperclass.class.getName() );
- DotName MAPS_ID = DotName.createSimple( MapsId.class.getName() );
- DotName NAMED_NATIVE_QUERIES = DotName.createSimple( NamedNativeQueries.class.getName() );
- DotName NAMED_NATIVE_QUERY = DotName.createSimple( NamedNativeQuery.class.getName() );
- DotName NAMED_QUERIES = DotName.createSimple( NamedQueries.class.getName() );
- DotName NAMED_QUERY = DotName.createSimple( NamedQuery.class.getName() );
- DotName ONE_TO_MANY = DotName.createSimple( OneToMany.class.getName() );
- DotName ONE_TO_ONE = DotName.createSimple( OneToOne.class.getName() );
- DotName ORDER_BY = DotName.createSimple( OrderBy.class.getName() );
- DotName ORDER_COLUMN = DotName.createSimple( OrderColumn.class.getName() );
- DotName PERSISTENCE_CONTEXT = DotName.createSimple( PersistenceContext.class.getName() );
- DotName PERSISTENCE_CONTEXTS = DotName.createSimple( PersistenceContexts.class.getName() );
- DotName PERSISTENCE_PROPERTY = DotName.createSimple( PersistenceProperty.class.getName() );
- DotName PERSISTENCE_UNIT = DotName.createSimple( PersistenceUnit.class.getName() );
- DotName PERSISTENCE_UNITS = DotName.createSimple( PersistenceUnits.class.getName() );
- DotName POST_LOAD = DotName.createSimple( PostLoad.class.getName() );
- DotName POST_PERSIST = DotName.createSimple( PostPersist.class.getName() );
- DotName POST_REMOVE = DotName.createSimple( PostRemove.class.getName() );
- DotName POST_UPDATE = DotName.createSimple( PostUpdate.class.getName() );
- DotName PRE_PERSIST = DotName.createSimple( PrePersist.class.getName() );
- DotName PRE_REMOVE = DotName.createSimple( PreRemove.class.getName() );
- DotName PRE_UPDATE = DotName.createSimple( PreUpdate.class.getName() );
- DotName PRIMARY_KEY_JOIN_COLUMN = DotName.createSimple( PrimaryKeyJoinColumn.class.getName() );
- DotName PRIMARY_KEY_JOIN_COLUMNS = DotName.createSimple( PrimaryKeyJoinColumns.class.getName() );
- DotName QUERY_HINT = DotName.createSimple( QueryHint.class.getName() );
- DotName SECONDARY_TABLE = DotName.createSimple( SecondaryTable.class.getName() );
- DotName SECONDARY_TABLES = DotName.createSimple( SecondaryTables.class.getName() );
- DotName SEQUENCE_GENERATOR = DotName.createSimple( SequenceGenerator.class.getName() );
- DotName SQL_RESULT_SET_MAPPING = DotName.createSimple( SqlResultSetMapping.class.getName() );
- DotName SQL_RESULT_SET_MAPPINGS = DotName.createSimple( SqlResultSetMappings.class.getName() );
- DotName TABLE = DotName.createSimple( Table.class.getName() );
- DotName TABLE_GENERATOR = DotName.createSimple( TableGenerator.class.getName() );
- DotName TEMPORAL = DotName.createSimple( Temporal.class.getName() );
- DotName TEMPORAL_TYPE = DotName.createSimple( TemporalType.class.getName() );
- DotName TRANSIENT = DotName.createSimple( Transient.class.getName() );
- DotName UNIQUE_CONSTRAINT = DotName.createSimple( UniqueConstraint.class.getName() );
- DotName VERSION = DotName.createSimple( Version.class.getName() );
-}
-
-
diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/JandexHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/JandexHelper.java
deleted file mode 100644
index 0a7270300d..0000000000
--- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/JandexHelper.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.metamodel.source.annotations;
-
-import java.beans.Introspector;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.HibernateException;
-import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
-import org.hibernate.internal.util.type.PrimitiveWrapperHelper;
-
-import org.jboss.jandex.AnnotationInstance;
-import org.jboss.jandex.AnnotationTarget;
-import org.jboss.jandex.AnnotationValue;
-import org.jboss.jandex.ClassInfo;
-import org.jboss.jandex.DotName;
-import org.jboss.jandex.FieldInfo;
-import org.jboss.jandex.Index;
-import org.jboss.jandex.Indexer;
-import org.jboss.jandex.MethodInfo;
-import org.jboss.jandex.Type;
-
-/**
- * Utility methods for working with the jandex annotation index.
- *
- * @author Hardy Ferentschik
- */
-public class JandexHelper {
- private static final Map DEFAULT_VALUES_BY_ELEMENT = new HashMap