Hibernate SVN: r16914 - core/branches/Branch_3_3.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 16:09:35 -0400 (Tue, 23 Jun 2009)
New Revision: 16914
Modified:
core/branches/Branch_3_3/changelog.txt
Log:
HHH-3987 - prep 3.3.2 release
Modified: core/branches/Branch_3_3/changelog.txt
===================================================================
--- core/branches/Branch_3_3/changelog.txt 2009-06-23 20:03:32 UTC (rev 16913)
+++ core/branches/Branch_3_3/changelog.txt 2009-06-23 20:09:35 UTC (rev 16914)
@@ -6,6 +6,99 @@
more about each case.
+Changes in version 3.3.1.GA (2009.06.24)
+-------------------------------------------
+
+** Bug
+ * [HHH-1930] - QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
+ * [HHH-2146] - NullpointerException in DefaultDeleteEventListener.deleteTransientEntity
+ * [HHH-2745] - NullPointerException when eager fetching joined many-to-many with native SQL query
+ * [HHH-3046] - Merge fails on complicated data structure because of cycle references
+ * [HHH-3216] - Incorrect parse result in ParameterParser
+ * [HHH-3351] - Dynamic entity model and inheritance - exception when trying to persist
+ * [HHH-3481] - JTATransactionFactory bug when Transaction cannot be found in JNDI
+ * [HHH-3483] - org.hibernate.test.hql.ScrollableCollectionFetchingTest#testScrollingJoinFetchesForward unsupported by DB2
+ * [HHH-3496] - DB2 hanging on JPALockTest and CMTTest
+ * [HHH-3501] - ASTParserLoadingTest testing unsupported queries for DB2
+ * [HHH-3506] - enabled filters should apply to HQL update/delete statements
+ * [HHH-3508] - Sybase Dialect - Override supportsCascadeDelete to return "false"
+ * [HHH-3519] - account for parameters in select clause of INSERT-SELECT for DB2
+ * [HHH-3528] - FETCH JOIN query doesn't work in a StatelessSession
+ * [HHH-3584] - Generate SQL when Dynamic Update is true is including version field even when marked as updateable=false
+ * [HHH-3621] - Assertion failure in MigrationTest
+ * [HHH-3636] - Attempt to read invalid column when loading collection of subclasses mapped with table-per-subclass with discriminator
+ * [HHH-3640] - Some standard SQL functions are not implemented in Sybase
+ * [HHH-3652] - CompositeIdWithGeneratorTest needs a standard way to compare timestamps
+ * [HHH-3662] - Merging read-only entities causes AssertionError("Merged entity does not have status set to MANAGED...")
+ * [HHH-3668] - Sybase does not support implicit conversion from character types to numeric types causes failing unit tests
+ * [HHH-3670] - Invalid test for str() for SQL Server and Sybase
+ * [HHH-3672] - Sybase - second(), minute(), hour(), and extract() cause GenericJDBCException
+ * [HHH-3675] - Limitations on Sybase ResultSet implementation cause unit test failures
+ * [HHH-3679] - Sybase conversion of Java byte to tinyint fails with 8-bit values causing unit test failures
+ * [HHH-3680] - Sybase - composite primary key in unit test exceeds maximum for index causing failure
+ * [HHH-3693] - Implicit Polymorphic query + pagination returning zero result
+ * [HHH-3696] - Sybase - unit tests fail when numeric values overflow in precision or scale on insert
+ * [HHH-3698] - Problem with HQL parameter bindings as indexed collection selectors
+ * [HHH-3699] - Problem with HQL parameter bindings for parameters in WITH join clause
+ * [HHH-3701] - SQL function "trim" is not available in Sybase Dialect
+ * [HHH-3749] - Only reuse FromElements originating from from-clause if their aliases match
+ * [HHH-3810] - Transient entities can be inserted twice on merge
+ * [HHH-3874] - Packaging type in hibernate-maven-plugin/pom.xml makes maven build fail
+ * [HHH-3880] - org.hibernate.id.enhanced.TableStructure missing "as" keyword in select statment column renames; required for PostgreSQL
+ * [HHH-3912] - Change for HHH-3159 causes InstantiationException
+ * [HHH-3918] - Use standard JDK exception nesting
+ * [HHH-3980] - Fix for HHH-2980 introduced bug that allows the same bag collection role to be fetched multiple times
+
+** Improvement
+ * [HHH-1234] - allow tuplizers the opportunity to influence getSubclassEntityPersister() processing
+ * [HHH-2592] - force hibernate to generate use offset qeury when offset is zero
+ * [HHH-2980] - Error "org.hibernate.HibernateException: cannot simultaneously fetch multiple bags" not specific enough
+ * [HHH-3159] - Oracle 11g - desupport of oracle.jdbc.driver
+ * [HHH-3275] - Allow pluggable tuplizers for composite elements
+ * [HHH-3276] - review proposed new doc styling
+ * [HHH-3357] - improve performance of session.clear()
+ * [HHH-3383] - QueryKey is storing references to entities instead of identifiers
+ * [HHH-3515] - Introduce EntityNameResolver interface
+ * [HHH-3517] - Allow definition of the default tuplizer class to use
+ * [HHH-3518] - Remove Suite classes from testsuite module
+ * [HHH-3525] - Clean up reflection code trying to determine JDK 1.4 capabilities
+ * [HHH-3532] - schema update task should look for foreign key signature
+ * [HHH-3712] - Reorganize the Sybase dialect class hierarchy, add SybaseASE15Dialect, and mark SybaseDialect as deprecated
+ * [HHH-3737] - Support Hibernate 3.3 branch in Envers until 3.4.0GA is out
+ * [HHH-3750] - Allow dialects to handle difference in how Query.setFirstResult() should be interpreted
+ * [HHH-3751] - Enable Antlr tree parser tracing for HqlSqlWalker and SqlGenerator (tree parsers)
+ * [HHH-3753] - Upgrade to SLF4J version 1.5.8
+ * [HHH-3832] - Upgrade to cglib-2.2.jar
+ * [HHH-3886] - Update database credentials for QA Lab
+ * [HHH-3944] - Document known database portability strategies
+ * [HHH-3978] - Expose Hibernate version via non-compile-time constant expression
+ * [HHH-3982] - Apply build version to org.hibernate.Version
+
+** New Feature
+ * [HHH-3343] - Postgres Plus Dialect
+ * [HHH-3781] - Echo version information to the console in main()
+
+** Patch
+ * [HHH-530] - Allow application of filters on subqueries
+ * [HHH-2933] - allow custom resolution of Dialect (Tomoto Shimizu Washio)
+ * [HHH-3401] - H2 Database Dialect Fixes
+ * [HHH-3450] - Include SingletonEhCacheProvider as an additional caching provider (Greg Luck)
+ * [HHH-3639] - Sybase keywords - rename columns
+ * [HHH-3649] - DB2Dialect inherits supportsPooledSequences() as false, but it does support
+ * [HHH-3650] - TableGenerator doesn't marks the "primary key" as not null, causing errors in some RDBMS's which expects the PK to be not-null
+ * [HHH-3742] - Documentation corrections
+
+** Task
+ * [HHH-3214] - Update unit tests and config files to use non-depracated Oracle dialects
+ * [HHH-3760] - Document EntityNameResolver
+ * [HHH-3761] - Document DialectResolver
+ * [HHH-3953] - Update tutorial chapter
+ * [HHH-3979] - Upgrade to javassist 3.9.0
+ * [HHH-3981] - Upgrade to jDocBook 2.2.0
+ * [HHH-3986] - Upgrade to JBossCache 3.1.0 (3.3 branch)
+ * [HHH-3987] - prep 3.3.2 release
+
+
Changes in version 3.3.1.GA (2008.09.10)
-------------------------------------------
15 years, 6 months
Hibernate SVN: r16913 - in core/branches/Branch_3_3/documentation/manual: src/main/docbook/en-US/content and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 16:03:32 -0400 (Tue, 23 Jun 2009)
New Revision: 16913
Modified:
core/branches/Branch_3_3/documentation/manual/pom.xml
core/branches/Branch_3_3/documentation/manual/src/main/docbook/en-US/content/tutorial.xml
core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/inheritance_mapping.po
core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/Hibernate_Reference.pot
core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/configuration.pot
core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/portability.pot
core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/preface.pot
core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/tutorial.pot
Log:
HHH-3987 - prep 3.3.2 release
Modified: core/branches/Branch_3_3/documentation/manual/pom.xml
===================================================================
--- core/branches/Branch_3_3/documentation/manual/pom.xml 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/pom.xml 2009-06-23 20:03:32 UTC (rev 16913)
@@ -33,6 +33,11 @@
<dependencies>
<dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.72.0</version>
+ </dependency>
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jdocbook-style</artifactId>
<version>2.0.0</version>
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/en-US/content/tutorial.xml
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/en-US/content/tutorial.xml 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/en-US/content/tutorial.xml 2009-06-23 20:03:32 UTC (rev 16913)
@@ -846,7 +846,7 @@
Here, we are using a Hibernate Query Language (HQL) query to load all existing
<literal>Event</literal> objects from the database. Hibernate will generate the
appropriate SQL, send it to the database and populate <literal>Event</literal> objects
- with the data. You can create more complex queries with HQL. See <xref linkend="query-hql"/>
+ with the data. You can create more complex queries with HQL. See <xref linkend="queryhql"/>
for more information.
</para>
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/inheritance_mapping.po
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/inheritance_mapping.po 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/inheritance_mapping.po 2009-06-23 20:03:32 UTC (rev 16913)
@@ -883,7 +883,7 @@
#: inheritance_mapping.xml:314
#, no-c-format
msgid "table per class-hierarchy"
-msgstr "<entry>tabla por jerarquía de clases</entry>"
+msgstr "tabla por jerarquía de clases"
#. Tag: literal
#: inheritance_mapping.xml:315 inheritance_mapping.xml:326
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/Hibernate_Reference.pot
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/Hibernate_Reference.pot 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/Hibernate_Reference.pot 2009-06-23 20:03:32 UTC (rev 16913)
@@ -6,7 +6,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
-"POT-Creation-Date: 2009-06-16 18:47+0000\n"
+"POT-Creation-Date: 2009-06-23 18:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc(a)kde.org>\n"
@@ -15,19 +15,19 @@
"Content-Transfer-Encoding: 8bit\n"
#. Tag: title
-#: Hibernate_Reference.xml:34
+#: Hibernate_Reference.xml:35
#, no-c-format
msgid "HIBERNATE - Relational Persistence for Idiomatic Java"
msgstr ""
#. Tag: subtitle
-#: Hibernate_Reference.xml:35
+#: Hibernate_Reference.xml:36
#, no-c-format
msgid "Hibernate Reference Documentation"
msgstr ""
#. Tag: holder
-#: Hibernate_Reference.xml:49
+#: Hibernate_Reference.xml:51
#, no-c-format
msgid "©rightHolder;"
msgstr ""
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/configuration.pot
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/configuration.pot 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/configuration.pot 2009-06-23 20:03:32 UTC (rev 16913)
@@ -6,7 +6,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
-"POT-Creation-Date: 2009-06-16 18:47+0000\n"
+"POT-Creation-Date: 2009-06-23 18:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc(a)kde.org>\n"
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/portability.pot
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/portability.pot 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/portability.pot 2009-06-23 20:03:32 UTC (rev 16913)
@@ -6,7 +6,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
-"POT-Creation-Date: 2009-06-16 18:47+0000\n"
+"POT-Creation-Date: 2009-06-23 18:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc(a)kde.org>\n"
@@ -71,7 +71,7 @@
#. Tag: para
#: portability.xml:85
#, no-c-format
-msgid "The cool part about these resolvers is that users can also register their own custom resolvers which will be processed ahead of the built-in Hibernate ones. This might be useful in a number of different situations: it allows easy integration for auto-detection of dialects beyond those shipped with HIbernate itself; it allows you to specify to use a custom dialect when a particular database is recognized; etc. To register one or more resolvers, simply specify them (seperated by commas, tabs or spaces) using the 'hibernate.dialect_resolvers' configuration setting (see the <constant>DIALECT_RESOLVERS</constant> constant on <classname>org.hibernate.cfgEnvironment</classname>)."
+msgid "The cool part about these resolvers is that users can also register their own custom resolvers which will be processed ahead of the built-in Hibernate ones. This might be useful in a number of different situations: it allows easy integration for auto-detection of dialects beyond those shipped with HIbernate itself; it allows you to specify to use a custom dialect when a particular database is recognized; etc. To register one or more resolvers, simply specify them (seperated by commas, tabs or spaces) using the 'hibernate.dialect_resolvers' configuration setting (see the <constant>DIALECT_RESOLVERS</constant> constant on <classname>org.hibernate.cfg.Environment</classname>)."
msgstr ""
#. Tag: title
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/preface.pot
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/preface.pot 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/preface.pot 2009-06-23 20:03:32 UTC (rev 16913)
@@ -6,7 +6,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
-"POT-Creation-Date: 2009-06-16 18:47+0000\n"
+"POT-Creation-Date: 2009-06-23 18:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc(a)kde.org>\n"
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/tutorial.pot
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/tutorial.pot 2009-06-23 19:09:27 UTC (rev 16912)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/pot/content/tutorial.pot 2009-06-23 20:03:32 UTC (rev 16913)
@@ -6,7 +6,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
-"POT-Creation-Date: 2009-06-10 21:02+0000\n"
+"POT-Creation-Date: 2009-06-23 18:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc(a)kde.org>\n"
@@ -775,7 +775,7 @@
#. Tag: para
#: tutorial.xml:609
#, no-c-format
-msgid "Here, we are using a Hibernate Query Language (HQL) query to load all existing <literal>Event</literal> objects from the database. Hibernate will generate the appropriate SQL, send it to the database and populate <literal>Event</literal> objects with the data. You can create more complex queries with HQL. See <xref linkend=\"query-hql\"/> for more information."
+msgid "Here, we are using a Hibernate Query Language (HQL) query to load all existing <literal>Event</literal> objects from the database. Hibernate will generate the appropriate SQL, send it to the database and populate <literal>Event</literal> objects with the data. You can create more complex queries with HQL. See <xref linkend=\"queryhql\"/> for more information."
msgstr ""
#. Tag: para
15 years, 6 months
Hibernate SVN: r16912 - in beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests: validatorfactory and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-23 15:09:27 -0400 (Tue, 23 Jun 2009)
New Revision: 16912
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/CustomConstraintValidatorTest.java
Log:
added some explicit casts to make the suite complie against jdk5
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java 2009-06-23 18:34:33 UTC (rev 16911)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java 2009-06-23 19:09:27 UTC (rev 16912)
@@ -17,6 +17,7 @@
*/
package org.hibernate.jsr303.tck.tests.validation;
+import java.lang.annotation.Annotation;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ValidationException;
@@ -142,10 +143,9 @@
assertEquals( violation.getRootBean(), engine, "Wrong root entity." );
assertEquals( violation.getInvalidValue(), "ABCDEFGH1234", "Wrong validated value" );
assertNotNull( violation.getConstraintDescriptor(), "Constraint descriptor should not be null" );
- assertEquals(
- violation.getConstraintDescriptor().getAnnotation().annotationType(),
- Pattern.class, "Wrong annotation type"
- );
+ // cast is required for JDK 5 - at least on Mac OS X
+ Annotation ann = ( Annotation ) violation.getConstraintDescriptor().getAnnotation();
+ assertEquals( ann.annotationType(), Pattern.class, "Wrong annotation type" );
assertCorrectPropertyPaths( constraintViolations, "serialNumber" );
engine.setSerialNumber( "ABCD-EFGH-1234" );
@@ -223,7 +223,7 @@
assertEquals( "Everyone has a last name.", constraintViolation.getMessage(), "Wrong message" );
assertEquals( constraintViolation.getRootBean(), clint, "Wrong root entity" );
assertEquals( constraintViolation.getInvalidValue(), morgan.getLastName(), "Wrong value" );
- assertCorrectPropertyPaths( constraintViolations, "playedWith[0].playedWith[1].lastName");
+ assertCorrectPropertyPaths( constraintViolations, "playedWith[0].playedWith[1].lastName" );
}
@Test(expectedExceptions = IllegalArgumentException.class)
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/CustomConstraintValidatorTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/CustomConstraintValidatorTest.java 2009-06-23 18:34:33 UTC (rev 16911)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validatorfactory/CustomConstraintValidatorTest.java 2009-06-23 19:09:27 UTC (rev 16912)
@@ -62,7 +62,8 @@
@SpecAssertion(section = "2.5", id = "c")
@Test(expectedExceptions = ValidationException.class)
public void testValidationExceptionIsThrownInCaseFactoryReturnsNull() {
- Configuration<?> config = Validation.byDefaultProvider().configure().constraintValidatorFactory(
+ // cast is required for JDK 5 - at least on Mac OS X
+ Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider().configure().constraintValidatorFactory(
new ConstraintValidatorFactory() {
public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key) {
return null;
15 years, 6 months
Hibernate SVN: r16911 - core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 14:34:33 -0400 (Tue, 23 Jun 2009)
New Revision: 16911
Modified:
core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/preface.po
Log:
fixed linkend
Modified: core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/preface.po
===================================================================
--- core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/preface.po 2009-06-23 17:46:21 UTC (rev 16910)
+++ core/branches/Branch_3_3/documentation/manual/src/main/docbook/es-ES/content/preface.po 2009-06-23 18:34:33 UTC (rev 16911)
@@ -88,7 +88,7 @@
"instructions. The source code for the tutorial is included in the "
"distribution in the <literal>doc/reference/tutorial/</literal> directory."
msgstr ""
-"Lee <xref linkend=\"quickstart\"/> para un tutorial de 30 minutos, usando "
+"Lee <xref linkend=\"tutorial\"/> para un tutorial de 30 minutos, usando "
"Tomcat."
#. Tag: para
15 years, 6 months
Hibernate SVN: r16910 - core/branches/Branch_3_3/documentation.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 13:46:21 -0400 (Tue, 23 Jun 2009)
New Revision: 16910
Modified:
core/branches/Branch_3_3/documentation/pom.xml
Log:
comment out releasenotes module as it is not really up-to-date
Modified: core/branches/Branch_3_3/documentation/pom.xml
===================================================================
--- core/branches/Branch_3_3/documentation/pom.xml 2009-06-23 17:44:33 UTC (rev 16909)
+++ core/branches/Branch_3_3/documentation/pom.xml 2009-06-23 17:46:21 UTC (rev 16910)
@@ -17,7 +17,9 @@
<description>Grouping of Hibernate Core Project documentation modules</description>
<modules>
+<!--
<module>releasenotes</module>
+-->
<module>manual</module>
<!--
<module>jbosscache2</module>
15 years, 6 months
Hibernate SVN: r16909 - in core/trunk/cache-jbosscache2: src/test/java/org/hibernate/test/cache/jbc2/functional and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2009-06-23 13:44:33 -0400 (Tue, 23 Jun 2009)
New Revision: 16909
Modified:
core/trunk/cache-jbosscache2/pom.xml
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Contact.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Customer.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/Account.java
Log:
Get rid of redundant JPA annotations
Modified: core/trunk/cache-jbosscache2/pom.xml
===================================================================
--- core/trunk/cache-jbosscache2/pom.xml 2009-06-23 17:44:26 UTC (rev 16908)
+++ core/trunk/cache-jbosscache2/pom.xml 2009-06-23 17:44:33 UTC (rev 16909)
@@ -52,13 +52,6 @@
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.hibernate.java-persistence</groupId>
- <artifactId>jpa-api</artifactId>
- <version>2.0.Beta2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Contact.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Contact.java 2009-06-23 17:44:26 UTC (rev 16908)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Contact.java 2009-06-23 17:44:33 UTC (rev 16909)
@@ -24,9 +24,6 @@
package org.hibernate.test.cache.jbc2.functional;
import java.io.Serializable;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
/**
* Entity that has a many-to-one relationship to a Customer
@@ -46,7 +43,6 @@
}
- @Id
public Integer getId()
{
return id;
@@ -77,8 +73,6 @@
this.tlf = tlf;
}
- @ManyToOne
- @JoinColumn(name="CUST_ID")
public Customer getCustomer()
{
return customer;
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Customer.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Customer.java 2009-06-23 17:44:26 UTC (rev 16908)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/Customer.java 2009-06-23 17:44:33 UTC (rev 16909)
@@ -26,8 +26,6 @@
import java.io.Serializable;
import java.util.Set;
-import javax.persistence.Id;
-
/**
* Company customer
*
@@ -47,7 +45,6 @@
{
}
- @Id
public Integer getId()
{
return id;
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/Account.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/Account.java 2009-06-23 17:44:26 UTC (rev 16908)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/Account.java 2009-06-23 17:44:33 UTC (rev 16909)
@@ -31,24 +31,6 @@
* @author Brian Stansberry
* @version $Revision: 60233 $
*/
-// @NamedQuery(name="account.totalbalance.default",query="select account.balance from Account as account where account.accountHolder = ?1",
-// hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
-// @NamedQuery(name="account.totalbalance.namedregion",query="select account.balance from Account as account where account.accountHolder = ?1",
-// hints={@QueryHint(name="org.hibernate.cacheRegion",value="AccountRegion"),
-// @QueryHint(name="org.hibernate.cacheable",value="true")
-// }),
-// @NamedQuery(name="account.branch.default",query="select account.branch from Account as account where account.accountHolder = ?1",
-// hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
-// @NamedQuery(name="account.branch.namedregion",query="select account.branch from Account as account where account.accountHolder = ?1",
-// hints={@QueryHint(name="org.hibernate.cacheRegion",value="AccountRegion"),
-// @QueryHint(name="org.hibernate.cacheable",value="true")
-// }),
-// @NamedQuery(name="account.bybranch.default",query="select account from Account as account where account.branch = ?1",
-// hints={@QueryHint(name="org.hibernate.cacheable",value="true")}),
-// @NamedQuery(name="account.bybranch.namedregion",query="select account from Account as account where account.branch = ?1",
-// hints={@QueryHint(name="org.hibernate.cacheRegion",value="AccountRegion"),
-// @QueryHint(name="org.hibernate.cacheable",value="true")
-// })
public class Account implements Serializable
{
15 years, 6 months
Hibernate SVN: r16908 - core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/hql.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 13:44:26 -0400 (Tue, 23 Jun 2009)
New Revision: 16908
Modified:
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
data cleanup
Modified: core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-06-23 17:44:06 UTC (rev 16907)
+++ core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-06-23 17:44:26 UTC (rev 16908)
@@ -295,6 +295,7 @@
s.delete( top );
s.delete( next );
+ s.delete( other );
s.getTransaction().commit();
s.close();
}
15 years, 6 months
Hibernate SVN: r16907 - core/trunk/testsuite/src/test/java/org/hibernate/test/hql.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 13:44:06 -0400 (Tue, 23 Jun 2009)
New Revision: 16907
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
data cleanup
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-06-23 16:47:07 UTC (rev 16906)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-06-23 17:44:06 UTC (rev 16907)
@@ -295,6 +295,7 @@
s.delete( top );
s.delete( next );
+ s.delete( other );
s.getTransaction().commit();
s.close();
}
15 years, 6 months
Hibernate SVN: r16906 - core/branches/Branch_3_3/cache-jbosscache2.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-06-23 12:47:07 -0400 (Tue, 23 Jun 2009)
New Revision: 16906
Modified:
core/branches/Branch_3_3/cache-jbosscache2/pom.xml
Log:
HHH-3986 - Upgrade to JBossCache 3.1.0 (3.3 branch)
Modified: core/branches/Branch_3_3/cache-jbosscache2/pom.xml
===================================================================
--- core/branches/Branch_3_3/cache-jbosscache2/pom.xml 2009-06-23 16:28:21 UTC (rev 16905)
+++ core/branches/Branch_3_3/cache-jbosscache2/pom.xml 2009-06-23 16:47:07 UTC (rev 16906)
@@ -25,7 +25,7 @@
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
- <version>2.1.1.GA</version>
+ <version>3.1.0.GA</version>
</dependency>
<!-- test dependencies -->
15 years, 6 months
Hibernate SVN: r16905 - in validator/trunk/hibernate-validator/src: main/java/org/hibernate/validation/util and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-23 12:28:21 -0400 (Tue, 23 Jun 2009)
New Revision: 16905
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/PathImplTest.java
Removed:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/PropertyPath.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/PropertyPathTest.java
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorContextImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/NodeImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/PathImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java
Log:
HV-177
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorContextImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorContextImpl.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorContextImpl.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -97,7 +97,7 @@
}
public NodeBuilder inSubNode(String name) {
- PathImpl path = new PathImpl();
+ PathImpl path = PathImpl.createNewRootPath();
path.addNode( new NodeImpl( name ) );
return new NodeBuilderImpl( messageTemplate, path );
}
@@ -139,7 +139,7 @@
}
public ErrorBuilder.InIterablePropertiesBuilder inIterable() {
- return new InIterablePropertiesBuilderImpl(messageTemplate, propertyPath);
+ return new InIterablePropertiesBuilderImpl( messageTemplate, propertyPath );
}
public ErrorBuilder.InIterableNodeBuilder inSubNode(String name) {
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -32,6 +32,7 @@
import javax.validation.ConstraintViolation;
import javax.validation.MessageInterpolator;
import javax.validation.TraversableResolver;
+import javax.validation.Path;
import javax.validation.metadata.ConstraintDescriptor;
import org.hibernate.validation.metadata.MetaConstraint;
@@ -148,7 +149,7 @@
beanStack.push( object );
processedObjects = new HashMap<Class<?>, IdentitySet>();
processedPaths = new IdentityHashMap<Object, Set<PathImpl>>();
- propertyPath = new PathImpl();
+ propertyPath = PathImpl.createNewRootPath();
failingConstraintViolations = new ArrayList<ConstraintViolation<T>>();
}
@@ -227,6 +228,10 @@
propertyPath.addNode( new NodeImpl( property ) );
}
+ public void setProperty(PathImpl path) {
+ propertyPath = path;
+ }
+
/**
* Drops the last level of the current property path of this context.
*/
@@ -316,8 +321,8 @@
return false;
}
- for (PathImpl p : pathSet) {
- if (p.isSubPathOf(peekPropertyPath()) || peekPropertyPath().isSubPathOf(p)) {
+ for ( PathImpl p : pathSet ) {
+ if ( p.isSubPathOf( peekPropertyPath() ) || peekPropertyPath().isSubPathOf( p ) ) {
return true;
}
}
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/NodeImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/NodeImpl.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/NodeImpl.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -76,7 +76,7 @@
@Override
public String toString() {
- StringBuilder builder = new StringBuilder( name );
+ StringBuilder builder = new StringBuilder( name == null ? "" : name );
if ( isInIterable ) {
builder.append( INDEX_OPEN );
if ( getIndex() != null ) {
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/PathImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/PathImpl.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/PathImpl.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -20,6 +20,8 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.validation.Path;
/**
@@ -27,19 +29,44 @@
*/
public class PathImpl implements Path {
+ /**
+ * Regular expression used to split a string path into its elements.
+ *
+ * @see <a href="http://www.regexplanet.com/simple/index.jsp">Regular expression tester</a>
+ */
+ private static final Pattern pathPattern = Pattern.compile( "(\\w+)(\\[(\\w+)\\])?(\\.(.*))*" );
+
private static final String PROPERTY_PATH_SEPERATOR = ".";
- private static final String INDEX_OPEN = "[";
- private static final String INDEX_CLOSE = "]";
private static final Node ROOT_NODE = new NodeImpl( ( String ) null );
private final List<Node> nodeList;
- public PathImpl() {
- nodeList = new ArrayList<Node>();
- nodeList.add( ROOT_NODE );
+ /**
+ * Returns a {@code Path} instance representing the path described by the given string. To create a root node the empty string should be passed.
+ *
+ * @param propertyPath the path as string representation.
+ *
+ * @return a {@code Path} instance representing the path described by the given string.
+ *
+ * @throws IllegalArgumentException in case {@code property == null} or {@code property} cannot be parsed.
+ */
+ public static PathImpl createPathFromString(String propertyPath) {
+ if ( propertyPath == null ) {
+ throw new IllegalArgumentException( "null is not allowed as property path." );
+ }
+
+ if ( propertyPath.length() == 0 ) {
+ return createNewRootPath();
+ }
+
+ return parseProperty( propertyPath );
}
+ public static PathImpl createNewRootPath() {
+ return new PathImpl();
+ }
+
public PathImpl(PathImpl path) {
this.nodeList = new ArrayList<Node>();
Iterator<Node> iter = path.iterator();
@@ -48,6 +75,11 @@
}
}
+ private PathImpl() {
+ nodeList = new ArrayList<Node>();
+ nodeList.add( ROOT_NODE );
+ }
+
private PathImpl(List<Node> nodeList) {
this.nodeList = new ArrayList<Node>();
for ( Node node : nodeList ) {
@@ -143,4 +175,33 @@
public int hashCode() {
return nodeList != null ? nodeList.hashCode() : 0;
}
+
+ private static PathImpl parseProperty(String property) {
+ PathImpl path = new PathImpl();
+ String tmp = property;
+ do {
+ Matcher matcher = pathPattern.matcher( tmp );
+ if ( matcher.matches() ) {
+ String value = matcher.group( 1 );
+ String index = matcher.group( 3 );
+ NodeImpl node = new NodeImpl( value );
+ if ( index != null ) {
+ node.setInIterable( true );
+ try {
+ Integer i = Integer.parseInt( index );
+ node.setIndex( i );
+ }
+ catch ( NumberFormatException e ) {
+ node.setKey( index );
+ }
+ }
+ path.addNode( node );
+ tmp = matcher.group( 5 );
+ }
+ else {
+ throw new IllegalArgumentException( "Unable to parse property path " + property );
+ }
+ } while ( tmp != null );
+ return path;
+ }
}
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -31,6 +31,7 @@
import javax.validation.ConstraintValidatorFactory;
import javax.validation.ConstraintViolation;
import javax.validation.MessageInterpolator;
+import javax.validation.Path;
import javax.validation.TraversableResolver;
import javax.validation.ValidationException;
import javax.validation.Validator;
@@ -50,7 +51,6 @@
import org.hibernate.validation.metadata.ConstraintHelper;
import org.hibernate.validation.metadata.MetaConstraint;
import org.hibernate.validation.util.LoggerFactory;
-import org.hibernate.validation.util.PropertyPath;
import org.hibernate.validation.util.ReflectionHelper;
/**
@@ -130,7 +130,9 @@
GroupChain groupChain = determineGroupExecutionOrder( groups );
List<ConstraintViolation<T>> failingConstraintViolations = new ArrayList<ConstraintViolation<T>>();
- validateProperty( object, new PropertyPath( propertyName ), failingConstraintViolations, groupChain );
+ validateProperty(
+ object, PathImpl.createPathFromString( propertyName ), failingConstraintViolations, groupChain
+ );
return new HashSet<ConstraintViolation<T>>( failingConstraintViolations );
}
@@ -146,7 +148,9 @@
GroupChain groupChain = determineGroupExecutionOrder( groups );
List<ConstraintViolation<T>> failingConstraintViolations = new ArrayList<ConstraintViolation<T>>();
- validateValue( beanType, value, new PropertyPath( propertyName ), failingConstraintViolations, groupChain );
+ validateValue(
+ beanType, value, PathImpl.createPathFromString( propertyName ), failingConstraintViolations, groupChain
+ );
return new HashSet<ConstraintViolation<T>>( failingConstraintViolations );
}
@@ -384,7 +388,7 @@
}
}
- private <T> void validateProperty(T object, PropertyPath propertyPath, List<ConstraintViolation<T>> failingConstraintViolations, GroupChain groupChain) {
+ private <T> void validateProperty(T object, PathImpl propertyPath, List<ConstraintViolation<T>> failingConstraintViolations, GroupChain groupChain) {
@SuppressWarnings("unchecked")
final Class<T> beanType = ( Class<T> ) object.getClass();
@@ -443,7 +447,7 @@
private <T> void validatePropertyForGroup(
T object,
- PropertyPath propertyIter,
+ PathImpl path,
List<ConstraintViolation<T>> failingConstraintViolations,
Set<MetaConstraint<T, ?>> metaConstraints,
Object hostingBeanInstance,
@@ -470,13 +474,12 @@
constraintValidatorFactory,
cachedTraversableResolver
);
- context.pushProperty( propertyIter.getOriginalProperty() );
+ context.setProperty( path );
context.setCurrentGroup( groupClass );
if ( context.isValidationRequired( metaConstraint ) ) {
metaConstraint.validateConstraint( context );
failingConstraintViolations.addAll( context.getFailingConstraints() );
}
- context.popProperty();
}
if ( failingConstraintViolations.size() > numberOfConstraintViolationsBefore ) {
break;
@@ -485,7 +488,7 @@
}
@SuppressWarnings("unchecked")
- private <T> void validateValue(Class<T> beanType, Object value, PropertyPath propertyPath, List<ConstraintViolation<T>> failingConstraintViolations, GroupChain groupChain) {
+ private <T> void validateValue(Class<T> beanType, Object value, PathImpl propertyPath, List<ConstraintViolation<T>> failingConstraintViolations, GroupChain groupChain) {
Set<MetaConstraint<T, ?>> metaConstraints = new HashSet<MetaConstraint<T, ?>>();
collectMetaConstraintsForPath( beanType, null, propertyPath.iterator(), metaConstraints );
@@ -537,7 +540,7 @@
private <T> void validateValueForGroup(
Class<T> beanType,
Object value,
- PropertyPath propertyIter,
+ PathImpl path,
List<ConstraintViolation<T>> failingConstraintViolations,
Set<MetaConstraint<T, ?>> metaConstraints,
Group group,
@@ -560,13 +563,12 @@
ExecutionContext<T> context = ExecutionContext.getContextForValidateValue(
beanType, value, messageInterpolator, constraintValidatorFactory, cachedTraversableResolver
);
- context.pushProperty( propertyIter.getOriginalProperty() );
+ context.setProperty( path );
context.setCurrentGroup( groupClass );
if ( context.isValidationRequired( metaConstraint ) ) {
metaConstraint.validateConstraint( value, context );
failingConstraintViolations.addAll( context.getFailingConstraints() );
}
- context.popProperty();
}
if ( failingConstraintViolations.size() > numberOfConstraintViolations ) {
break;
@@ -588,23 +590,27 @@
* @return Returns the bean hosting the constraints which match the specified property path.
*/
@SuppressWarnings("unchecked")
- private <T> Object collectMetaConstraintsForPath(Class<T> clazz, Object value, Iterator<PropertyPath.PathElement> propertyIter, Set<MetaConstraint<T, ?>> metaConstraints) {
+ private <T> Object collectMetaConstraintsForPath(Class<T> clazz, Object value, Iterator<Path.Node> propertyIter, Set<MetaConstraint<T, ?>> metaConstraints) {
- PropertyPath.PathElement elem = propertyIter.next();
+ Path.Node elem = propertyIter.next();
+ if ( elem.getName() == null ) { // skip root node
+ elem = propertyIter.next();
+ }
+
final BeanMetaData<T> metaData = getBeanMetaData( clazz );
if ( !propertyIter.hasNext() ) {
//use metadata first as ReflectionHelper#containsMember is slow
//TODO store some metadata here?
- if ( metaData.getPropertyDescriptor( elem.value() ) == null
- && !ReflectionHelper.containsMember( clazz, elem.value() ) ) {
+ if ( metaData.getPropertyDescriptor( elem.getName() ) == null
+ && !ReflectionHelper.containsMember( clazz, elem.getName() ) ) {
//TODO better error report
throw new IllegalArgumentException( "Invalid property path." );
}
List<MetaConstraint<T, ? extends Annotation>> metaConstraintList = metaData.geMetaConstraintList();
for ( MetaConstraint<T, ?> metaConstraint : metaConstraintList ) {
- if ( metaConstraint.getPropertyName().equals( elem.value() ) ) {
+ if ( metaConstraint.getPropertyName().equals( elem.getName() ) ) {
metaConstraints.add( metaConstraint );
}
}
@@ -612,17 +618,23 @@
else {
List<Member> cascadedMembers = metaData.getCascadedMembers();
for ( Member m : cascadedMembers ) {
- if ( ReflectionHelper.getPropertyName( m ).equals( elem.value() ) ) {
+ if ( ReflectionHelper.getPropertyName( m ).equals( elem.getName() ) ) {
Type type = ReflectionHelper.typeOf( m );
value = value == null ? null : ReflectionHelper.getValue( m, value );
- if ( elem.isIndexed() ) {
- value = value == null ? null : ReflectionHelper.getIndexedValue(
- value, elem.getIndex()
- );
+ if ( elem.isInIterable() ) {
+ if ( value != null && elem.getIndex() != null ) {
+ value = ReflectionHelper.getIndexedValue( value, elem.getIndex() );
+ }
+ else if ( value != null && elem.getKey() != null ) {
+
+ }
type = ReflectionHelper.getIndexedType( type );
}
return collectMetaConstraintsForPath(
- ( Class<T> ) ( value == null ? type : value.getClass() ), value, propertyIter, metaConstraints
+ ( Class<T> ) ( value == null ? type : value.getClass() ),
+ value,
+ propertyIter,
+ metaConstraints
);
}
}
Deleted: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/PropertyPath.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/PropertyPath.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/PropertyPath.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -1,125 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.validation.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-/**
- * Helper class to iterate over a property path.
- *
- * @author Hardy Ferentschik
- */
-public class PropertyPath implements Iterable<PropertyPath.PathElement> {
-
- /**
- * Regular expression used to split the path into its elements.
- *
- * @see <a href="http://www.regexplanet.com/simple/index.jsp">Regular expression tester</a>
- */
- private static final Pattern pathPattern = Pattern.compile( "(\\w+)(\\[(\\w+)\\])?(\\.(.*))*" );
-
- final String originalProperty;
-
- final List<PathElement> pathList = new ArrayList<PathElement>();
-
- /**
- * Constructs a new {@code PropertyPath}.
- *
- * @param property The string representation of the property path.
- *
- * @throws IllegalArgumentException in case {@code property == null} or {@code property} cannot be parsed.
- */
- public PropertyPath(String property) {
- if ( property == null ) {
- throw new IllegalArgumentException( "null is not allowed as property path." );
- }
-
- this.originalProperty = property;
- if ( property.length() > 0 ) {
- parseProperty( property );
- }
- }
-
- private void parseProperty(String property) {
- String tmp = property;
- do {
- Matcher matcher = pathPattern.matcher( tmp );
- if ( matcher.matches() ) {
- String value = matcher.group( 1 );
- String index = matcher.group( 3 );
- PathElement elem = new PathElement( value, index );
- pathList.add( elem );
- tmp = matcher.group( 5 );
- }
- else {
- throw new IllegalArgumentException( "Unable to parse property path " + property );
- }
- } while ( tmp != null );
- }
-
- public String getOriginalProperty() {
- return originalProperty;
- }
-
- public Iterator<PathElement> iterator() {
- return pathList.iterator();
- }
-
- @Override
- public String toString() {
- return "PropertyPath{" +
- "originalProperty='" + originalProperty + '\'' +
- ", pathList=" + pathList +
- '}';
- }
-
- public static class PathElement {
- private final String value;
- private final String index;
-
- private PathElement(String value, String index) {
- this.value = value;
- this.index = index;
- }
-
- public String value() {
- return value;
- }
-
- public String getIndex() {
- return index;
- }
-
- public boolean isIndexed() {
- return index != null;
- }
-
- @Override
- public String toString() {
- return "PathElement{" +
- "value='" + value + '\'' +
- ", index='" + index + '\'' +
- '}';
- }
- }
-}
\ No newline at end of file
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -305,45 +305,29 @@
* @return The indexed value or <code>null</code> if <code>value</code> is <code>null</code> or not a collection or array.
* <code>null</code> is also returned in case the index does not exist.
*/
- public static Object getIndexedValue(Object value, String index) {
+ public static Object getIndexedValue(Object value, Integer index) {
if ( value == null ) {
return null;
}
- // try to create the index
- int numIndex = -1;
- try {
- numIndex = Integer.valueOf( index );
- }
- catch ( NumberFormatException nfe ) {
- // ignore
- }
-
- if ( numIndex == -1 ) { // must be a map indexed by string
- Map<?, ?> map = ( Map<?, ?> ) value;
- //noinspection SuspiciousMethodCalls
- return map.get( index );
- }
-
- Iterator<?> iter = null;
+ Iterator<?> iter;
Type type = value.getClass();
if ( isIterable( type ) ) {
iter = ( ( Iterable<?> ) value ).iterator();
}
- else if ( isMap( type ) ) {
- Map<?, ?> map = ( Map<?, ?> ) value;
- iter = map.values().iterator();
- }
else if ( TypeUtils.isArray( type ) ) {
- List<?> arrayList = Arrays.asList( (Object) value );
+ List<?> arrayList = Arrays.asList( ( Object ) value );
iter = arrayList.iterator();
}
+ else {
+ return null;
+ }
int i = 0;
Object o;
while ( iter.hasNext() ) {
o = iter.next();
- if ( i == numIndex ) {
+ if ( i == index ) {
return o;
}
i++;
@@ -352,6 +336,25 @@
}
/**
+ * Tries to retrieve the mapped value from the specified object.
+ *
+ * @param value The object from which to retrieve the mapped value. The object has to be non {@code null} and
+ * must implement the @{code Map} interface.
+ * @param key The map key. index.
+ *
+ * @return The mapped value or {@code null} if {@code value} is {@code null} or not implementing @{code Map}.
+ */
+ public static Object getMappedValue(Object value, Object key) {
+ if ( value == null || !( value instanceof Map ) ) {
+ return null;
+ }
+
+ Map<?, ?> map = ( Map<?, ?> ) value;
+ //noinspection SuspiciousMethodCalls
+ return map.get( key );
+ }
+
+ /**
* Checks whether the specified class contains a field or property matching the given name.
*
* @param clazz The class to check.
@@ -520,7 +523,7 @@
* @param clazz @{code Class} to check.
* @param superClassOrInterface The super class/interface {@code clazz}.
*
- * @return {@code true} if {@code clazz} extends or implements {@code superClassOrInterface}, {@code false} otherwise.
+ * @return {@code true} if {@code clazz} extends or implements {@code superClassOrInterface}, {@code false} otherwise.
*/
private static boolean extendsOrImplements(Class<?> clazz, Class<?> superClassOrInterface) {
List<Class<?>> classes = new ArrayList<Class<?>>();
Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/PathImplTest.java (from rev 16866, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/PropertyPathTest.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/PathImplTest.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/PathImplTest.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -0,0 +1,129 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, 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.validation.engine;
+
+import java.util.Iterator;
+import javax.validation.Path;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class PathImplTest {
+
+ @Test
+ public void testParsing() {
+ String property = "order[3].deliveryAddress.addressline[1]";
+ Path path = PathImpl.createPathFromString( property );
+ Iterator<Path.Node> propIter = path.iterator();
+
+ assertTrue( propIter.hasNext() );
+ Path.Node elem = propIter.next();
+ assertEquals( null, elem.getName() );
+ assertFalse( elem.isInIterable() );
+ assertEquals( property, path.toString() );
+
+ assertTrue( propIter.hasNext() );
+ elem = propIter.next();
+ assertEquals( "order", elem.getName() );
+ assertTrue( elem.isInIterable() );
+ assertEquals( new Integer( 3 ), elem.getIndex() );
+
+ assertTrue( propIter.hasNext() );
+ elem = propIter.next();
+ assertEquals( "deliveryAddress", elem.getName() );
+ assertFalse( elem.isInIterable() );
+ assertEquals( null, elem.getIndex() );
+
+ assertTrue( propIter.hasNext() );
+ elem = propIter.next();
+ assertEquals( "addressline", elem.getName() );
+ assertTrue( elem.isInIterable() );
+ assertEquals( new Integer( 1 ), elem.getIndex() );
+
+ assertFalse( propIter.hasNext() );
+ }
+
+ @Test
+ public void testParseMapBasedProperty() {
+ String property = "order[foo].deliveryAddress";
+ Path path = PathImpl.createPathFromString( property );
+ Iterator<Path.Node> propIter = path.iterator();
+
+ assertTrue( propIter.hasNext() );
+ Path.Node elem = propIter.next();
+ assertEquals( null, elem.getName() );
+ assertFalse( elem.isInIterable() );
+ assertEquals( property, path.toString() );
+
+ assertTrue( propIter.hasNext() );
+ elem = propIter.next();
+ assertEquals( "order", elem.getName() );
+ assertTrue( elem.isInIterable() );
+ assertEquals( "foo", elem.getKey() );
+
+ assertTrue( propIter.hasNext() );
+ elem = propIter.next();
+ assertEquals( "deliveryAddress", elem.getName() );
+ assertFalse( elem.isInIterable() );
+ assertEquals( null, elem.getIndex() );
+
+ assertFalse( propIter.hasNext() );
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testNull() {
+ PathImpl.createPathFromString( null );
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testUnbalancedBraces() {
+ PathImpl.createPathFromString( "foo[.bar" );
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testIndexInMiddleOfProperty() {
+ PathImpl.createPathFromString( "f[1]oo.bar" );
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testTrailingPathSeperator() {
+ PathImpl.createPathFromString( "foo.bar." );
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testLeadingPathSeperator() {
+ PathImpl.createPathFromString( ".foo.bar" );
+ }
+
+ @Test
+ public void testEmptyString() {
+ Path path = PathImpl.createPathFromString( "" );
+ assertTrue( path.iterator().hasNext() );
+ }
+
+ @Test
+ public void testRootPath() {
+ Path path = PathImpl.createNewRootPath();
+ assertEquals( path.toString(), "", "Wrong string representation of root property." );
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/PathImplTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/PropertyPathTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/PropertyPathTest.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/PropertyPathTest.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -1,92 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, 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.validation.util;
-
-import java.util.Iterator;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-/**
- * @author Hardy Ferentschik
- */
-public class PropertyPathTest {
-
- @Test
- public void testParsing() {
- String property = "order[3].deliveryAddress.addressline[1]";
- PropertyPath path = new PropertyPath( property );
- Iterator<PropertyPath.PathElement> propIter = path.iterator();
-
- assertTrue( propIter.hasNext() );
-
- PropertyPath.PathElement elem = propIter.next();
- assertTrue( propIter.hasNext() );
- assertEquals( "order", elem.value() );
- assertTrue( elem.isIndexed() );
- assertEquals( "3", elem.getIndex() );
- assertEquals( property, path.getOriginalProperty() );
-
- assertTrue( propIter.hasNext() );
- elem = propIter.next();
- assertEquals( "deliveryAddress", elem.value() );
- assertFalse( elem.isIndexed() );
- assertEquals( null, elem.getIndex() );
-
- assertTrue( propIter.hasNext() );
- elem = propIter.next();
- assertEquals( "addressline", elem.value() );
- assertTrue( elem.isIndexed() );
- assertEquals( "1", elem.getIndex() );
-
- assertFalse( propIter.hasNext() );
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testNull() {
- new PropertyPath( null );
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testUnbalancedBraces() {
- new PropertyPath( "foo[.bar" );
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testIndexInMiddleOfProperty() {
- new PropertyPath( "f[1]oo.bar" );
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testTrailingPathSeperator() {
- new PropertyPath( "foo.bar." );
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testLeadingPathSeperator() {
- new PropertyPath( ".foo.bar" );
- }
-
- @Test
- public void testEmptyString() {
- PropertyPath path = new PropertyPath( "" );
- assertFalse( path.iterator().hasNext() );
- }
-}
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java 2009-06-23 16:27:28 UTC (rev 16904)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java 2009-06-23 16:28:21 UTC (rev 16905)
@@ -27,8 +27,8 @@
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeSet;
-import javax.validation.ValidationException;
import javax.validation.ConstraintPayload;
+import javax.validation.ValidationException;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
@@ -51,7 +51,7 @@
Type type = TestTypes.class.getField( "stringList" ).getGenericType();
assertTrue( ReflectionHelper.isIterable( type ) );
- assertTrue( ReflectionHelper.isIterable( new TreeSet<Object>().getClass() ) );
+ assertTrue( ReflectionHelper.isIterable( TreeSet.class ) );
assertTrue( ReflectionHelper.isIterable( List.class ) );
assertTrue( ReflectionHelper.isIterable( HashSet.class ) );
@@ -93,17 +93,13 @@
String key = "key";
map.put( key, testObject );
- Object value = ReflectionHelper.getIndexedValue( map, key );
+ Object value = ReflectionHelper.getMappedValue( map, key );
assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
- // try to get to the value by integer index
- value = ReflectionHelper.getIndexedValue( map, "0" );
- assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
-
- value = ReflectionHelper.getIndexedValue( map, "foo" );
+ value = ReflectionHelper.getMappedValue( map, "foo" );
assertNull( value, "A non existent index should return the null value" );
- value = ReflectionHelper.getIndexedValue( map, "2" );
+ value = ReflectionHelper.getMappedValue( map, "2" );
assertNull( value, "A non existent index should return the null value" );
}
@@ -113,16 +109,16 @@
Object testObject = new Object();
list.add( testObject );
- Object value = ReflectionHelper.getIndexedValue( list, "0" );
+ Object value = ReflectionHelper.getIndexedValue( list, 0 );
assertEquals( value, testObject, "We should be able to retrieve the indexed object" );
- value = ReflectionHelper.getIndexedValue( list, "2" );
+ value = ReflectionHelper.getIndexedValue( list, 2 );
assertNull( value, "A non existent index should return the null value" );
}
@Test
public void testGetIndexedValueForNull() {
- Object value = ReflectionHelper.getIndexedValue( null, "0" );
+ Object value = ReflectionHelper.getIndexedValue( null, 0 );
assertNull( value );
}
@@ -138,7 +134,7 @@
}
public Class<? extends ConstraintPayload>[] payload() {
- @SuppressWarnings( "unchecked")
+ @SuppressWarnings("unchecked")
Class<? extends ConstraintPayload>[] classes = new Class[] { };
return classes;
}
15 years, 6 months