Permalink
Browse files

HHH-8897 : Integrate org.hibernate.metamodel from metamodel branch in…

…to master
  • Loading branch information...
1 parent 1a87adc commit 513f8ca8698d305961ef3ecd8f6e470ee016c520 @gbadner gbadner committed Jan 27, 2014
Showing 1,369 changed files with 93,365 additions and 46,168 deletions.
View
@@ -137,6 +137,7 @@ subprojects { subProject ->
dependencies {
compile( libraries.logging )
compile( libraries.logging_annotations )
+ compile( libraries.logging_processor )
testCompile( libraries.junit )
testCompile( libraries.byteman )
@@ -152,8 +153,11 @@ subprojects { subProject ->
jaxb( libraries.jaxb ){
exclude group: "javax.xml.stream"
}
+ jaxb( libraries.jaxb )
jaxb( libraries.jaxb2_basics )
jaxb( libraries.jaxb2_ant )
+ jaxb( libraries.jaxb2_jaxb )
+ jaxb( libraries.jaxb2_jaxb_xjc )
animalSniffer ( libraries.animal_sniffer )
javaApiSignature ( libraries.java16_signature )
@@ -10,6 +10,7 @@ versionInjection {
dependencies {
compile( libraries.jta )
compile( libraries.dom4j )
+ compile( libraries.classmate )
compile( libraries.commons_annotations )
compile( libraries.jpa )
compile( libraries.javassist )
@@ -21,7 +22,6 @@ dependencies {
provided( libraries.ant )
provided( libraries.jacc )
provided( libraries.validation )
- provided( libraries.classmate )
testCompile( project(':hibernate-testing') )
testCompile( libraries.validation )
@@ -111,7 +111,7 @@ task jaxb {
// input schemas
cfgXsd = file( 'src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd')
hbmXsd = file( 'src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd' )
- ormXsd = file( 'src/main/resources/org/hibernate/jpa/orm_2_0.xsd' )
+ ormXsd = file( 'src/main/resources/org/hibernate/jpa/orm_2_1.xsd' )
// input bindings
cfgXjb = file( 'src/main/xjb/hbm-configuration-bindings.xjb' )
@@ -133,29 +133,33 @@ task jaxb {
// hibernate-configuration
ant.xjc(
destdir: '${jaxbTargetDir}',
- package: 'org.hibernate.internal.jaxb.cfg',
+ package: 'org.hibernate.jaxb.spi.cfg',
binding: 'src/main/xjb/hbm-configuration-bindings.xjb',
schema: cfgXsd.path
)
// hibernate-mapping
ant.xjc(
destdir: '${jaxbTargetDir}',
- package: 'org.hibernate.internal.jaxb.mapping.hbm',
+ package: 'org.hibernate.jaxb.spi.hbm',
binding: hbmXjb.path,
schema: hbmXsd.path,
extension: 'true'
) {
- arg line: '-Xinheritance'
+ arg line: '-Xinheritance -Xsimplify'
}
// orm.xml (jpa)
ant.xjc(
destdir: '${jaxbTargetDir}',
- package: 'org.hibernate.internal.jaxb.mapping.orm',
+ package: 'org.hibernate.jaxb.spi.orm',
binding: 'src/main/xjb/orm-bindings.xjb',
- schema: ormXsd.path
- )
+ schema: ormXsd.path,
+ extension: 'true'
+ ) {
+ arg line: '-Xinheritance'
+ }
+
}
}
@@ -23,7 +23,7 @@
*/
package org.hibernate;
-import org.hibernate.internal.jaxb.Origin;
+import org.hibernate.jaxb.spi.Origin;
import org.hibernate.internal.util.xml.XmlDocument;
/**
@@ -30,6 +30,8 @@
import javax.naming.Referenceable;
import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.cfg.Settings;
+import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
@@ -71,6 +73,12 @@
*/
public Interceptor getInterceptor();
+ public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy();
+ public CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver();
+ public SessionFactoryObserver[] getSessionFactoryObservers();
+ public EntityNameResolver[] getEntityNameResolvers();
+ public Settings getSettings();
+
/**
* Get the delegate for handling entity-not-found exception conditions.
*
@@ -0,0 +1,48 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, 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;
+
+/**
+ * An enumeration of truth values.
+ * <p/>
+ * Yes this *could* be handled with Boolean, but then you run into potential problems with premature
+ * auto-unboxing.
+ *
+ * @author Steve Ebersole
+ */
+public enum TruthValue {
+ TRUE,
+ FALSE,
+ UNKNOWN;
+
+ public static boolean toBoolean(TruthValue value, boolean defaultValue) {
+ if ( value == TruthValue.TRUE ) {
+ return true;
+ }
+ if ( value == TruthValue.FALSE ) {
+ return false;
+ }
+ return defaultValue;
+ }
+}
@@ -0,0 +1,54 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, 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.annotations;
+
+import java.lang.annotation.Retention;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Annotation used to indicate that an entity represents shared (non tenant aware) data in a multi-tenant
+ * application.
+ *
+ * Valid only at the root of an inheritance hierarchy.
+ *
+ * @author Steve Ebersole
+ */
+@java.lang.annotation.Target(TYPE)
+@Retention(RUNTIME)
+public @interface MultiTenancy {
+ public boolean shared() default true;
+
+ /**
+ * The discriminator values can be either be handled as literals or handled through JDBC parameter binding.
+ * {@code true} here (the default) indicates that the parameter binding approach should be used; {@code false}
+ * indicates the value should be handled as a literal.
+ * <p/>
+ * Care should be used specifying to use literals here. PreparedStatements will not be able to be reused
+ * nearly as often by the database/driver which can potentially cause a significant performance impact to your
+ * application.
+ */
+ public boolean useParameterBinding() default true;
+}
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, 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.annotations;
+
+import java.lang.annotation.Retention;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Describes the column to use as the multi-tenancy discriminator value for the entity.
+ *
+ * @author Steve Ebersole
+ */
+@java.lang.annotation.Target( TYPE )
+@Retention( RUNTIME )
+public @interface TenantColumn {
+ /**
+ * Name of the column to use.
+ */
+ public String name();
+
+ /**
+ * (Optional) The name of the table that contains the column. If absent the column is assumed to be in the
+ * primary table.
+ */
+ public String table() default "";
+
+ /**
+ * Names the Hibernate mapping type to use for mapping values to/from the specified column. Defaults to
+ * {@code "string"} which is a {@link String}/{@link java.sql.Types#VARCHAR VARCHAR} mapping.
+ */
+ public String type() default "string";
+
+ /**
+ * (Optional) The column length. (Applies only if a string-valued column is used.)
+ */
+ int length() default 255;
+
+ /**
+ * (Optional) The precision for a decimal (exact numeric) column. (Applies only if a decimal column is used.)
+ * Value must be set by developer if used when generating the DDL for the column.
+ */
+ int precision() default 0;
+
+ /**
+ * (Optional) The scale for a decimal (exact numeric) column. (Applies only if a decimal column is used.)
+ */
+ int scale() default 0;
+}
@@ -0,0 +1,44 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, 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.annotations;
+
+import java.lang.annotation.Retention;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Describes a formula fragment to use as the multi-tenancy discriminator value for the entity.
+ *
+ * @author Steve Ebersole
+ * @see Formula
+ */
+@java.lang.annotation.Target(TYPE)
+@Retention(RUNTIME)
+public @interface TenantFormula {
+ /**
+ * The formula fragment.
+ */
+ public String value();
+}
@@ -34,7 +34,7 @@
import org.hibernate.cfg.Environment;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService;
-import org.hibernate.internal.jaxb.cfg.JaxbHibernateConfiguration;
+import org.hibernate.jaxb.spi.cfg.JaxbHibernateConfiguration;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.ConfigLoader;
import org.hibernate.service.Service;
@@ -140,7 +140,8 @@
throw new StrategySelectionException(
"Implementation class [" + strategyRegistration.getStrategyImplementation().getName()
+ "] does not implement strategy interface ["
- + strategyRegistration.getStrategyRole().getName() + "]"
+ + strategyRegistration.getStrategyRole().getName() + "]",
+ strategyRegistration.getStrategyImplementation().getName()
);
}
explicitStrategyRegistrations.add( strategyRegistration );
@@ -126,7 +126,8 @@ public StrategySelectorImpl(ClassLoaderService classLoaderService) {
}
catch (ClassLoadingException e) {
throw new StrategySelectionException(
- "Unable to resolve name [" + name + "] as strategy [" + strategy.getName() + "]"
+ "Unable to resolve name [" + name + "] as strategy [" + strategy.getName() + "]",
+ name
);
}
}
@@ -161,7 +162,8 @@ public StrategySelectorImpl(ClassLoaderService classLoaderService) {
catch (Exception e) {
throw new StrategySelectionException(
String.format( "Could not instantiate named strategy class [%s]", implementationClass.getName() ),
- e
+ e,
+ implementationClass.getName()
);
}
}
Oops, something went wrong.

0 comments on commit 513f8ca

Please sign in to comment.