Hibernate SVN: r19382 - core/branches/Branch_3_3_2_GA_CP/distribution.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-06 07:21:23 -0400 (Thu, 06 May 2010)
New Revision: 19382
Modified:
core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
Log:
JBPAPP-4228 update pom to add source plugin and disable unnecessary sub-modules
Modified: core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-06 10:56:51 UTC (rev 19381)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-06 11:21:23 UTC (rev 19382)
@@ -87,11 +87,11 @@
<artifactId>hibernate-ehcache</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
+ <!-- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>hibernate-jbosscache</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency> -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>hibernate-jbosscache2</artifactId>
14 years, 8 months
Hibernate SVN: r19381 - in core/branches/Branch_3_3_2_GA_CP/distribution: src/assembly and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-06 06:56:51 -0400 (Thu, 06 May 2010)
New Revision: 19381
Removed:
core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/hibernate-all.xml
Modified:
core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml
Log:
JBPAPP-4228 update pom to add source plugin and disable unnecessary sub-modules
Modified: core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-06 10:31:32 UTC (rev 19380)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-06 10:56:51 UTC (rev 19381)
@@ -59,7 +59,6 @@
</executions>
<configuration>
<descriptors>
- <descriptor>src/assembly/hibernate-all.xml</descriptor>
<descriptor>src/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
@@ -118,7 +117,6 @@
<artifactId>hibernate-proxool</artifactId>
<version>${project.version}</version>
</dependency>
-
<!-- optional deps for bytecode providers since they are optional on core -->
<dependency>
<groupId>javassist</groupId>
@@ -131,7 +129,4 @@
<optional>true</optional>
</dependency>
</dependencies>
-
-
-
</project>
Modified: core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml 2010-05-06 10:31:32 UTC (rev 19380)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml 2010-05-06 10:56:51 UTC (rev 19381)
@@ -27,18 +27,9 @@
<assembly xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
-
- <!--
- Produces a dist-style bundle similar to what previous (non-mavenized) versions of
- Hibernate did.
- -->
-
- <!-- todo : still need to account for overall site stuff -->
-
<id>dist</id>
<formats>
<format>zip</format>
- <format>tar.gz</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
@@ -51,17 +42,54 @@
<source>../hibernate_logo.gif</source>
</file>
<file>
- <!-- todo : this should eventually become the release-notes bawany is working on -->
- <source>../changelog.txt</source>
+ <source>../cache-ehcache/target/hibernate-ehcache-${project.version}.jar</source>
+ <destName>hibernate-ehcache.jar</destName>
</file>
<file>
- <source>target/${project.artifactId}-${project.version}-all.jar</source>
- <destName>hibernate3.jar</destName>
+ <source>../cache-jbosscache2/target/hibernate-jbosscache2-${project.version}.jar</source>
+ <destName>hibernate-jbosscache2.jar</destName>
</file>
+
<file>
+ <source>../cache-oscache/target/hibernate-oscache-${project.version}.jar</source>
+ <destName>hibernate-oscache.jar</destName>
+ </file>
+ <file>
+ <source>../cache-swarmcache/target/hibernate-swarmcache-${project.version}.jar</source>
+ <destName>hibernate-swarmcache.jar</destName>
+ </file>
+ <file>
+ <source>../connection-c3p0/target/hibernate-c3p0-${project.version}.jar</source>
+ <destName>hibernate-c3p0.jar</destName>
+ </file>
+ <file>
+ <source>../connection-proxool/target/hibernate-proxool-${project.version}.jar</source>
+ <destName>hibernate-proxool.jar</destName>
+ </file>
+ <file>
+ <source>../core/target/hibernate-core-${project.version}.jar</source>
+ <destName>hibernate-core.jar</destName>
+ </file>
+ <file>
+ <source>../jdbc3-testing/target/hibernate-jdbc3-testing-${project.version}.jar</source>
+ <destName>hibernate-jdbc3-testing.jar</destName>
+ </file>
+ <file>
+ <source>../jdbc4-testing/target/hibernate-jdbc4-testing-${project.version}.jar</source>
+ <destName>hibernate-jdbc4-testing.jar</destName>
+ </file>
+ <file>
+ <source>../jmx/target/hibernate-jmx-${project.version}.jar</source>
+ <destName>hibernate-jmx.jar</destName>
+ </file>
+ <file>
<source>../testing/target/hibernate-testing-${project.version}.jar</source>
<destName>hibernate-testing.jar</destName>
</file>
+ <file>
+ <source>../testsuite/target/hibernate-testsuite-${project.version}.jar</source>
+ <destName>hibernate-testsuite.jar</destName>
+ </file>
</files>
<dependencySets>
@@ -69,81 +97,29 @@
<outputDirectory>lib/required</outputDirectory>
<includes>
<include>antlr:antlr</include>
-
<include>commons-collections:commons-collections</include>
-
<include>dom4j:dom4j</include>
-
<include>javassist:javassist</include>
-
<include>org.slf4j:slf4j-api</include>
-
<include>javax.transaction:jta</include>
</includes>
</dependencySet>
-
<dependencySet>
- <outputDirectory>lib/optional/c3p0</outputDirectory>
- <includes>
- <include>c3p0:c3p0</include>
- </includes>
- </dependencySet>
-
- <dependencySet>
- <outputDirectory>lib/optional/proxool</outputDirectory>
- <includes>
- <include>proxool:proxool</include>
- </includes>
- </dependencySet>
-
- <dependencySet>
- <outputDirectory>lib/optional/ehcache</outputDirectory>
- <includes>
- <include>net.sf.ehcache:ehcache</include>
- </includes>
- </dependencySet>
-
- <dependencySet>
- <outputDirectory>lib/optional/jbosscache</outputDirectory>
- <includes>
- <include>jboss:jboss-cache</include>
- <include>concurrent:concurrent:1.3.4</include>
- <include>jboss:jboss-common:4.0.2</include>
- <include>jboss:jboss-jmx:4.0.2</include>
- <include>jboss:jboss-system:4.0.2</include>
- <include>jgroups:jgroups-all:2.2.7</include>
- </includes>
- </dependencySet>
-
- <dependencySet>
<outputDirectory>lib/optional/jbosscache2</outputDirectory>
<includes>
<include>org.jboss.cache:jbosscache-core</include>
+ <include>jgroups:jgroups</include>
+ <include>org.jboss:jboss-common-core</include>
+ <include>org.jboss.logging:jboss-logging-spi</include>
</includes>
</dependencySet>
-
<dependencySet>
- <outputDirectory>lib/optional/oscache</outputDirectory>
- <includes>
- <include>opensymphony:oscache</include>
- </includes>
- </dependencySet>
-
- <dependencySet>
- <outputDirectory>lib/optional/swarmcache</outputDirectory>
- <includes>
- <include>swarmcache:swarmcache</include>
- </includes>
- </dependencySet>
-
- <dependencySet>
<outputDirectory>lib/bytecode/cglib</outputDirectory>
<includes>
<include>cglib:cglib</include>
<include>asm:asm</include>
</includes>
</dependencySet>
-
<dependencySet>
<outputDirectory>lib/bytecode/javassist</outputDirectory>
<includes>
@@ -167,28 +143,13 @@
<exclude>**/*.iws</exclude>
</excludes>
</fileSet>
- <!--
- Build the 'documentation/manual' directory containing the built
- reference manual documentation
- -->
<fileSet>
- <directory>../documentation/manual/target/docbook/publish/</directory>
- <outputDirectory>documentation/manual</outputDirectory>
+ <directory>..</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>.</outputDirectory>
<includes>
- <include>**/**</include>
- </includes>
+ <include>etc/*</include>
+ </includes>
</fileSet>
- <!--
- Build the 'documentation/jbosscache-guide' directory containing the built
- reference manual documentation
- -->
- <fileSet>
- <directory>../documentation/jbosscache2/target/docbook/publish/</directory>
- <outputDirectory>documentation/jbosscache-guide</outputDirectory>
- <includes>
- <include>**/**</include>
- </includes>
- </fileSet>
</fileSets>
-
</assembly>
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/hibernate-all.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/hibernate-all.xml 2010-05-06 10:31:32 UTC (rev 19380)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/hibernate-all.xml 2010-05-06 10:56:51 UTC (rev 19381)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ 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
- ~
- -->
-
-<assembly xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
-
- <!--
- Take the 'core' resoures and build a jar, ala the legacy hibernate3.jar
- -->
- <id>all</id>
- <formats>
- <format>jar</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
- <baseDirectory>hibernate-all</baseDirectory>
-
- <dependencySets>
- <dependencySet>
- <unpack>true</unpack>
- <includes>
- <include>org.hibernate:*</include>
- </includes>
- </dependencySet>
- </dependencySets>
-
-</assembly>
\ No newline at end of file
14 years, 8 months
Hibernate SVN: r19380 - in validator/trunk: hibernate-validator and 6 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-05-06 06:31:32 -0400 (Thu, 06 May 2010)
New Revision: 19380
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Author.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/AuthorBusinessRules.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/BookBusinessRules.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/JpaTraversableResolverTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/DummyTraversableResolver.java
Modified:
validator/trunk/hibernate-validator/pom.xml
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
validator/trunk/hibernate-validator/src/test/resources/log4j.properties
validator/trunk/pom.xml
Log:
HV-305 The call to is reachable should only be made for property level constraints. For class level constraints true should be returned.
Modified: validator/trunk/hibernate-validator/pom.xml
===================================================================
--- validator/trunk/hibernate-validator/pom.xml 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/hibernate-validator/pom.xml 2010-05-06 10:31:32 UTC (rev 19380)
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>hibernate-validator-parent</artifactId>
<groupId>org.hibernate</groupId>
@@ -81,6 +83,12 @@
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.5.0-Final</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<defaultGoal>test</defaultGoal>
@@ -189,7 +197,7 @@
</relocation>
</relocations>
<transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
</transformers>
</configuration>
</execution>
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -547,15 +547,15 @@
constraintValidatorFactory,
cachedTraversableResolver
);
- ValueContext<U, V> localContext = ValueContext.getLocalExecutionContext(
+ ValueContext<U, V> valueContext = ValueContext.getLocalExecutionContext(
hostingBeanInstance
);
- localContext.setPropertyPath( path );
- localContext.setCurrentGroup( groupClass );
- if ( isValidationRequired( context, localContext, metaConstraint ) ) {
- Object valueToValidate = metaConstraint.getValue( localContext.getCurrentBean() );
- localContext.setCurrentValidatedValue( ( V ) valueToValidate );
- metaConstraint.validateConstraint( context, localContext );
+ valueContext.setPropertyPath( path );
+ valueContext.setCurrentGroup( groupClass );
+ if ( isValidationRequired( context, valueContext, metaConstraint ) ) {
+ Object valueToValidate = metaConstraint.getValue( valueContext.getCurrentBean() );
+ valueContext.setCurrentValidatedValue( ( V ) valueToValidate );
+ metaConstraint.validateConstraint( context, valueContext );
failingConstraintViolations.addAll( context.getFailingConstraints() );
}
}
@@ -640,12 +640,12 @@
ValidationContext<U> context = ValidationContext.getContextForValidateValue(
beanType, messageInterpolator, constraintValidatorFactory, cachedTraversableResolver
);
- ValueContext<U, V> localContext = ValueContext.getLocalExecutionContext( beanType );
- localContext.setPropertyPath( path );
- localContext.setCurrentGroup( groupClass );
- localContext.setCurrentValidatedValue( value );
- if ( isValidationRequired( context, localContext, metaConstraint ) ) {
- metaConstraint.validateConstraint( context, localContext );
+ ValueContext<U, V> valueContext = ValueContext.getLocalExecutionContext( beanType );
+ valueContext.setPropertyPath( path );
+ valueContext.setCurrentGroup( groupClass );
+ valueContext.setCurrentValidatedValue( value );
+ if ( isValidationRequired( context, valueContext, metaConstraint ) ) {
+ metaConstraint.validateConstraint( context, valueContext );
failingConstraintViolations.addAll( context.getFailingConstraints() );
}
}
@@ -741,22 +741,22 @@
return new SingleThreadCachedTraversableResolver( traversableResolver );
}
- private boolean isValidationRequired(ValidationContext validationContext, ValueContext localContext, MetaConstraint metaConstraint) {
- if ( !metaConstraint.getGroupList().contains( localContext.getCurrentGroup() ) ) {
+ private boolean isValidationRequired(ValidationContext validationContext, ValueContext valueContext, MetaConstraint metaConstraint) {
+ if ( !metaConstraint.getGroupList().contains( valueContext.getCurrentGroup() ) ) {
return false;
}
boolean isReachable;
- Path pathToObject = localContext.getPropertyPath().getPathWithoutLeafNode();
+ Path pathToObject = valueContext.getPropertyPath().getPathWithoutLeafNode();
if ( pathToObject == null ) {
pathToObject = PathImpl.createNewPath( null );
}
try {
isReachable = validationContext.getTraversableResolver().isReachable(
- localContext.getCurrentBean(),
- localContext.getPropertyPath().getLeafNode(),
+ valueContext.getCurrentBean(),
+ valueContext.getPropertyPath().getLeafNode(),
validationContext.getRootBeanClass(),
pathToObject,
metaConstraint.getElementType()
@@ -769,20 +769,20 @@
return isReachable;
}
- private boolean isCascadeRequired(ValidationContext validationContext, ValueContext localContext, Member member) {
+ private boolean isCascadeRequired(ValidationContext validationContext, ValueContext valueContext, Member member) {
final ElementType type = member instanceof Field ? ElementType.FIELD : ElementType.METHOD;
boolean isReachable;
boolean isCascadable;
- Path pathToObject = localContext.getPropertyPath().getPathWithoutLeafNode();
+ Path pathToObject = valueContext.getPropertyPath().getPathWithoutLeafNode();
if ( pathToObject == null ) {
pathToObject = PathImpl.createNewPath( null );
}
try {
isReachable = validationContext.getTraversableResolver().isReachable(
- localContext.getCurrentBean(),
- localContext.getPropertyPath().getLeafNode(),
+ valueContext.getCurrentBean(),
+ valueContext.getPropertyPath().getLeafNode(),
validationContext.getRootBeanClass(),
pathToObject,
type
@@ -794,8 +794,8 @@
try {
isCascadable = validationContext.getTraversableResolver().isCascadable(
- localContext.getCurrentBean(),
- localContext.getPropertyPath().getLeafNode(),
+ valueContext.getCurrentBean(),
+ valueContext.getPropertyPath().getLeafNode(),
validationContext.getRootBeanClass(),
pathToObject,
type
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/resolver/JPATraversableResolver.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -19,19 +19,48 @@
import java.lang.annotation.ElementType;
import javax.persistence.Persistence;
+import javax.validation.Path;
import javax.validation.TraversableResolver;
-import javax.validation.Path;
+import org.slf4j.Logger;
+
+import org.hibernate.validator.util.LoggerFactory;
+
/**
+ * An implementation of {@code TraversableResolver} which is aware of JPA 2 and utilizes {@code PersistenceUtil} to get
+ * query the reachability of a property.
+ * This resolver will be automatically enabled if JPA 2 is on the classpath and the {@code DefaultTraversableResolver} is
+ * used.
+ *
* @author Hardy Ferentschik
* @author Emmanuel Bernard
*/
public class JPATraversableResolver implements TraversableResolver {
+ private static final Logger log = LoggerFactory.make();
- // we have to check traversableProperty.getName() against null to check the root gets validated (see HV-266)
- public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
- return traversableObject == null || traversableProperty.getName() == null || Persistence.getPersistenceUtil()
- .isLoaded( traversableObject, traversableProperty.getName() );
+ public boolean isReachable(Object traversableObject,
+ Path.Node traversableProperty,
+ Class<?> rootBeanType,
+ Path pathToTraversableObject,
+ ElementType elementType) {
+ if ( log.isTraceEnabled() ) {
+ log.trace(
+ "Calling isReachable on object {} with node name {}",
+ traversableObject,
+ traversableProperty.getName()
+ );
+ }
+
+ // we have to check traversableProperty.getName() against null to check the root gets validated (see HV-266)
+ // also check the element type, if it is ElementType.TYPE then we don't have to call is reachable since we have
+ // a class level constraint (HV-305)
+ if ( traversableObject == null || traversableProperty.getName() == null
+ || ElementType.TYPE.equals( elementType ) ) {
+ return true;
+ }
+ else {
+ return Persistence.getPersistenceUtil().isLoaded( traversableObject, traversableProperty.getName() );
+ }
}
public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Author.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Author.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Author.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -0,0 +1,42 @@
+// $Id:$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.validator.engine.traversableresolver;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Entity
+@AuthorBusinessRules
+public class Author {
+ @Id
+ public Long id;
+
+ @Valid
+ @OneToMany(mappedBy = "author")
+ public List<Book> books = new ArrayList<Book>();
+}
+
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Author.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/AuthorBusinessRules.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/AuthorBusinessRules.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/AuthorBusinessRules.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -0,0 +1,38 @@
+// $Id:$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.validator.engine.traversableresolver;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Constraint(validatedBy = {})
+@Documented
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface AuthorBusinessRules {
+ String message() default "";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/AuthorBusinessRules.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -0,0 +1,39 @@
+// $Id:$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.validator.engine.traversableresolver;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@BookBusinessRules
+@Entity
+public class Book {
+ @Id
+ public Long id;
+
+ @ManyToOne
+ @NotNull
+ public Author author;
+}
+
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/BookBusinessRules.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/BookBusinessRules.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/BookBusinessRules.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -0,0 +1,39 @@
+// $Id:$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.validator.engine.traversableresolver;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Constraint(validatedBy = {})
+@Documented
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface BookBusinessRules {
+ String message() default "";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/BookBusinessRules.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/JpaTraversableResolverTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/JpaTraversableResolverTest.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/JpaTraversableResolverTest.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -0,0 +1,67 @@
+// $Id:$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.validator.engine.traversableresolver;
+
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.engine.resolver.DefaultTraversableResolver;
+import org.hibernate.validator.util.TestUtil;
+
+import static org.testng.Assert.assertTrue;
+
+
+/**
+ * See HV-305
+ *
+ * @author Hardy Ferentschik
+ */
+public class JpaTraversableResolverTest {
+ private Validator validator;
+
+ @BeforeTest
+ public void setUp() {
+ Configuration<?> configuration = TestUtil.getConfiguration();
+ configuration.traversableResolver( new DefaultTraversableResolver() );
+ validator = configuration.buildValidatorFactory().getValidator();
+ }
+
+ @Test
+ public void testWithBooks() {
+ Author author = new Author();
+ author.books.add( new Book() );
+ Set<ConstraintViolation<Author>> results = validator.validate( author );
+ assertTrue( results.isEmpty() );
+ }
+
+ @Test
+ public void testWithoutBooks() {
+ Author author = new Author();
+
+ // If the "books" collection is empty, everything works as expected.
+ Set<ConstraintViolation<Author>> results = validator.validate( author );
+ assertTrue( results.isEmpty() );
+ }
+}
+
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/JpaTraversableResolverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/DummyTraversableResolver.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/DummyTraversableResolver.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/DummyTraversableResolver.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -0,0 +1,39 @@
+// $Id:$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hibernate.validator.util;
+
+import java.lang.annotation.ElementType;
+import javax.validation.Path;
+import javax.validation.TraversableResolver;
+
+/**
+ * A dummy traversable resolver which returns always {@code true}. This resolver is used by default by all test cases.
+ *
+ * @author Hardy Ferentschik
+ */
+public class DummyTraversableResolver implements TraversableResolver {
+ public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+ return true;
+ }
+
+ public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+ return true;
+ }
+}
+
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/DummyTraversableResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -33,14 +33,15 @@
import javax.validation.metadata.PropertyDescriptor;
import org.slf4j.Logger;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.FileAssert.fail;
import org.hibernate.validator.HibernateValidator;
import org.hibernate.validator.HibernateValidatorConfiguration;
import org.hibernate.validator.engine.PathImpl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.FileAssert.fail;
+
/**
* Tests for the <code>ReflectionHelper</code>.
*
@@ -57,6 +58,7 @@
public static Validator getValidator() {
if ( hibernateValidator == null ) {
Configuration configuration = getConfiguration();
+ configuration.traversableResolver( new DummyTraversableResolver() );
hibernateValidator = configuration.buildValidatorFactory().getValidator();
}
return hibernateValidator;
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/mixedconfiguration/InheritanceMappingsTest.java 2010-05-06 10:31:32 UTC (rev 19380)
@@ -25,13 +25,15 @@
import javax.validation.ValidatorFactory;
import javax.validation.constraints.NotNull;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.FileAssert.fail;
import org.testng.annotations.Test;
+import org.hibernate.validator.util.DummyTraversableResolver;
import org.hibernate.validator.util.TestUtil;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.FileAssert.fail;
+
/**
* See HV-265
*
@@ -43,7 +45,7 @@
public void defaultConfigurationNoExplicitAnnotationDefinition1() {
validateAnnotatedFixture(
new org.hibernate.validator.xml.mixedconfiguration.annotation.PersonCompetition(),
- configure()
+ TestUtil.getValidator()
);
}
@@ -51,7 +53,7 @@
public void defaultConfigurationNoExplicitAnnotationDefinition2() {
validateAnnotatedFixture(
new org.hibernate.validator.xml.mixedconfiguration.annotation.TeamCompetition(),
- configure()
+ TestUtil.getValidator()
);
}
@@ -87,12 +89,9 @@
);
}
- private Validator configure() {
- return TestUtil.getValidator();
- }
-
private Validator configure(String mappingsUrl) {
Configuration<?> configuration = TestUtil.getConfiguration();
+ configuration.traversableResolver( new DummyTraversableResolver() );
configuration.addMapping( InheritanceMappingsTest.class.getResourceAsStream( mappingsUrl ) );
ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
Modified: validator/trunk/hibernate-validator/src/test/resources/log4j.properties
===================================================================
--- validator/trunk/hibernate-validator/src/test/resources/log4j.properties 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/hibernate-validator/src/test/resources/log4j.properties 2010-05-06 10:31:32 UTC (rev 19380)
@@ -21,5 +21,6 @@
log4j.rootLogger=debug, stdout
log4j.logger.org.hibernate.validator.engine.ValidatorImpl=trace
+#log4j.logger.org.hibernate.validator.engine.resolver.JPATraversableResolver=trace
#log4j.logger.org.hibernate.validatorengine.ConstraintTree=trace
log4j.logger.org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator=info
Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml 2010-05-06 10:02:10 UTC (rev 19379)
+++ validator/trunk/pom.xml 2010-05-06 10:31:32 UTC (rev 19380)
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>${project.parent.version}</version>
+ <version>${version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
14 years, 8 months
Hibernate SVN: r19379 - validator/trunk/hibernate-validator/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-05-06 06:02:10 -0400 (Thu, 06 May 2010)
New Revision: 19379
Modified:
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
Log:
HV-319
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml 2010-05-06 07:59:34 UTC (rev 19378)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml 2010-05-06 10:02:10 UTC (rev 19379)
@@ -90,7 +90,7 @@
import java.lang.annotation.Target;
import javax.validation.Constraint;
-import javax.validation.ConstraintPayload;
+import javax.validation.Payload;
@Target( { METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@@ -138,8 +138,8 @@
a severity.</para>
<programlisting>public class Severity {
- public static class Info extends ConstraintPayload {};
- public static class Error extends ConstraintPayload {};
+ public static class Info extends Payload {};
+ public static class Error extends Payload {};
}
public class ContactDetails {
@@ -518,7 +518,7 @@
import java.lang.annotation.Target;
import javax.validation.Constraint;
-import javax.validation.ConstraintPayload;
+import javax.validation.Payload;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
14 years, 8 months
Hibernate SVN: r19378 - in core/branches/Branch_3_3_2_GA_CP: distribution and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-06 03:59:34 -0400 (Thu, 06 May 2010)
New Revision: 19378
Modified:
core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
core/branches/Branch_3_3_2_GA_CP/pom.xml
Log:
JBPAPP-4228 update pom to add source plugin and disable unnecessary sub-modules
Modified: core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-06 03:36:44 UTC (rev 19377)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-06 07:59:34 UTC (rev 19378)
@@ -44,21 +44,27 @@
<description>Builds the complete Hibernate distribution bundles</description>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <executions>
+ <execution>
+ <phase>install</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
<descriptors>
<descriptor>src/assembly/hibernate-all.xml</descriptor>
<descriptor>src/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
- </plugin>
- </plugins>
- </pluginManagement>
+ </plugin>
+ </plugins>
</build>
<!--
@@ -126,38 +132,6 @@
</dependency>
</dependencies>
- <profiles>
- <profile>
- <!--
- A profile used implicitly by the release plugin. Here we use
- it to implicitly execute assembly building when deploy is executed
- as part of release ( I think/hope :p )
- -->
- <id>release-profile</id>
- <activation>
- <property>
- <name>performRelease</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <executions>
- <execution>
- <phase>deploy</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+
</project>
Modified: core/branches/Branch_3_3_2_GA_CP/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/pom.xml 2010-05-06 03:36:44 UTC (rev 19377)
+++ core/branches/Branch_3_3_2_GA_CP/pom.xml 2010-05-06 07:59:34 UTC (rev 19378)
@@ -47,28 +47,20 @@
<module>parent</module>
<module>core</module>
<module>cache-ehcache</module>
- <!-- <module>cache-jbosscache</module> -->
<module>cache-jbosscache2</module>
<module>cache-oscache</module>
<module>cache-swarmcache</module>
<module>connection-c3p0</module>
<module>connection-proxool</module>
+ <module>jdbc4-testing</module>
+ <module>jdbc3-testing</module>
<module>jmx</module>
<module>testing</module>
<module>testsuite</module>
<module>tutorials</module>
- <!-- <module>hibernate-maven-plugin</module>
-
- Need to scope bytecode providers first...
- <module>bytecode-cglib</module>
- <module>bytecode-javassist</module>
--->
+ <module>distribution</module>
</modules>
- <!--
- Need to manually override this here as otherwise the release-plugin barfs trying to tag
- from Branch_3_3/hibernate (the artifactId of this aggregator module).
- -->
<scm>
<connection>scm:svn:https://svn.jboss.org/repos/hibernate/core/tags/hibernate-3.3.2.G...</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/hibernate/core/tags/hibernate-3.3.2.G...</developerConnection>
@@ -87,20 +79,4 @@
</plugin>
</plugins>
</build>
-
- <profiles>
- <profile>
- <id>docs</id>
- <activation>
- <property>
- <name>disableDistribution</name>
- <value>!true</value>
- </property>
- </activation>
- <modules>
- <module>documentation</module>
- <module>distribution</module>
- </modules>
- </profile>
- </profiles>
</project>
\ No newline at end of file
14 years, 8 months
Hibernate SVN: r19377 - in core/branches/Branch_3_3_2_GA_CP: parent and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-05 23:36:44 -0400 (Wed, 05 May 2010)
New Revision: 19377
Modified:
core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
core/branches/Branch_3_3_2_GA_CP/pom.xml
Log:
JBPAPP-4228 update pom to add source plugin and disable unnecessary sub-modules
Modified: core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-06 02:36:12 UTC (rev 19376)
+++ core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-06 03:36:44 UTC (rev 19377)
@@ -149,6 +149,18 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<!-- add specification/implementation details to the manifests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Modified: core/branches/Branch_3_3_2_GA_CP/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/pom.xml 2010-05-06 02:36:12 UTC (rev 19376)
+++ core/branches/Branch_3_3_2_GA_CP/pom.xml 2010-05-06 03:36:44 UTC (rev 19377)
@@ -47,7 +47,7 @@
<module>parent</module>
<module>core</module>
<module>cache-ehcache</module>
- <module>cache-jbosscache</module>
+ <!-- <module>cache-jbosscache</module> -->
<module>cache-jbosscache2</module>
<module>cache-oscache</module>
<module>cache-swarmcache</module>
@@ -57,8 +57,8 @@
<module>testing</module>
<module>testsuite</module>
<module>tutorials</module>
- <module>hibernate-maven-plugin</module>
- <!--
+ <!-- <module>hibernate-maven-plugin</module>
+
Need to scope bytecode providers first...
<module>bytecode-cglib</module>
<module>bytecode-javassist</module>
14 years, 8 months
Hibernate SVN: r19376 - in core/trunk/core/src/main/java/org/hibernate: type and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-05 22:36:12 -0400 (Wed, 05 May 2010)
New Revision: 19376
Modified:
core/trunk/core/src/main/java/org/hibernate/Hibernate.java
core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
Log:
HHH-5182 - Inject SessionFactory into "non-basic" Types
Modified: core/trunk/core/src/main/java/org/hibernate/Hibernate.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/Hibernate.java 2010-05-06 01:31:34 UTC (rev 19375)
+++ core/trunk/core/src/main/java/org/hibernate/Hibernate.java 2010-05-06 02:36:12 UTC (rev 19376)
@@ -34,6 +34,7 @@
import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.HibernateIterator;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.jdbc.NonContextualLobCreator;
import org.hibernate.engine.jdbc.LobCreationContext;
@@ -41,8 +42,10 @@
import org.hibernate.engine.jdbc.StreamUtils;
import org.hibernate.intercept.FieldInterceptionHelper;
import org.hibernate.intercept.FieldInterceptor;
+import org.hibernate.mapping.ManyToOne;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
+import org.hibernate.type.AnyType;
import org.hibernate.type.BigDecimalType;
import org.hibernate.type.BigIntegerType;
import org.hibernate.type.BinaryType;
@@ -61,6 +64,7 @@
import org.hibernate.type.IntegerType;
import org.hibernate.type.LocaleType;
import org.hibernate.type.LongType;
+import org.hibernate.type.ManyToOneType;
import org.hibernate.type.ObjectType;
import org.hibernate.type.SerializableType;
import org.hibernate.type.ShortType;
@@ -71,6 +75,7 @@
import org.hibernate.type.TimestampType;
import org.hibernate.type.TrueFalseType;
import org.hibernate.type.Type;
+import org.hibernate.type.TypeFactory;
import org.hibernate.type.YesNoType;
import org.hibernate.type.CharArrayType;
import org.hibernate.type.WrapperBinaryType;
@@ -78,6 +83,7 @@
import org.hibernate.type.MaterializedBlobType;
import org.hibernate.type.ImageType;
import org.hibernate.type.MaterializedClobType;
+import org.hibernate.usertype.CompositeUserType;
/**
* <ul>
@@ -293,7 +299,7 @@
*/
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type any(Type metaType, Type identifierType) {
- throw new HibernateException( "Not supported" );
+ return new AnyType( metaType, identifierType );
}
/**
@@ -301,11 +307,19 @@
*
* @deprecated Use {@link TypeHelper#entity} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
- @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration", "deprecation" })
public static Type entity(Class persistentClass) {
- throw new HibernateException( "Not supported" );
+ return entity( persistentClass.getName() );
}
+ private static class NoScope implements TypeFactory.TypeScope {
+ public static final NoScope INSTANCE = new NoScope();
+
+ public SessionFactoryImplementor resolveFactory() {
+ throw new HibernateException( "Cannot access SessionFactory from here" );
+ }
+ }
+
/**
* DO NOT USE!
*
@@ -313,7 +327,7 @@
*/
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type entity(String entityName) {
- throw new HibernateException( "Not supported" );
+ return new ManyToOneType( NoScope.INSTANCE, entityName );
}
/**
@@ -323,7 +337,7 @@
*/
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type custom(Class userTypeClass) {
- throw new HibernateException( "Not supported" );
+ return custom( userTypeClass, null );
}
/**
@@ -333,7 +347,17 @@
*/
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues) {
- throw new HibernateException( "Not supported" );
+ return custom( userTypeClass, toProperties( parameterNames, parameterValues ) ); }
+
+ private static Properties toProperties(String[] parameterNames, String[] parameterValues) {
+ if ( parameterNames == null || parameterNames.length == 0 ) {
+ return null;
+ }
+ Properties parameters = new Properties();
+ for ( int i = 0; i < parameterNames.length; i ++ ) {
+ parameters.put( parameterNames[i], parameterValues[i] );
+ }
+ return parameters;
}
/**
@@ -341,9 +365,14 @@
*
* @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
- @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration", "unchecked" })
public static Type custom(Class userTypeClass, Properties parameters) {
- throw new HibernateException( "Not supported" );
+ if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
+ return TypeFactory.customComponent( userTypeClass, parameters, NoScope.INSTANCE );
+ }
+ else {
+ return TypeFactory.custom( userTypeClass, parameters, NoScope.INSTANCE );
+ }
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-06 01:31:34 UTC (rev 19375)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-06 02:36:12 UTC (rev 19376)
@@ -122,7 +122,7 @@
}
}
- public void injectParameters(Object type, Properties parameters) {
+ public static void injectParameters(Object type, Properties parameters) {
if ( ParameterizedType.class.isInstance( type ) ) {
( (ParameterizedType) type ).setParameterValues(parameters);
}
@@ -132,6 +132,14 @@
}
public CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters) {
+ return customComponent( typeClass, parameters, typeScope );
+ }
+
+ /**
+ * @deprecated Only for use temporary use by {@link org.hibernate.Hibernate}
+ */
+ @SuppressWarnings({ "JavaDoc" })
+ public static CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters, TypeScope scope) {
try {
CompositeUserType userType = typeClass.newInstance();
injectParameters( userType, parameters );
@@ -163,6 +171,13 @@
}
public CustomType custom(Class<UserType> typeClass, Properties parameters) {
+ return custom( typeClass, parameters, typeScope );
+ }
+
+ /**
+ * @deprecated Only for use temporary use by {@link org.hibernate.Hibernate}
+ */
+ public static CustomType custom(Class<UserType> typeClass, Properties parameters, TypeScope scope) {
try {
UserType userType = typeClass.newInstance();
injectParameters( userType, parameters );
14 years, 8 months
Hibernate SVN: r19375 - core/trunk/core/src/main/java/org/hibernate/mapping.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-05 21:31:34 -0400 (Wed, 05 May 2010)
New Revision: 19375
Modified:
core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java
Log:
HHH-5182 - Inject SessionFactory into "non-basic" Types
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java 2010-05-06 01:05:26 UTC (rev 19374)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java 2010-05-06 01:31:34 UTC (rev 19375)
@@ -382,7 +382,9 @@
return getDefaultCollectionType();
}
else {
- return TypeFactory.customCollection( typeName, typeParameters, role, referencedPropertyName, isEmbedded() );
+ return mappings.getTypeResolver()
+ .getTypeFactory()
+ .customCollection( typeName, typeParameters, role, referencedPropertyName, isEmbedded() );
}
}
14 years, 8 months
Hibernate SVN: r19374 - in core/trunk: core/src/main/java/org/hibernate and 15 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-05 21:05:26 -0400 (Wed, 05 May 2010)
New Revision: 19374
Added:
core/trunk/core/src/main/java/org/hibernate/TypeHelper.java
core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
core/trunk/core/src/main/java/org/hibernate/Hibernate.java
core/trunk/core/src/main/java/org/hibernate/Session.java
core/trunk/core/src/main/java/org/hibernate/SessionFactory.java
core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java
core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java
core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java
core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java
core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java
core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java
core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java
core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java
core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java
core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java
core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java
core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java
core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java
core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java
core/trunk/core/src/main/java/org/hibernate/mapping/Any.java
core/trunk/core/src/main/java/org/hibernate/mapping/Array.java
core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java
core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java
core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java
core/trunk/core/src/main/java/org/hibernate/mapping/Column.java
core/trunk/core/src/main/java/org/hibernate/mapping/Component.java
core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java
core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java
core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java
core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java
core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java
core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java
core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java
core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java
core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java
core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java
core/trunk/core/src/main/java/org/hibernate/mapping/Index.java
core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java
core/trunk/core/src/main/java/org/hibernate/mapping/Join.java
core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java
core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java
core/trunk/core/src/main/java/org/hibernate/mapping/List.java
core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java
core/trunk/core/src/main/java/org/hibernate/mapping/Map.java
core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java
core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java
core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java
core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java
core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java
core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java
core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java
core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java
core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java
core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java
core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java
core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java
core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java
core/trunk/core/src/main/java/org/hibernate/mapping/Set.java
core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java
core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java
core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java
core/trunk/core/src/main/java/org/hibernate/mapping/Table.java
core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java
core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java
core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java
core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java
core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java
core/trunk/core/src/main/java/org/hibernate/mapping/Value.java
core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java
core/trunk/core/src/main/java/org/hibernate/mapping/package.html
core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java
core/trunk/core/src/main/java/org/hibernate/type/BagType.java
core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java
core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java
core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java
core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java
core/trunk/core/src/main/java/org/hibernate/type/EntityType.java
core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java
core/trunk/core/src/main/java/org/hibernate/type/ListType.java
core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java
core/trunk/core/src/main/java/org/hibernate/type/MapType.java
core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java
core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java
core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java
core/trunk/core/src/main/java/org/hibernate/type/SetType.java
core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java
core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java
core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java
core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java
core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java
core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java
Log:
HHH-5182 - Inject SessionFactory into "non-basic" Types
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -37,6 +37,6 @@
}
protected Collection createCollection(PersistentClass persistentClass) {
- return new org.hibernate.mapping.Bag( persistentClass );
+ return new org.hibernate.mapping.Bag( getMappings(), persistentClass );
}
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -163,6 +163,10 @@
private AccessType accessType;
private boolean hibernateExtensionMapping;
+ protected ExtendedMappings getMappings() {
+ return mappings;
+ }
+
public boolean isMap() {
return false;
}
@@ -700,7 +704,7 @@
) {
log.debug("Binding a OneToMany: {}.{} through a foreign key", propertyHolder.getEntityName(), propertyName);
- org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( collection.getOwner() );
+ org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( extendedMappings, collection.getOwner() );
collection.setElement( oneToMany );
oneToMany.setReferencedEntityName( collectionType.getName() );
oneToMany.setIgnoreNotFound( ignoreNotFound );
Modified: core/trunk/core/src/main/java/org/hibernate/Hibernate.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/Hibernate.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/Hibernate.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -26,7 +26,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import java.io.Serializable;
import java.io.ByteArrayOutputStream;
import java.sql.Blob;
import java.sql.Clob;
@@ -44,7 +43,6 @@
import org.hibernate.intercept.FieldInterceptor;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
-import org.hibernate.type.AnyType;
import org.hibernate.type.BigDecimalType;
import org.hibernate.type.BigIntegerType;
import org.hibernate.type.BinaryType;
@@ -56,16 +54,13 @@
import org.hibernate.type.CharacterType;
import org.hibernate.type.ClassType;
import org.hibernate.type.ClobType;
-import org.hibernate.type.CompositeCustomType;
import org.hibernate.type.CurrencyType;
-import org.hibernate.type.CustomType;
import org.hibernate.type.DateType;
import org.hibernate.type.DoubleType;
import org.hibernate.type.FloatType;
import org.hibernate.type.IntegerType;
import org.hibernate.type.LocaleType;
import org.hibernate.type.LongType;
-import org.hibernate.type.ManyToOneType;
import org.hibernate.type.ObjectType;
import org.hibernate.type.SerializableType;
import org.hibernate.type.ShortType;
@@ -76,7 +71,6 @@
import org.hibernate.type.TimestampType;
import org.hibernate.type.TrueFalseType;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
import org.hibernate.type.YesNoType;
import org.hibernate.type.CharArrayType;
import org.hibernate.type.WrapperBinaryType;
@@ -84,7 +78,6 @@
import org.hibernate.type.MaterializedBlobType;
import org.hibernate.type.ImageType;
import org.hibernate.type.MaterializedClobType;
-import org.hibernate.usertype.CompositeUserType;
/**
* <ul>
@@ -281,83 +274,76 @@
/**
* A Hibernate <tt>serializable</tt> type.
+ *
+ * @param serializableClass The {@link java.io.Serializable} implementor class.
+ *
+ * @return
+ *
* @deprecated Use {@link SerializableType#SerializableType} instead.
*/
+ @SuppressWarnings({ "unchecked" })
public static Type serializable(Class serializableClass) {
return new SerializableType( serializableClass );
}
/**
- * A Hibernate <tt>any</tt> type.
+ * DO NOT USE!
*
- * @param metaType a type mapping <tt>java.lang.Class</tt> to a single column
- * @param identifierType the entity identifier type
- * @return the Type
+ * @deprecated Use {@link TypeHelper#any} instead.
*/
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type any(Type metaType, Type identifierType) {
- return new AnyType( metaType, identifierType );
+ throw new HibernateException( "Not supported" );
}
/**
- * A Hibernate persistent object (entity) type.
+ * DO NOT USE!
*
- * @param persistentClass a mapped entity class
+ * @deprecated Use {@link TypeHelper#entity} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type entity(Class persistentClass) {
- // not really a many-to-one association *necessarily*
- return new ManyToOneType( persistentClass.getName() );
+ throw new HibernateException( "Not supported" );
}
/**
- * A Hibernate persistent object (entity) type.
+ * DO NOT USE!
*
- * @param entityName a mapped entity class
+ * @deprecated Use {@link TypeHelper#entity} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
public static Type entity(String entityName) {
- // not really a many-to-one association *necessarily*
- return new ManyToOneType( entityName );
+ throw new HibernateException( "Not supported" );
}
/**
- * A Hibernate custom type.
+ * DO NOT USE!
*
- * @param userTypeClass a class that implements <tt>UserType</tt>
+ * @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
- public static Type custom(Class userTypeClass) throws HibernateException {
- return custom( userTypeClass, null );
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
+ public static Type custom(Class userTypeClass) {
+ throw new HibernateException( "Not supported" );
}
/**
- * A Hibernate parameterizable custom type.
+ * DO NOT USE!
*
- * @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
- * @param parameterNames the names of the parameters passed to the type
- * @param parameterValues the values of the parameters passed to the type. They must match
- * up with the order and length of the parameterNames array.
+ * @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
- public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues)
- throws HibernateException {
- Properties parameters = new Properties();
- for ( int i = 0; i < parameterNames.length; i++ ) {
- parameters.setProperty( parameterNames[i], parameterValues[i] );
- }
- return custom( userTypeClass, parameters );
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
+ public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues) {
+ throw new HibernateException( "Not supported" );
}
/**
- * A Hibernate parameterizable custom type.
+ * DO NOT USE!
*
- * @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
- * @param parameters the parameters as a collection of name/value pairs
+ * @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
- public static Type custom(Class userTypeClass, Properties parameters)
- throws HibernateException {
- if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
- return TypeFactory.customComponent( userTypeClass, parameters );
- }
- else {
- return TypeFactory.custom( userTypeClass, parameters );
- }
+ @SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
+ public static Type custom(Class userTypeClass, Properties parameters) {
+ throw new HibernateException( "Not supported" );
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/Session.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/Session.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/Session.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -995,20 +995,26 @@
*/
public void disableFetchProfile(String name) throws UnknownProfileException;
+ /**
+ * Convenience access to the {@link TypeHelper} associated with this session's {@link SessionFactory}.
+ * <p/>
+ * Equivalent to calling {@link #getSessionFactory()}.{@link SessionFactory#getTypeHelper getTypeHelper()}
+ *
+ * @return The {@link TypeHelper} associated with this session's {@link SessionFactory}
+ */
+ public TypeHelper getTypeHelper();
-/**
- * Contains locking details (LockMode, Timeout and Scope).
- *
- */
- public interface LockRequest
- {
-
+ /**
+ * Contains locking details (LockMode, Timeout and Scope).
+ */
+ public interface LockRequest {
static final int PESSIMISTIC_NO_WAIT = 0;
static final int PESSIMISTIC_WAIT_FOREVER = -1;
-
+
/**
* Get the lock mode.
+ *
* @return the lock mode.
*/
LockMode getLockMode();
@@ -1017,6 +1023,7 @@
* Specify the LockMode to be used. The default is LockMode.none.
*
* @param lockMode
+ *
* @return this LockRequest instance for operation chaining.
*/
LockRequest setLockMode(LockMode lockMode);
@@ -1033,12 +1040,14 @@
* The default pessimistic lock behavior is to wait forever for the lock.
*
* @param timeout is time in milliseconds to wait for lock. -1 means wait forever and 0 means no wait.
+ *
* @return this LockRequest instance for operation chaining.
*/
LockRequest setTimeOut(int timeout);
/**
* Check if locking is cascaded to owned collections and relationships.
+ *
* @return true if locking will be extended to owned collections and relationships.
*/
boolean getScope();
@@ -1048,6 +1057,7 @@
* The association must be mapped with <tt>cascade="lock" for scope=true to work.
*
* @param scope
+ *
* @return
*/
LockRequest setScope(boolean scope);
@@ -1055,7 +1065,5 @@
void lock(String entityName, Object object) throws HibernateException;
public void lock(Object object) throws HibernateException;
-
}
-
}
Modified: core/trunk/core/src/main/java/org/hibernate/SessionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/SessionFactory.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/SessionFactory.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -386,4 +386,11 @@
* @return True if there is such a fetch profile; false otherwise.
*/
public boolean containsFetchProfileDefinition(String name);
+
+ /**
+ * Retrieve this factory's {@link TypeHelper}
+ *
+ * @return The factory's {@link TypeHelper}
+ */
+ public TypeHelper getTypeHelper();
}
Added: core/trunk/core/src/main/java/org/hibernate/TypeHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/TypeHelper.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/TypeHelper.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -0,0 +1,112 @@
+/*
+ * 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;
+
+import java.util.Properties;
+
+import org.hibernate.type.BasicType;
+import org.hibernate.type.Type;
+
+/**
+ * Provides access to the various {@link Type} instances associated with the {@link SessionFactory}.
+ * <p/>
+ * This is intended for use by application developers.
+ *
+ * @author Steve Ebersole
+ */
+public interface TypeHelper {
+ /**
+ * Retrieve the basic type registered against the given name.
+ *
+ * @param name The name of the basic type to retrieve
+ *
+ * @return The basic type, or null.
+ */
+ public BasicType basic(String name);
+
+ /**
+ * Convenience form of {@link #basic(String)}. The intended use of this is something like
+ * {@code basic(Integer.class)} or {@code basic(int.class)}
+ *
+ * @param javaType The java type for which to retrieve the type instance.
+ *
+ * @return The basic type, or null.
+ */
+ public BasicType basic(Class javaType);
+
+ /**
+ * Uses heuristics to deduce the proper {@link Type} given a string naming the type or Java class.
+ * <p/>
+ * See {@link org.hibernate.type.TypeResolver#heuristicType(java.lang.String)} for a discussion of the
+ * heuristic algorithm.
+ *
+ * @param name The name of the type or Java class
+ *
+ * @return The deduced type, or null.
+ *
+ * @see org.hibernate.type.TypeResolver#heuristicType(java.lang.String)
+ */
+ public Type heuristicType(String name);
+
+ /**
+ * Retrieve a type representing the given entity.
+ *
+ * @param entityClass The entity Java type.
+ *
+ * @return The type, or null
+ */
+ public Type entity(Class entityClass);
+
+ /**
+ * Retrieve a type representing the given entity.
+ *
+ * @param entityName The entity name.
+ *
+ * @return The type, or null
+ */
+ public Type entity(String entityName);
+
+ /**
+ * Retrieve the type for the given user-type class ({@link org.hibernate.usertype.UserType} or
+ * {@link org.hibernate.usertype.CompositeUserType}).
+ *
+ * @param userTypeClass The user type class
+ *
+ * @return The type, or null
+ */
+ public Type custom(Class userTypeClass);
+
+ /**
+ * Retrieve the type for the given user-type class ({@link org.hibernate.usertype.UserType} or
+ * {@link org.hibernate.usertype.CompositeUserType}).
+ *
+ * @param userTypeClass The user type class
+ * @param properties Configuration properties.
+ *
+ * @return The type, or null
+ */
+ public Type custom(Class userTypeClass, Properties properties);
+
+ public Type any(Type metaType, Type identifierType);
+}
Modified: core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.action;
@@ -43,7 +42,7 @@
import org.hibernate.event.PreUpdateEventListener;
import org.hibernate.event.EventSource;
import org.hibernate.persister.entity.EntityPersister;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
public final class EntityUpdateAction extends EntityAction {
private final Object[] state;
@@ -133,7 +132,7 @@
// get the updated snapshot of the entity state by cloning current state;
// it is safe to copy in place, since by this time no-one else (should have)
// has a reference to the array
- TypeFactory.deepCopy(
+ TypeHelper.deepCopy(
state,
persister.getPropertyTypes(),
persister.getPropertyCheckability(),
Modified: core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.cache;
@@ -38,7 +37,7 @@
import org.hibernate.cfg.Settings;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
/**
* The standard implementation of the Hibernate QueryCache interface. This
@@ -78,6 +77,7 @@
this.updateTimestampsCache = updateTimestampsCache;
}
+ @SuppressWarnings({ "UnnecessaryBoxing", "unchecked" })
public boolean put(
QueryKey key,
Type[] returnTypes,
@@ -88,7 +88,7 @@
return false;
}
else {
- Long ts = new Long( session.getTimestamp() );
+ Long ts = Long.valueOf( session.getTimestamp() );
if ( log.isDebugEnabled() ) {
log.debug( "caching query results in region: " + cacheRegion.getName() + "; timestamp=" + ts );
@@ -96,27 +96,23 @@
List cacheable = new ArrayList( result.size() + 1 );
cacheable.add( ts );
- for ( int i = 0; i < result.size(); i++ ) {
+ for ( Object aResult : result ) {
if ( returnTypes.length == 1 ) {
- cacheable.add( returnTypes[0].disassemble( result.get( i ), session, null ) );
+ cacheable.add( returnTypes[0].disassemble( aResult, session, null ) );
}
else {
cacheable.add(
- TypeFactory.disassemble(
- ( Object[] ) result.get( i ), returnTypes, null, session, null
- )
+ TypeHelper.disassemble( (Object[]) aResult, returnTypes, null, session, null )
);
}
}
cacheRegion.put( key, cacheable );
-
return true;
-
}
-
}
+ @SuppressWarnings({ "unchecked" })
public List get(
QueryKey key,
Type[] returnTypes,
@@ -145,7 +141,7 @@
returnTypes[0].beforeAssemble( ( Serializable ) cacheable.get( i ), session );
}
else {
- TypeFactory.beforeAssemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session );
+ TypeHelper.beforeAssemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session );
}
}
List result = new ArrayList( cacheable.size() - 1 );
@@ -156,9 +152,7 @@
}
else {
result.add(
- TypeFactory.assemble(
- ( Serializable[] ) cacheable.get( i ), returnTypes, session, null
- )
+ TypeHelper.assemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session, null )
);
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.cache.entry;
@@ -34,7 +33,7 @@
import org.hibernate.event.PreLoadEvent;
import org.hibernate.event.PreLoadEventListener;
import org.hibernate.persister.entity.EntityPersister;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
import org.hibernate.util.ArrayHelper;
/**
@@ -66,7 +65,7 @@
final Object owner)
throws HibernateException {
//disassembled state gets put in a new array (we write to cache by value!)
- this.disassembledState = TypeFactory.disassemble(
+ this.disassembledState = TypeHelper.disassemble(
state,
persister.getPropertyTypes(),
persister.isLazyPropertiesCacheable() ?
@@ -112,11 +111,10 @@
final Serializable id,
final EntityPersister persister,
final Interceptor interceptor,
- final EventSource session)
- throws HibernateException {
+ final EventSource session) throws HibernateException {
//assembled state gets put in a new array (we read from cache by value!)
- Object[] assembledProps = TypeFactory.assemble(
+ Object[] assembledProps = TypeHelper.assemble(
values,
persister.getPropertyTypes(),
session, result
@@ -132,8 +130,8 @@
.setPersister(persister);
PreLoadEventListener[] listeners = session.getListeners().getPreLoadEventListeners();
- for ( int i = 0; i < listeners.length; i++ ) {
- listeners[i].onPreLoad(preLoadEvent);
+ for ( PreLoadEventListener listener : listeners ) {
+ listener.onPreLoad( preLoadEvent );
}
persister.setPropertyValues(
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -132,6 +132,7 @@
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.tool.hbm2ddl.TableMetadata;
import org.hibernate.tool.hbm2ddl.IndexMetadata;
+import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.SerializationException;
import org.hibernate.type.Type;
@@ -2286,6 +2287,10 @@
return typeResolver;
}
+ public void registerTypeOverride(BasicType type) {
+ getTypeResolver().registerTypeOverride( type );
+ }
+
public SessionFactoryObserver getSessionFactoryObserver() {
return sessionFactoryObserver;
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1440,7 +1440,7 @@
Element oneToManyNode = node.element( "one-to-many" );
if ( oneToManyNode != null ) {
- OneToMany oneToMany = new OneToMany( collection.getOwner() );
+ OneToMany oneToMany = new OneToMany( mappings, collection.getOwner() );
collection.setElement( oneToMany );
bindOneToMany( oneToManyNode, oneToMany, mappings );
// we have to set up the table later!! yuck
@@ -2840,7 +2840,7 @@
private static final CollectionType MAP = new CollectionType( "map" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- Map map = new Map( owner );
+ Map map = new Map( mappings, owner );
bindCollection( node, map, owner.getEntityName(), path, mappings, inheritedMetas );
return map;
}
@@ -2848,7 +2848,7 @@
private static final CollectionType SET = new CollectionType( "set" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- Set set = new Set( owner );
+ Set set = new Set( mappings, owner );
bindCollection( node, set, owner.getEntityName(), path, mappings, inheritedMetas );
return set;
}
@@ -2856,7 +2856,7 @@
private static final CollectionType LIST = new CollectionType( "list" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- List list = new List( owner );
+ List list = new List( mappings, owner );
bindCollection( node, list, owner.getEntityName(), path, mappings, inheritedMetas );
return list;
}
@@ -2864,7 +2864,7 @@
private static final CollectionType BAG = new CollectionType( "bag" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- Bag bag = new Bag( owner );
+ Bag bag = new Bag( mappings, owner );
bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas );
return bag;
}
@@ -2872,7 +2872,7 @@
private static final CollectionType IDBAG = new CollectionType( "idbag" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- IdentifierBag bag = new IdentifierBag( owner );
+ IdentifierBag bag = new IdentifierBag( mappings, owner );
bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas );
return bag;
}
@@ -2880,7 +2880,7 @@
private static final CollectionType ARRAY = new CollectionType( "array" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- Array array = new Array( owner );
+ Array array = new Array( mappings, owner );
bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas );
return array;
}
@@ -2888,7 +2888,7 @@
private static final CollectionType PRIMITIVE_ARRAY = new CollectionType( "primitive-array" ) {
public Collection create(Element node, String path, PersistentClass owner,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
- PrimitiveArray array = new PrimitiveArray( owner );
+ PrimitiveArray array = new PrimitiveArray( mappings, owner );
bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas );
return array;
}
Modified: core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.engine;
@@ -44,7 +43,7 @@
import org.hibernate.pretty.MessageHelper;
import org.hibernate.property.BackrefPropertyAccessor;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
/**
* Functionality relating to Hibernate's two-phase loading process,
@@ -211,13 +210,13 @@
}
else {
//take a snapshot
- TypeFactory.deepCopy(
+ TypeHelper.deepCopy(
hydratedState,
persister.getPropertyTypes(),
persister.getPropertyUpdateability(),
hydratedState, //after setting values to object, entityMode
session
- );
+ );
persistenceContext.setEntryStatus(entityEntry, Status.MANAGED);
}
Modified: core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.event.def;
@@ -38,7 +37,7 @@
import org.hibernate.event.EventSource;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
/**
* A convenience base class for listeners that respond to requests to reassociate an entity
@@ -77,7 +76,7 @@
//get a snapshot
Object[] values = persister.getPropertyValues( object, source.getEntityMode() );
- TypeFactory.deepCopy(
+ TypeHelper.deepCopy(
values,
persister.getPropertyTypes(),
persister.getPropertyUpdateability(),
Modified: core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.event.def;
@@ -53,7 +52,7 @@
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
/**
* A convenience bas class for listeners responding to save events.
@@ -300,7 +299,7 @@
persister.setPropertyValues( entity, values, source.getEntityMode() );
}
- TypeFactory.deepCopy(
+ TypeHelper.deepCopy(
values,
types,
persister.getPropertyUpdateability(),
Modified: core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.event.def;
@@ -34,7 +33,6 @@
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.TransientObjectException;
-import org.hibernate.util.IdentitySet;
import org.hibernate.action.EntityDeleteAction;
import org.hibernate.classic.Lifecycle;
import org.hibernate.engine.Cascade;
@@ -51,7 +49,8 @@
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
+import org.hibernate.util.IdentitySet;
/**
* Defines the default delete event listener used by hibernate for deleting entities
@@ -299,7 +298,7 @@
// TypeFactory.deepCopy( currentState, propTypes, persister.getPropertyUpdateability(), deletedState, session );
boolean[] copyability = new boolean[propTypes.length];
java.util.Arrays.fill( copyability, true );
- TypeFactory.deepCopy( currentState, propTypes, copyability, deletedState, session );
+ TypeHelper.deepCopy( currentState, propTypes, copyability, deletedState, session );
return deletedState;
}
Modified: core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -56,7 +56,7 @@
import org.hibernate.type.EmbeddedComponentType;
import org.hibernate.type.EntityType;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
/**
* Defines the default load event listeners used by hibernate for loading entities
@@ -648,13 +648,13 @@
Type[] types = subclassPersister.getPropertyTypes();
Object[] values = entry.assemble( result, id, subclassPersister, session.getInterceptor(), session ); // intializes result by side-effect
- TypeFactory.deepCopy(
+ TypeHelper.deepCopy(
values,
types,
subclassPersister.getPropertyUpdateability(),
values,
session
- );
+ );
Object version = Versioning.getVersion( values, subclassPersister );
if ( log.isTraceEnabled() ) log.trace( "Cached Version: " + version );
Modified: core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -55,8 +55,8 @@
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.type.ForeignKeyDirection;
-import org.hibernate.type.TypeFactory;
import org.hibernate.type.Type;
+import org.hibernate.type.TypeHelper;
/**
* Defines the default copy event listener used by hibernate for copying entities
@@ -492,7 +492,7 @@
final SessionImplementor source,
final Map copyCache
) {
- final Object[] copiedValues = TypeFactory.replace(
+ final Object[] copiedValues = TypeHelper.replace(
persister.getPropertyValues( entity, source.getEntityMode() ),
persister.getPropertyValues( target, source.getEntityMode() ),
persister.getPropertyTypes(),
@@ -518,7 +518,7 @@
// this is the second pass through on a merge op, so here we limit the
// replacement to associations types (value types were already replaced
// during the first pass)
- copiedValues = TypeFactory.replaceAssociations(
+ copiedValues = TypeHelper.replaceAssociations(
persister.getPropertyValues( entity, source.getEntityMode() ),
persister.getPropertyValues( target, source.getEntityMode() ),
persister.getPropertyTypes(),
@@ -529,7 +529,7 @@
);
}
else {
- copiedValues = TypeFactory.replace(
+ copiedValues = TypeHelper.replace(
persister.getPropertyValues( entity, source.getEntityMode() ),
persister.getPropertyValues( target, source.getEntityMode() ),
persister.getPropertyTypes(),
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -117,7 +117,10 @@
public Type getSelectType() {
if (entityType==null) return null;
boolean shallow = fromElement.getFromClause().getWalker().isShallowQuery();
- return TypeFactory.manyToOne( entityType.getAssociatedEntityName(), shallow );
+ return fromElement.getSessionFactoryHelper()
+ .getFactory()
+ .getTypeResolver()
+ .getTypeFactory().manyToOne( entityType.getAssociatedEntityName(), shallow );
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -113,7 +113,7 @@
q.addType( currentName, entityName );
Queryable classPersister = q.getEntityPersister( entityName );
//QueryJoinFragment join = q.createJoinFragment(useThetaStyleJoin);
- addJoin( currentName, TypeFactory.manyToOne( entityName ), joinColumns );
+ addJoin( currentName, q.getFactory().getTypeResolver().getTypeFactory().manyToOne( entityName ), joinColumns );
currentPropertyMapping = classPersister;
return currentName;
}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -662,7 +662,9 @@
int j = 0;
for ( int i = 0; i < persisters.length; i++ ) {
if ( includeInSelect[i] ) {
- actualReturnTypes[j++] = TypeFactory.manyToOne( persisters[i].getEntityName(), shallowQuery );
+ actualReturnTypes[j++] = getFactory().getTypeResolver()
+ .getTypeFactory()
+ .manyToOne( persisters[i].getEntityName(), shallowQuery );
}
}
}
@@ -719,7 +721,9 @@
int size = returnedTypes.size();
for ( int k = 0; k < size; k++ ) {
- scalarTypes.add( TypeFactory.manyToOne( persisters[k].getEntityName(), shallowQuery ) );
+ scalarTypes.add(
+ getFactory().getTypeResolver().getTypeFactory().manyToOne( persisters[k].getEntityName(), shallowQuery )
+ );
String[] idColumnNames = persisters[k].getIdentifierColumnNames();
for ( int i = 0; i < idColumnNames.length; i++ ) {
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -62,6 +62,7 @@
import org.hibernate.SessionFactoryObserver;
import org.hibernate.EntityNameResolver;
import org.hibernate.Cache;
+import org.hibernate.TypeHelper;
import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.cache.CacheKey;
import org.hibernate.cache.CollectionRegion;
@@ -114,7 +115,6 @@
import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.stat.Statistics;
import org.hibernate.stat.StatisticsImpl;
-import org.hibernate.stat.ConcurrentStatisticsImpl;
import org.hibernate.stat.StatisticsImplementor;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
@@ -191,6 +191,7 @@
private final transient Cache cacheAccess = new CacheImpl();
private transient boolean isClosed = false;
private final transient TypeResolver typeResolver;
+ private final transient TypeHelper typeHelper;
public SessionFactoryImpl(
Configuration cfg,
@@ -234,6 +235,7 @@
};
this.typeResolver = cfg.getTypeResolver().scope( this );
+ this.typeHelper = new TypeLocatorImpl( typeResolver );
this.filters = new HashMap();
this.filters.putAll( cfg.getFilterDefinitions() );
@@ -1302,6 +1304,10 @@
return ( FetchProfile ) fetchProfiles.get( name );
}
+ public TypeHelper getTypeHelper() {
+ return typeHelper;
+ }
+
/**
* Custom serialization hook used during Session serialization.
*
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -66,6 +66,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.TransientObjectException;
+import org.hibernate.TypeHelper;
import org.hibernate.UnresolvableObjectException;
import org.hibernate.UnknownProfileException;
import org.hibernate.EntityNameResolver;
@@ -2213,6 +2214,13 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public TypeHelper getTypeHelper() {
+ return getSessionFactory().getTypeHelper();
+ }
+
private class CoordinatingEntityNameResolver implements EntityNameResolver {
public String resolveEntityName(Object entity) {
String entityName = interceptor.getEntityName( entity );
Added: core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -0,0 +1,186 @@
+/*
+ * 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.impl;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import org.hibernate.TypeHelper;
+import org.hibernate.type.BasicType;
+import org.hibernate.type.Type;
+import org.hibernate.type.TypeResolver;
+import org.hibernate.usertype.CompositeUserType;
+
+/**
+ * Implementation of {@link org.hibernate.TypeHelper}
+ *
+ * @todo Do we want to cache the results of {@link #entity}, {@link #custom} and {@link #any} ?
+ *
+ * @author Steve Ebersole
+ */
+public class TypeLocatorImpl implements TypeHelper, Serializable {
+ private final TypeResolver typeResolver;
+
+ public TypeLocatorImpl(TypeResolver typeResolver) {
+ this.typeResolver = typeResolver;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BasicType basic(String name) {
+ return typeResolver.basic( name );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BasicType basic(Class javaType) {
+ BasicType type = typeResolver.basic( javaType.getName() );
+ if ( type == null ) {
+ final Class variant = resolvePrimitiveOrPrimitiveWrapperVariantJavaType( javaType );
+ if ( variant != null ) {
+ type = typeResolver.basic( variant.getName() );
+ }
+ }
+ return type;
+ }
+
+ private Class resolvePrimitiveOrPrimitiveWrapperVariantJavaType(Class javaType) {
+ // boolean
+ if ( Boolean.TYPE.equals( javaType ) ) {
+ return Boolean.class;
+ }
+ if ( Boolean.class.equals( javaType ) ) {
+ return Boolean.TYPE;
+ }
+
+ // char
+ if ( Character.TYPE.equals( javaType ) ) {
+ return Character.class;
+ }
+ if ( Character.class.equals( javaType ) ) {
+ return Character.TYPE;
+ }
+
+ // byte
+ if ( Byte.TYPE.equals( javaType ) ) {
+ return Byte.class;
+ }
+ if ( Byte.class.equals( javaType ) ) {
+ return Byte.TYPE;
+ }
+
+ // short
+ if ( Short.TYPE.equals( javaType ) ) {
+ return Short.class;
+ }
+ if ( Short.class.equals( javaType ) ) {
+ return Short.TYPE;
+ }
+
+ // int
+ if ( Integer.TYPE.equals( javaType ) ) {
+ return Integer.class;
+ }
+ if ( Integer.class.equals( javaType ) ) {
+ return Integer.TYPE;
+ }
+
+ // long
+ if ( Long.TYPE.equals( javaType ) ) {
+ return Long.class;
+ }
+ if ( Long.class.equals( javaType ) ) {
+ return Long.TYPE;
+ }
+
+ // float
+ if ( Float.TYPE.equals( javaType ) ) {
+ return Float.class;
+ }
+ if ( Float.class.equals( javaType ) ) {
+ return Float.TYPE;
+ }
+
+ // double
+ if ( Double.TYPE.equals( javaType ) ) {
+ return Double.class;
+ }
+ if ( Double.class.equals( javaType ) ) {
+ return Double.TYPE;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Type heuristicType(String name) {
+ return typeResolver.heuristicType( name );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Type entity(Class entityClass) {
+ return entity( entityClass.getName() );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Type entity(String entityName) {
+ return typeResolver.getTypeFactory().manyToOne( entityName );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public Type custom(Class userTypeClass) {
+ return custom( userTypeClass, null );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public Type custom(Class userTypeClass, Properties parameters) {
+ if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
+ return typeResolver.getTypeFactory().customComponent( userTypeClass, parameters );
+ }
+ else {
+ return typeResolver.getTypeFactory().custom( userTypeClass, parameters );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Type any(Type metaType, Type identifierType) {
+ return typeResolver.getTypeFactory().any( metaType, identifierType );
+ }
+}
Modified: core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -109,7 +109,7 @@
);
}
else {
- resultTypes = new Type[] { TypeFactory.manyToOne( persister.getEntityName() ) };
+ resultTypes = new Type[] { factory.getTypeResolver().getTypeFactory().manyToOne( persister.getEntityName() ) };
initAll( translator.getWhereCondition(), translator.getOrderBy(), LockOptions.NONE );
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Any.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Any.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Any.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -55,7 +55,8 @@
public Type getType() throws MappingException {
final Type metaType = getMappings().getTypeResolver().heuristicType( metaTypeName );
- return new AnyType(
+
+ return getMappings().getTypeResolver().getTypeFactory().any(
metaValues == null ? metaType : new MetaType( metaValues, metaType ),
getMappings().getTypeResolver().heuristicType( identifierTypeName )
);
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Array.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Array.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Array.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,31 +20,27 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.type.CollectionType;
import org.hibernate.type.PrimitiveType;
import org.hibernate.type.TypeFactory;
import org.hibernate.util.ReflectHelper;
/**
- * An array mapping has a primary key consisting of
- * the key columns + index column.
+ * An array mapping has a primary key consisting of the key columns + index column.
+ *
* @author Gavin King
*/
public class Array extends List {
private String elementClassName;
- /**
- * Constructor for Array.
- * @param owner
- */
- public Array(PersistentClass owner) {
- super(owner);
+ public Array(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public Class getElementClass() throws MappingException {
@@ -65,7 +61,9 @@
}
public CollectionType getDefaultCollectionType() throws MappingException {
- return TypeFactory.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
}
public boolean isArray() {
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,12 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
+import org.hibernate.cfg.Mappings;
import org.hibernate.type.CollectionType;
-import org.hibernate.type.TypeFactory;
/**
* A bag permits duplicates, so it has no primary key
@@ -34,12 +33,14 @@
*/
public class Bag extends Collection {
- public Bag(PersistentClass owner) {
- super(owner);
+ public Bag(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public CollectionType getDefaultCollectionType() {
- return TypeFactory.bag( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .bag( getRole(), getReferencedPropertyName(), isEmbedded() );
}
void createPrimaryKey() {
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
@@ -32,6 +31,7 @@
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
import org.hibernate.type.CollectionType;
@@ -51,6 +51,9 @@
public static final String DEFAULT_ELEMENT_COLUMN_NAME = "elt";
public static final String DEFAULT_KEY_COLUMN_NAME = "id";
+ private final Mappings mappings;
+ private PersistentClass owner;
+
private KeyValue key;
private Value element;
private Table collectionTable;
@@ -66,7 +69,6 @@
private String where;
private String manyToManyWhere;
private String manyToManyOrderBy;
- private PersistentClass owner;
private String referencedPropertyName;
private String nodeName;
private String elementNodeName;
@@ -100,10 +102,15 @@
private String loaderName;
- protected Collection(PersistentClass owner) {
+ protected Collection(Mappings mappings, PersistentClass owner) {
+ this.mappings = mappings;
this.owner = owner;
}
+ public Mappings getMappings() {
+ return mappings;
+ }
+
public boolean isSet() {
return false;
}
@@ -221,6 +228,11 @@
return owner;
}
+ /**
+ * @deprecated Inject the owner into constructor.
+ *
+ * @param owner The owner
+ */
public void setOwner(PersistentClass owner) {
this.owner = owner;
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Column.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Column.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Column.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Component.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Component.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Component.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -183,10 +183,10 @@
// TODO : temporary initial step towards HHH-1907
ComponentMetamodel metamodel = new ComponentMetamodel( this );
if ( isEmbedded() ) {
- return new EmbeddedComponentType( metamodel );
+ return getMappings().getTypeResolver().getTypeFactory().embeddedComponent( metamodel );
}
else {
- return new ComponentType( metamodel );
+ return getMappings().getTypeResolver().getTypeFactory().component( metamodel );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,10 +20,10 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
+import org.hibernate.cfg.Mappings;
import org.hibernate.type.CollectionType;
import org.hibernate.type.TypeFactory;
@@ -33,12 +33,14 @@
*/
public class IdentifierBag extends IdentifierCollection {
- public IdentifierBag(PersistentClass owner) {
- super(owner);
+ public IdentifierBag(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public CollectionType getDefaultCollectionType() {
- return TypeFactory.idbag( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .idbag( getRole(), getReferencedPropertyName(), isEmbedded() );
}
public Object accept(ValueVisitor visitor) {
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,11 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.engine.Mapping;
/**
@@ -36,8 +36,8 @@
private KeyValue identifier;
- public IdentifierCollection(PersistentClass owner) {
- super(owner);
+ public IdentifierCollection(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public KeyValue getIdentifier() {
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Index.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Index.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Index.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,13 +20,13 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
import java.util.Iterator;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.engine.Mapping;
/**
@@ -41,8 +41,8 @@
private Value index;
private String indexNodeName;
- public IndexedCollection(PersistentClass owner) {
- super(owner);
+ public IndexedCollection(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public Value getIndex() {
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Join.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Join.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Join.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/List.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/List.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/List.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,17 +20,17 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.type.CollectionType;
import org.hibernate.type.TypeFactory;
/**
- * A list mapping has a primary key consisting of
- * the key columns + index column.
+ * A list mapping has a primary key consisting of the key columns + index column.
+ *
* @author Gavin King
*/
public class List extends IndexedCollection {
@@ -41,12 +41,14 @@
return true;
}
- public List(PersistentClass owner) {
- super(owner);
+ public List(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public CollectionType getDefaultCollectionType() throws MappingException {
- return TypeFactory.list( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .list( getRole(), getReferencedPropertyName(), isEmbedded() );
}
public Object accept(ValueVisitor visitor) {
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
@@ -47,7 +46,7 @@
}
public Type getType() throws MappingException {
- return TypeFactory.manyToOne(
+ return getMappings().getTypeResolver().getTypeFactory().manyToOne(
getReferencedEntityName(),
getReferencedPropertyName(),
isLazy(),
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Map.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Map.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Map.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,11 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.type.CollectionType;
import org.hibernate.type.TypeFactory;
@@ -34,8 +34,8 @@
*/
public class Map extends IndexedCollection {
- public Map(PersistentClass owner) {
- super(owner);
+ public Map(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public boolean isMap() {
@@ -44,13 +44,19 @@
public CollectionType getDefaultCollectionType() {
if ( isSorted() ) {
- return TypeFactory.sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
}
else if ( hasOrder() ) {
- return TypeFactory.orderedMap( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .orderedMap( getRole(), getReferencedPropertyName(), isEmbedded() );
}
else {
- return TypeFactory.map( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .map( getRole(), getReferencedPropertyName(), isEmbedded() );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,3 +1,26 @@
+/*
+ * 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.mapping;
import java.util.*;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
@@ -28,6 +27,7 @@
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.engine.Mapping;
import org.hibernate.type.EntityType;
import org.hibernate.type.Type;
@@ -39,24 +39,28 @@
*/
public class OneToMany implements Value {
+ private final Mappings mappings;
+ private final Table referencingTable;
+
private String referencedEntityName;
- private Table referencingTable;
private PersistentClass associatedClass;
private boolean embedded;
private boolean ignoreNotFound;
private EntityType getEntityType() {
- return TypeFactory.manyToOne(
+ return mappings.getTypeResolver().getTypeFactory().manyToOne(
getReferencedEntityName(),
null,
false,
false,
isEmbedded(),
- isIgnoreNotFound()
+ isIgnoreNotFound(),
+ false
);
}
- public OneToMany(PersistentClass owner) throws MappingException {
+ public OneToMany(Mappings mappings, PersistentClass owner) throws MappingException {
+ this.mappings = mappings;
this.referencingTable = (owner==null) ? null : owner.getTable();
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
@@ -71,7 +70,7 @@
public Type getType() throws MappingException {
if ( getColumnIterator().hasNext() ) {
- return new SpecialOneToOneType(
+ return getMappings().getTypeResolver().getTypeFactory().specialOneToOne(
getReferencedEntityName(),
foreignKeyType,
referencedPropertyName,
@@ -79,10 +78,10 @@
isUnwrapProxy(),
entityName,
propertyName
- );
+ );
}
else {
- return TypeFactory.oneToOne(
+ return getMappings().getTypeResolver().getTypeFactory().oneToOne(
getReferencedEntityName(),
foreignKeyType,
referencedPropertyName,
@@ -91,7 +90,7 @@
isEmbedded(),
entityName,
propertyName
- );
+ );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,18 +20,18 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
+import org.hibernate.cfg.Mappings;
+
/**
- * A primitive array has a primary key consisting
- * of the key columns + index column.
+ * A primitive array has a primary key consisting of the key columns + index column.
*/
public class PrimitiveArray extends Array {
- public PrimitiveArray(PersistentClass owner) {
- super(owner);
+ public PrimitiveArray(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public boolean isPrimitiveArray() {
@@ -42,10 +42,3 @@
return visitor.accept(this);
}
}
-
-
-
-
-
-
-
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Set.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Set.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Set.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,13 +20,13 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
import java.util.Iterator;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Mappings;
import org.hibernate.engine.Mapping;
import org.hibernate.type.CollectionType;
import org.hibernate.type.TypeFactory;
@@ -51,12 +51,8 @@
throw new MappingException("set element mappings must have at least one non-nullable column: " + getRole() );*/
}
- /**
- * Constructor for Set.
- * @param owner
- */
- public Set(PersistentClass owner) {
- super(owner);
+ public Set(Mappings mappings, PersistentClass owner) {
+ super( mappings, owner );
}
public boolean isSet() {
@@ -65,13 +61,19 @@
public CollectionType getDefaultCollectionType() {
if ( isSorted() ) {
- return TypeFactory.sortedSet( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .sortedSet( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
}
else if ( hasOrder() ) {
- return TypeFactory.orderedSet( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .orderedSet( getRole(), getReferencedPropertyName(), isEmbedded() );
}
else {
- return TypeFactory.set( getRole(), getReferencedPropertyName(), isEmbedded() );
+ return getMappings().getTypeResolver()
+ .getTypeFactory()
+ .set( getRole(), getReferencedPropertyName(), isEmbedded() );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Table.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Table.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Table.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Value.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Value.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Value.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.mapping;
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/package.html
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/package.html 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/package.html 2010-05-06 01:05:26 UTC (rev 19374)
@@ -1,10 +1,10 @@
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
- ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ 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 Middleware LLC.
+ ~ 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
@@ -20,7 +20,6 @@
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
- ~
-->
<html>
Modified: core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -107,7 +107,7 @@
import org.hibernate.type.AssociationType;
import org.hibernate.type.EntityType;
import org.hibernate.type.Type;
-import org.hibernate.type.TypeFactory;
+import org.hibernate.type.TypeHelper;
import org.hibernate.type.VersionType;
import org.hibernate.util.ArrayHelper;
import org.hibernate.util.FilterHelper;
@@ -3377,7 +3377,7 @@
*/
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SessionImplementor session)
throws HibernateException {
- int[] props = TypeFactory.findDirty(
+ int[] props = TypeHelper.findDirty(
entityMetamodel.getProperties(),
currentState,
previousState,
@@ -3406,7 +3406,7 @@
*/
public int[] findModified(Object[] old, Object[] current, Object entity, SessionImplementor session)
throws HibernateException {
- int[] props = TypeFactory.findModified(
+ int[] props = TypeHelper.findModified(
entityMetamodel.getProperties(),
current,
old,
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -131,7 +131,7 @@
name = persistentClass.getEntityName();
rootName = persistentClass.getRootClass().getEntityName();
- entityType = TypeFactory.manyToOne( name );
+ entityType = sessionFactory.getTypeResolver().getTypeFactory().manyToOne( name );
identifierProperty = PropertyFactory.buildIdentifierProperty(
persistentClass,
Modified: core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -48,8 +48,8 @@
private final Class elementClass;
private final Class arrayClass;
- public ArrayType(String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
this.elementClass = elementClass;
arrayClass = Array.newInstance(elementClass, 0).getClass();
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/BagType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/BagType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/BagType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -38,8 +38,8 @@
public class BagType extends CollectionType {
- public BagType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key)
Modified: core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -66,11 +66,13 @@
private static final Object NOT_NULL_COLLECTION = new MarkerObject( "NOT NULL COLLECTION" );
public static final Object UNFETCHED_COLLECTION = new MarkerObject( "UNFETCHED COLLECTION" );
+ private final TypeFactory.TypeScope typeScope;
private final String role;
private final String foreignKeyPropertyName;
private final boolean isEmbeddedInXML;
- public CollectionType(String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
+ public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
+ this.typeScope = typeScope;
this.role = role;
this.foreignKeyPropertyName = foreignKeyPropertyName;
this.isEmbeddedInXML = isEmbeddedInXML;
Modified: core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -56,6 +56,7 @@
*/
public class ComponentType extends AbstractType implements AbstractComponentType {
+ private final TypeFactory.TypeScope typeScope;
private final String[] propertyNames;
private final Type[] propertyTypes;
private final boolean[] propertyNullability;
@@ -66,7 +67,8 @@
protected final EntityModeToTuplizerMapping tuplizerMapping;
- public ComponentType(ComponentMetamodel metamodel) {
+ public ComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
+ this.typeScope = typeScope;
// for now, just "re-flatten" the metamodel since this is temporary stuff anyway (HHH-1907)
this.isKey = metamodel.isKey();
this.propertySpan = metamodel.getPropertySpan();
@@ -456,7 +458,7 @@
: target;
final EntityMode entityMode = session.getEntityMode();
- Object[] values = TypeFactory.replace(
+ Object[] values = TypeHelper.replace(
getPropertyValues( original, entityMode ),
getPropertyValues( result, entityMode ),
propertyTypes,
@@ -488,7 +490,7 @@
target;
final EntityMode entityMode = session.getEntityMode();
- Object[] values = TypeFactory.replace(
+ Object[] values = TypeHelper.replace(
getPropertyValues( original, entityMode ),
getPropertyValues( result, entityMode ),
propertyTypes,
Modified: core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -48,8 +48,13 @@
private final UserCollectionType userType;
private final boolean customLogging;
- public CustomCollectionType(Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
- super(role, foreignKeyPropertyName, isEmbeddedInXML);
+ public CustomCollectionType(
+ TypeFactory.TypeScope typeScope,
+ Class userTypeClass,
+ String role,
+ String foreignKeyPropertyName,
+ boolean isEmbeddedInXML) {
+ super( typeScope, role, foreignKeyPropertyName, isEmbeddedInXML );
if ( !UserCollectionType.class.isAssignableFrom( userTypeClass ) ) {
throw new MappingException( "Custom type does not implement UserCollectionType: " + userTypeClass.getName() );
Modified: core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -40,8 +40,8 @@
return true;
}
- public EmbeddedComponentType(ComponentMetamodel metamodel) {
- super( metamodel );
+ public EmbeddedComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
+ super( typeScope, metamodel );
}
public boolean isMethodOf(Method method) {
Modified: core/trunk/core/src/main/java/org/hibernate/type/EntityType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/EntityType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/EntityType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -55,6 +55,7 @@
*/
public abstract class EntityType extends AbstractType implements AssociationType {
+ private final TypeFactory.TypeScope scope;
private final String associatedEntityName;
protected final String uniqueKeyPropertyName;
protected final boolean isEmbeddedInXML;
@@ -66,6 +67,7 @@
/**
* Constructs the requested entity type mapping.
*
+ * @param scope The type scope
* @param entityName The name of the associated entity.
* @param uniqueKeyPropertyName The property-ref name, or null if we
* reference the PK of the associated entity.
@@ -76,11 +78,13 @@
* with lazy="no-proxy".
*/
protected EntityType(
+ TypeFactory.TypeScope scope,
String entityName,
String uniqueKeyPropertyName,
boolean eager,
boolean isEmbeddedInXML,
boolean unwrapProxy) {
+ this.scope = scope;
this.associatedEntityName = entityName;
this.uniqueKeyPropertyName = uniqueKeyPropertyName;
this.isEmbeddedInXML = isEmbeddedInXML;
@@ -88,6 +92,10 @@
this.unwrapProxy = unwrapProxy;
}
+ protected TypeFactory.TypeScope scope() {
+ return scope;
+ }
+
/**
* An entity type is a type of association type
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -34,8 +34,8 @@
public class IdentifierBagType extends CollectionType {
- public IdentifierBagType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
public PersistentCollection instantiate(
Modified: core/trunk/core/src/main/java/org/hibernate/type/ListType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ListType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ListType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -37,8 +37,8 @@
public class ListType extends CollectionType {
- public ListType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
Modified: core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -50,46 +50,35 @@
/**
* Creates a many-to-one association type with the given referenced entity.
*
+ * @param scope The scope for this instance.
* @param referencedEntityName The name iof the referenced entity
*/
- public ManyToOneType(String referencedEntityName) {
- this( referencedEntityName, false );
+ public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName) {
+ this( scope, referencedEntityName, false );
}
/**
* Creates a many-to-one association type with the given referenced entity and the
* given laziness characteristic
*
+ * @param scope The scope for this instance.
* @param referencedEntityName The name iof the referenced entity
* @param lazy Should the association be handled lazily
*/
- public ManyToOneType(String referencedEntityName, boolean lazy) {
- this( referencedEntityName, null, lazy, true, false, false );
+ public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy) {
+ this( scope, referencedEntityName, null, lazy, true, false, false, false );
}
- /**
- * @deprecated use {@link #ManyToOneType(String, String, boolean, boolean, boolean, boolean, boolean)}
- * @noinspection JavaDoc
- */
public ManyToOneType(
+ TypeFactory.TypeScope scope,
String referencedEntityName,
String uniqueKeyPropertyName,
boolean lazy,
boolean unwrapProxy,
boolean isEmbeddedInXML,
- boolean ignoreNotFound) {
- this( referencedEntityName, uniqueKeyPropertyName, lazy, unwrapProxy, isEmbeddedInXML, ignoreNotFound, false );
- }
-
- public ManyToOneType(
- String referencedEntityName,
- String uniqueKeyPropertyName,
- boolean lazy,
- boolean unwrapProxy,
- boolean isEmbeddedInXML,
boolean ignoreNotFound,
boolean isLogicalOneToOne) {
- super( referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
+ super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
this.ignoreNotFound = ignoreNotFound;
this.isLogicalOneToOne = isLogicalOneToOne;
}
@@ -162,17 +151,14 @@
/**
* Register the entity as batch loadable, if enabled
*/
- private void scheduleBatchLoadIfNeeded(
- Serializable id,
- SessionImplementor session) throws MappingException {
+ @SuppressWarnings({ "JavaDoc" })
+ private void scheduleBatchLoadIfNeeded(Serializable id, SessionImplementor session) throws MappingException {
//cannot batch fetch by unique key (property-ref associations)
if ( uniqueKeyPropertyName == null && id != null ) {
EntityPersister persister = session.getFactory().getEntityPersister( getAssociatedEntityName() );
EntityKey entityKey = new EntityKey( id, persister, session.getEntityMode() );
if ( !session.getPersistenceContext().containsEntity( entityKey ) ) {
- session.getPersistenceContext()
- .getBatchFetchQueue()
- .addBatchLoadableEntityKey( entityKey );
+ session.getPersistenceContext().getBatchFetchQueue().addBatchLoadableEntityKey( entityKey );
}
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/MapType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/MapType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/MapType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -40,8 +40,8 @@
public class MapType extends CollectionType {
- public MapType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
Modified: core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -45,6 +45,22 @@
private final ForeignKeyDirection foreignKeyType;
private final String propertyName;
private final String entityName;
+
+ public OneToOneType(
+ TypeFactory.TypeScope scope,
+ String referencedEntityName,
+ ForeignKeyDirection foreignKeyType,
+ String uniqueKeyPropertyName,
+ boolean lazy,
+ boolean unwrapProxy,
+ boolean isEmbeddedInXML,
+ String entityName,
+ String propertyName) {
+ super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
+ this.foreignKeyType = foreignKeyType;
+ this.propertyName = propertyName;
+ this.entityName = entityName;
+ }
public String getPropertyName() {
return propertyName;
@@ -82,28 +98,6 @@
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
}
- public OneToOneType(
- String referencedEntityName,
- ForeignKeyDirection foreignKeyType,
- String uniqueKeyPropertyName,
- boolean lazy,
- boolean unwrapProxy,
- boolean isEmbeddedInXML,
- String entityName,
- String propertyName
- ) {
- super(
- referencedEntityName,
- uniqueKeyPropertyName,
- !lazy,
- isEmbeddedInXML,
- unwrapProxy
- );
- this.foreignKeyType = foreignKeyType;
- this.propertyName = propertyName;
- this.entityName = entityName;
- }
-
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session) {
//nothing to do
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -38,8 +38,8 @@
* @param propertyRef The property ref name.
* @param isEmbeddedInXML Is this collection to embed itself in xml
*/
- public OrderedMapType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super( role, propertyRef, isEmbeddedInXML );
+ public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -34,12 +34,13 @@
* Constructs a set type capable of creating ordered sets of the given
* role.
*
+ * @param typeScope The scope for this type instance.
* @param role The collection role name.
* @param propertyRef The property ref name.
* @param isEmbeddedInXML Is this collection to embed itself in xml
*/
- public OrderedSetType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super( role, propertyRef, isEmbeddedInXML );
+ public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/SetType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SetType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SetType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -36,8 +36,8 @@
public class SetType extends CollectionType {
- public SetType(String role, String propertyRef, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
}
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
Modified: core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -41,8 +41,8 @@
private final Comparator comparator;
- public SortedMapType(String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
this.comparator = comparator;
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -39,8 +39,8 @@
private final Comparator comparator;
- public SortedSetType(String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
- super(role, propertyRef, isEmbeddedInXML);
+ public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
+ super( typeScope, role, propertyRef, isEmbeddedInXML );
this.comparator = comparator;
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -43,15 +43,16 @@
public class SpecialOneToOneType extends OneToOneType {
public SpecialOneToOneType(
+ TypeFactory.TypeScope scope,
String referencedEntityName,
ForeignKeyDirection foreignKeyType,
String uniqueKeyPropertyName,
boolean lazy,
boolean unwrapProxy,
String entityName,
- String propertyName
- ) {
+ String propertyName) {
super(
+ scope,
referencedEntityName,
foreignKeyType,
uniqueKeyPropertyName,
Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -25,7 +25,6 @@
import java.io.Serializable;
import java.util.Comparator;
-import java.util.Map;
import java.util.Properties;
import org.slf4j.Logger;
@@ -34,15 +33,18 @@
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.classic.Lifecycle;
+import org.hibernate.classic.Validatable;
import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.engine.SessionImplementor;
-import org.hibernate.tuple.StandardProperty;
+import org.hibernate.tuple.component.ComponentMetamodel;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.ParameterizedType;
import org.hibernate.usertype.UserType;
import org.hibernate.util.ReflectHelper;
/**
+ * Used internally to build instances of {@link Type}, specifically it builds instances of
+ *
+ *
* Used internally to obtain instances of <tt>Type</tt>. Applications should use static methods
* and constants on <tt>org.hibernate.Hibernate</tt>.
*
@@ -97,9 +99,9 @@
return custom( (Class<UserType>) clazz, parameters );
}
- if ( Lifecycle.class.isAssignableFrom( clazz ) ) {
+ if ( Lifecycle.class.isAssignableFrom( clazz ) || Validatable.class.isAssignableFrom( clazz ) ) {
// not really a many-to-one association *necessarily*
- return new ManyToOneType( clazz.getName() );
+ return manyToOne( clazz.getName() );
}
if ( Serializable.class.isAssignableFrom( clazz ) ) {
@@ -120,7 +122,7 @@
}
}
- public static void injectParameters(Object type, Properties parameters) {
+ public void injectParameters(Object type, Properties parameters) {
if ( ParameterizedType.class.isInstance( type ) ) {
( (ParameterizedType) type ).setParameterValues(parameters);
}
@@ -129,7 +131,7 @@
}
}
- public static CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters) {
+ public CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters) {
try {
CompositeUserType userType = typeClass.newInstance();
injectParameters( userType, parameters );
@@ -140,8 +142,28 @@
}
}
- public static CustomType custom(Class<UserType> typeClass, Properties parameters) {
+ public CollectionType customCollection(
+ String typeName,
+ Properties typeParameters,
+ String role,
+ String propertyRef,
+ boolean embedded) {
+ Class typeClass;
try {
+ typeClass = ReflectHelper.classForName( typeName );
+ }
+ catch ( ClassNotFoundException cnfe ) {
+ throw new MappingException( "user collection type class not found: " + typeName, cnfe );
+ }
+ CustomCollectionType result = new CustomCollectionType( typeScope, typeClass, role, propertyRef, embedded );
+ if ( typeParameters != null ) {
+ injectParameters( result.getUserType(), typeParameters );
+ }
+ return result;
+ }
+
+ public CustomType custom(Class<UserType> typeClass, Properties parameters) {
+ try {
UserType userType = typeClass.newInstance();
injectParameters( userType, parameters );
return new CustomType( userType );
@@ -164,10 +186,9 @@
}
- /**
- * A one-to-one association type for the given class
- */
- public static EntityType oneToOne(
+ // one-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public EntityType oneToOne(
String persistentClass,
ForeignKeyDirection foreignKeyType,
String uniqueKeyPropertyName,
@@ -175,61 +196,35 @@
boolean unwrapProxy,
boolean isEmbeddedInXML,
String entityName,
- String propertyName
- ) {
- return new OneToOneType(
- persistentClass,
- foreignKeyType,
- uniqueKeyPropertyName,
- lazy,
- unwrapProxy,
- isEmbeddedInXML,
- entityName,
- propertyName
- );
+ String propertyName) {
+ return new OneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName,
+ lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName );
}
- /**
- * A many-to-one association type for the given class
- */
- public static EntityType manyToOne(String persistentClass) {
- return new ManyToOneType( persistentClass );
- }
-
- /**
- * A many-to-one association type for the given class
- */
- public static EntityType manyToOne(String persistentClass, boolean lazy) {
- return new ManyToOneType( persistentClass, lazy );
- }
-
- /**
- * A many-to-one association type for the given class
- *
- * @deprecated Use {@link #manyToOne(String, String, boolean, boolean, boolean, boolean, boolean)}
- */
- public static EntityType manyToOne(
+ public EntityType specialOneToOne(
String persistentClass,
+ ForeignKeyDirection foreignKeyType,
String uniqueKeyPropertyName,
boolean lazy,
boolean unwrapProxy,
- boolean isEmbeddedInXML,
- boolean ignoreNotFound) {
- //noinspection deprecation
- return new ManyToOneType(
- persistentClass,
- uniqueKeyPropertyName,
- lazy,
- unwrapProxy,
- isEmbeddedInXML,
- ignoreNotFound
- );
+ String entityName,
+ String propertyName) {
+ return new SpecialOneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName,
+ lazy, unwrapProxy, entityName, propertyName );
}
- /**
- * A many-to-one association type for the given class
- */
- public static EntityType manyToOne(
+
+ // many-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public EntityType manyToOne(String persistentClass) {
+ return new ManyToOneType( typeScope, persistentClass );
+ }
+
+ public EntityType manyToOne(String persistentClass, boolean lazy) {
+ return new ManyToOneType( typeScope, persistentClass, lazy );
+ }
+
+ public EntityType manyToOne(
String persistentClass,
String uniqueKeyPropertyName,
boolean lazy,
@@ -238,6 +233,7 @@
boolean ignoreNotFound,
boolean isLogicalOneToOne) {
return new ManyToOneType(
+ typeScope,
persistentClass,
uniqueKeyPropertyName,
lazy,
@@ -248,299 +244,64 @@
);
}
- /**
- * The legacy contract.
- *
- * @deprecated Use {@link #customCollection(String, java.util.Properties, String, String, boolean)} instead
- */
- public static CollectionType customCollection(
- String typeName,
- String role,
- String propertyRef,
- boolean embedded) {
- return customCollection( typeName, null, role, propertyRef, embedded );
- }
- public static CollectionType customCollection(
- String typeName,
- Properties typeParameters,
- String role,
- String propertyRef,
- boolean embedded) {
- Class typeClass;
- try {
- typeClass = ReflectHelper.classForName( typeName );
- }
- catch ( ClassNotFoundException cnfe ) {
- throw new MappingException( "user collection type class not found: " + typeName, cnfe );
- }
- CustomCollectionType result = new CustomCollectionType( typeClass, role, propertyRef, embedded );
- if ( typeParameters != null ) {
- TypeFactory.injectParameters( result.getUserType(), typeParameters );
- }
- return result;
- }
+ // collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Collection Types:
-
- public static CollectionType array(String role, String propertyRef, boolean embedded,
- Class elementClass) {
- return new ArrayType( role, propertyRef, elementClass, embedded );
+ public CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass) {
+ return new ArrayType( typeScope, role, propertyRef, elementClass, embedded );
}
- public static CollectionType list(String role, String propertyRef, boolean embedded) {
- return new ListType( role, propertyRef, embedded );
+ public CollectionType list(String role, String propertyRef, boolean embedded) {
+ return new ListType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType bag(String role, String propertyRef, boolean embedded) {
- return new BagType( role, propertyRef, embedded );
+ public CollectionType bag(String role, String propertyRef, boolean embedded) {
+ return new BagType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType idbag(String role, String propertyRef, boolean embedded) {
- return new IdentifierBagType( role, propertyRef, embedded );
+ public CollectionType idbag(String role, String propertyRef, boolean embedded) {
+ return new IdentifierBagType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType map(String role, String propertyRef, boolean embedded) {
- return new MapType( role, propertyRef, embedded );
+ public CollectionType map(String role, String propertyRef, boolean embedded) {
+ return new MapType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
- return new OrderedMapType( role, propertyRef, embedded );
+ public CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
+ return new OrderedMapType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType set(String role, String propertyRef, boolean embedded) {
- return new SetType( role, propertyRef, embedded );
+ public CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator) {
+ return new SortedMapType( typeScope, role, propertyRef, comparator, embedded );
}
- public static CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
- return new OrderedSetType( role, propertyRef, embedded );
+ public CollectionType set(String role, String propertyRef, boolean embedded) {
+ return new SetType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType sortedMap(String role, String propertyRef, boolean embedded,
- Comparator comparator) {
- return new SortedMapType( role, propertyRef, comparator, embedded );
+ public CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
+ return new OrderedSetType( typeScope, role, propertyRef, embedded );
}
- public static CollectionType sortedSet(String role, String propertyRef, boolean embedded,
- Comparator comparator) {
- return new SortedSetType( role, propertyRef, comparator, embedded );
+ public CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator) {
+ return new SortedSetType( typeScope, role, propertyRef, comparator, embedded );
}
- // convenience methods relating to operations across arrays of types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // component type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- /**
- * Deep copy a series of values from one array to another...
- *
- * @param values The values to copy (the source)
- * @param types The value types
- * @param copy an array indicating which values to include in the copy
- * @param target The array into which to copy the values
- * @param session The originating session
- *
- * @deprecated Use {@link TypeHelper#deepCopy} instead
- */
- public static void deepCopy(
- final Object[] values,
- final Type[] types,
- final boolean[] copy,
- final Object[] target,
- final SessionImplementor session) {
- TypeHelper.deepCopy( values, types, copy, target, session );
+ public ComponentType component(ComponentMetamodel metamodel) {
+ return new ComponentType( typeScope, metamodel );
}
- /**
- * Apply the {@link Type#beforeAssemble} operation across a series of values.
- *
- * @param row The values
- * @param types The value types
- * @param session The originating session
- *
- * @deprecated Use {@link TypeHelper#beforeAssemble} instead
- */
- public static void beforeAssemble(
- final Serializable[] row,
- final Type[] types,
- final SessionImplementor session) {
- TypeHelper.beforeAssemble( row, types, session );
+ public EmbeddedComponentType embeddedComponent(ComponentMetamodel metamodel) {
+ return new EmbeddedComponentType( typeScope, metamodel );
}
- /**
- * Apply the {@link Type#assemble} operation across a series of values.
- *
- * @param row The values
- * @param types The value types
- * @param session The originating session
- * @param owner The entity "owning" the values
- *
- * @return The assembled state
- *
- * @deprecated Use {@link TypeHelper#assemble} instead
- */
- public static Object[] assemble(
- final Serializable[] row,
- final Type[] types,
- final SessionImplementor session,
- final Object owner) {
- return TypeHelper.assemble( row, types, session, owner );
- }
- /**
- * Apply the {@link Type#disassemble} operation across a series of values.
- *
- * @param row The values
- * @param types The value types
- * @param nonCacheable An array indicating which values to include in the disassembled state
- * @param session The originating session
- * @param owner The entity "owning" the values
- *
- * @return The disassembled state
- *
- * @deprecated Use {@link TypeHelper#disassemble} instead
- */
- public static Serializable[] disassemble(
- final Object[] row,
- final Type[] types,
- final boolean[] nonCacheable,
- final SessionImplementor session,
- final Object owner) {
- return TypeHelper.disassemble( row, types, nonCacheable, session, owner );
- }
+ // any type builder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- /**
- * Apply the {@link Type#replace} operation across a series of values.
- *
- * @param original The source of the state
- * @param target The target into which to replace the source values.
- * @param types The value types
- * @param session The originating session
- * @param owner The entity "owning" the values
- * @param copyCache A map representing a cache of already replaced state
- *
- * @return The replaced state
- *
- * @deprecated Use {@link TypeHelper#replace} instead
- */
- public static Object[] replace(
- final Object[] original,
- final Object[] target,
- final Type[] types,
- final SessionImplementor session,
- final Object owner,
- final Map copyCache) {
- return TypeHelper.replace( original, target, types, session, owner, copyCache );
+ public Type any(Type metaType, Type identifierType) {
+ return new AnyType( metaType, identifierType );
}
-
- /**
- * Apply the {@link Type#replace} operation across a series of values.
- *
- * @param original The source of the state
- * @param target The target into which to replace the source values.
- * @param types The value types
- * @param session The originating session
- * @param owner The entity "owning" the values
- * @param copyCache A map representing a cache of already replaced state
- * @param foreignKeyDirection FK directionality to be applied to the replacement
- *
- * @return The replaced state
- *
- * @deprecated Use {@link TypeHelper#replace} instead
- */
- public static Object[] replace(
- final Object[] original,
- final Object[] target,
- final Type[] types,
- final SessionImplementor session,
- final Object owner,
- final Map copyCache,
- final ForeignKeyDirection foreignKeyDirection) {
- return TypeHelper.replace( original, target, types, session, owner, copyCache, foreignKeyDirection );
- }
-
- /**
- * Apply the {@link Type#replace} operation across a series of values, as
- * long as the corresponding {@link Type} is an association.
- * <p/>
- * If the corresponding type is a component type, then apply {@link Type#replace}
- * across the component subtypes but do not replace the component value itself.
- *
- * @param original The source of the state
- * @param target The target into which to replace the source values.
- * @param types The value types
- * @param session The originating session
- * @param owner The entity "owning" the values
- * @param copyCache A map representing a cache of already replaced state
- * @param foreignKeyDirection FK directionality to be applied to the replacement
- *
- * @return The replaced state
- *
- * @deprecated Use {@link TypeHelper#replaceAssociations} instead
- */
- public static Object[] replaceAssociations(
- final Object[] original,
- final Object[] target,
- final Type[] types,
- final SessionImplementor session,
- final Object owner,
- final Map copyCache,
- final ForeignKeyDirection foreignKeyDirection) {
- return TypeHelper.replaceAssociations( original, target, types, session, owner, copyCache, foreignKeyDirection );
- }
-
- /**
- * Determine if any of the given field values are dirty, returning an array containing
- * indices of the dirty fields.
- * <p/>
- * If it is determined that no fields are dirty, null is returned.
- *
- * @param properties The property definitions
- * @param currentState The current state of the entity
- * @param previousState The baseline state of the entity
- * @param includeColumns Columns to be included in the dirty checking, per property
- * @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
- * @param session The session from which the dirty check request originated.
- *
- * @return Array containing indices of the dirty properties, or null if no properties considered dirty.
- *
- * @deprecated Use {@link TypeHelper#findDirty} instead
- */
- public static int[] findDirty(
- final StandardProperty[] properties,
- final Object[] currentState,
- final Object[] previousState,
- final boolean[][] includeColumns,
- final boolean anyUninitializedProperties,
- final SessionImplementor session) {
- return TypeHelper.findDirty( properties, currentState, previousState,
- includeColumns, anyUninitializedProperties, session );
- }
-
- /**
- * Determine if any of the given field values are modified, returning an array containing
- * indices of the modified fields.
- * <p/>
- * If it is determined that no fields are dirty, null is returned.
- *
- * @param properties The property definitions
- * @param currentState The current state of the entity
- * @param previousState The baseline state of the entity
- * @param includeColumns Columns to be included in the mod checking, per property
- * @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
- * @param session The session from which the dirty check request originated.
- *
- * @return Array containing indices of the modified properties, or null if no properties considered modified.
- *
- * @deprecated Use {@link TypeHelper#findModified} instead
- */
- public static int[] findModified(
- final StandardProperty[] properties,
- final Object[] currentState,
- final Object[] previousState,
- final boolean[][] includeColumns,
- final boolean anyUninitializedProperties,
- final SessionImplementor session) {
- return TypeHelper.findModified( properties, currentState, previousState,
- includeColumns, anyUninitializedProperties, session );
- }
-
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -122,9 +122,10 @@
*
* @param row The values
* @param types The value types
- * @param nonCacheable An array indicating which values to include in the disassemled state
+ * @param nonCacheable An array indicating which values to include in the disassembled state
* @param session The originating session
* @param owner The entity "owning" the values
+ *
* @return The disassembled state
*/
public static Serializable[] disassemble(
@@ -157,6 +158,7 @@
* @param session The originating session
* @param owner The entity "owning" the values
* @param copyCache A map representing a cache of already replaced state
+ *
* @return The replaced state
*/
public static Object[] replace(
@@ -189,6 +191,7 @@
* @param owner The entity "owning" the values
* @param copyCache A map representing a cache of already replaced state
* @param foreignKeyDirection FK directionality to be applied to the replacement
+ *
* @return The replaced state
*/
public static Object[] replace(
@@ -213,11 +216,11 @@
}
/**
- * Apply the {@link Type#replace} operation across a series of values, as
- * long as the corresponding {@link Type} is an association.
+ * Apply the {@link Type#replace} operation across a series of values, as long as the corresponding
+ * {@link Type} is an association.
* <p/>
- * If the corresponding type is a component type, then apply {@link Type#replace}
- * across the component subtypes but do not replace the component value itself.
+ * If the corresponding type is a component type, then apply {@link Type#replace} across the component
+ * subtypes but do not replace the component value itself.
*
* @param original The source of the state
* @param target The target into which to replace the source values.
@@ -274,6 +277,7 @@
* @param includeColumns Columns to be included in the dirty checking, per property
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
* @param session The session from which the dirty check request originated.
+ *
* @return Array containing indices of the dirty properties, or null if no properties considered dirty.
*/
public static int[] findDirty(
@@ -321,6 +325,7 @@
* @param includeColumns Columns to be included in the mod checking, per property
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
* @param session The session from which the dirty check request originated.
+ *
* @return Array containing indices of the modified properties, or null if no properties considered modified.
*/
public static int[] findModified(
Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -56,8 +56,16 @@
return new TypeResolver( basicTypeRegistry.shallowCopy(), typeFactory );
}
+ public void registerTypeOverride(BasicType type) {
+ basicTypeRegistry.register( type );
+ }
+
+ public TypeFactory getTypeFactory() {
+ return typeFactory;
+ }
+
/**
- * Locate a Hibernate {@linkplain BasicType basic type} given (one of) its registration name(s).
+ * Locate a Hibernate {@linkplain BasicType basic type} given (one of) its registration names.
*
* @param name The registration name
*
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java 2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java 2010-05-06 01:05:26 UTC (rev 19374)
@@ -178,19 +178,19 @@
ValueVisitor vv = new ValueVisitorValidator();
- new Any(mappings, tbl).accept(vv);
- new Array( rootClass ).accept(vv);
- new Bag( rootClass ).accept(vv);
+ new Any( mappings, tbl ).accept(vv);
+ new Array( mappings, rootClass ).accept(vv);
+ new Bag( mappings, rootClass ).accept(vv);
new Component( mappings, rootClass ).accept(vv);
new DependantValue( mappings, tbl, null ).accept(vv);
- new IdentifierBag( rootClass ).accept(vv);
- new List( rootClass ).accept(vv);
+ new IdentifierBag( mappings, rootClass ).accept(vv);
+ new List( mappings, rootClass ).accept(vv);
new ManyToOne( mappings, tbl ).accept(vv);
- new Map( rootClass ).accept(vv);
- new OneToMany( rootClass ).accept(vv);
+ new Map( mappings, rootClass ).accept(vv);
+ new OneToMany( mappings, rootClass ).accept(vv);
new OneToOne( mappings, tbl, rootClass ).accept(vv);
- new PrimitiveArray( rootClass ).accept(vv);
- new Set( rootClass ).accept(vv);
+ new PrimitiveArray( mappings, rootClass ).accept(vv);
+ new Set( mappings, rootClass ).accept(vv);
new SimpleValue( mappings ).accept(vv);
14 years, 8 months