Hibernate SVN: r15942 - validator/trunk.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-02-11 09:09:31 -0500 (Wed, 11 Feb 2009)
New Revision: 15942
Modified:
validator/trunk/pom.xml
Log:
removed the api as module
Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml 2009-02-11 13:35:58 UTC (rev 15941)
+++ validator/trunk/pom.xml 2009-02-11 14:09:31 UTC (rev 15942)
@@ -39,7 +39,6 @@
</mailingLists>
<modules>
- <module>validation-api</module>
<module>hibernate-validator</module>
<module>hibernate-validator-legacy</module>
</modules>
15 years, 3 months
Hibernate SVN: r15941 - beanvalidation.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-02-11 08:35:58 -0500 (Wed, 11 Feb 2009)
New Revision: 15941
Added:
beanvalidation/branches/
Log:
Created directory 'beanvalidation/branches'.
15 years, 3 months
Hibernate SVN: r15940 - beanvalidation.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-02-11 08:35:11 -0500 (Wed, 11 Feb 2009)
New Revision: 15940
Added:
beanvalidation/tags/
Log:
Created directory 'beanvalidation/tags'.
15 years, 3 months
Hibernate SVN: r15938 - validator/trunk/hibernate-validator/src/main/docbook/en-US/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-02-11 07:59:15 -0500 (Wed, 11 Feb 2009)
New Revision: 15938
Modified:
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
Log:
updated the documentation for the alpha rlease
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml 2009-02-11 11:55:31 UTC (rev 15937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml 2009-02-11 12:59:15 UTC (rev 15938)
@@ -136,21 +136,16 @@
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.Alpha1</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.0.Beta3</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.0.0.Alpha1</version>
- </dependency>
</dependencies>
<build>
<plugins>
15 years, 3 months
Hibernate SVN: r15937 - in validator/trunk/hibernate-validator/src/main/docbook/en-US: modules and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-02-11 06:55:31 -0500 (Wed, 11 Feb 2009)
New Revision: 15937
Modified:
validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
Log:
updated the documentation for the alpha rlease
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml 2009-02-11 10:00:19 UTC (rev 15936)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml 2009-02-11 11:55:31 UTC (rev 15937)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id:$ -->
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
@@ -22,75 +23,118 @@
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY versionNumber "4.0.0.Alpha1">
- <!ENTITY copyrightYear "2009">
- <!ENTITY copyrightHolder "Red Hat Middleware, LLC. & Gunnar Morling">
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY versionNumber "4.0.0.Alpha1">
+<!ENTITY copyrightYear "2009">
+<!ENTITY copyrightHolder "Red Hat Middleware, LLC.">
]>
-
<book lang="en">
- <bookinfo>
- <title>Hibernate Validator (Bean Validation API reference implementation)</title>
- <subtitle>Reference Guide</subtitle>
- <releaseinfo>&versionNumber;</releaseinfo>
- <productnumber>&versionNumber;</productnumber>
- <issuenum>1</issuenum>
- <mediaobject>
- <imageobject>
- <imagedata fileref="hibernate_logo_a.png" format="png" />
- </imageobject>
- </mediaobject>
- <copyright>
- <year>©rightYear;</year>
- <holder>©rightHolder;</holder>
- </copyright>
- <!-- include translators... -->
- </bookinfo>
+ <bookinfo>
+ <title>Hibernate Validator</title>
- <toc/>
+ <subtitle>JSR 303 Reference Implementation</subtitle>
+ <subtitle>Reference Guide</subtitle>
+
+ <releaseinfo>&versionNumber;</releaseinfo>
+
+ <productnumber>&versionNumber;</productnumber>
+
+ <issuenum>1</issuenum>
+
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="hibernate_logo_a.png" align="center" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="hibernate_logo_a.png" depth="3cm" />
+ </imageobject>
+ </mediaobject>
+
+ <copyright>
+ <year>©rightYear;</year>
+
+ <holder>©rightHolder;</holder>
+ </copyright>
+ </bookinfo>
+
+ <toc></toc>
+
+ <preface>
+ <title>Preface Alpha Release</title>
+
+ <para>This release has alpha status, meaning that neither the
+ implementation nor this documenation is complete. However, implementation
+ should be in a state allowing first experiments with this new API. The
+ following list shows the missing features in relation to the latest
+ version of JSR 303:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Group inheritance using interfaces and implicit grouping</para>
+ </listitem>
+
+ <listitem>
+ <para>Implementation of the <classname>TraversableResolver</classname>
+ interface to allow integration with JPA</para>
+ </listitem>
+
+ <listitem>
+ <para>Polymorphism in graph validation </para>
+ </listitem>
+
+ <listitem>
+ <para>XML configuration</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>You can find more information about the current state of the
+ implementation on the <ulink url="http://www.hibernate.org/459.html">Bean
+ Validation Roadmap</ulink>. </para>
+
+ <para>The documentation contains so far only a "Getting started" section.
+ Work is in progress in this area and following releases will have more up
+ to date documentation. For now refer to <ulink
+ url="http://hibernate.org/~emmanuel/validation/">JSR 303</ulink> directly
+ for further examples.</para>
+
+ <para>Please report any problems or bugs in either <ulink
+ url="http://opensource.atlassian.com/projects/hibernate/browse/HV">Jira
+ Hibernate Validator</ulink> or on the <ulink url="http://forum.hibernate.org/viewforum.php?f=9">Validator
+ Forum</ulink>.</para>
+ </preface>
+
<preface id="preface" revision="2">
<title>Preface</title>
- <para>Annotations are a very convenient and elegant way to specify
- invariant constraints for a domain model. You can, for example, express
- that a property should never be null, that the account balance should be
- strictly positive, etc. These domain model constraints are declared in the
- bean itself by annotating its properties. A validator can then read them
- and check for constraint violations. The validation mechanism can be
- executed in different layers in your application without having to
- duplicate any of these rules (presentation layer, data access layer).
- Following the DRY principle, Hibernate Validator has been designed for
- that purpose.</para>
+ <para>Validating data is a common task that occurs throughout an
+ application, from the presentation layer to the persistence layer. Often
+ the same validation logic is implemented in each layer, proving time
+ consuming and error-prone. To avoid duplication of these validations in
+ each layer, developers often bundle validation logic directly into the
+ domain model, cluttering domain classes with validation code that is, in
+ fact, metadata about the class itself.</para>
- <para>Hibernate Validator works at two levels. First, it is able to check
- in-memory instances of a class for constraint violations. Second, it can
- apply the constraints to the Hibernate metamodel and incorporate them into
- the generated database schema.</para>
+ <para>JSR 303 - Bean Validation - defines a metadata model and API for
+ JavaBean validation. The default metadata source is annotations, with the
+ ability to override and extend the meta-data through the use of XML
+ validation descriptors. The API is not tied to a specific application tier
+ or programming model. It is specifically not tied to either the web tier
+ or the persistence tier, and is available for both server-side application
+ programming, as well as rich client Swing application developers.</para>
- <para>Each constraint annotation is associated to a validator
- implementation responsible for checking the constraint on the entity
- instance. A validator can also (optionally) apply the constraint to the
- Hibernate metamodel, allowing Hibernate to generate DDL that expresses the
- constraint. With the appropriate event listener, you can execute the
- checking operation on inserts and updates done by Hibernate. Hibernate
- Validator is not limited to use with Hibernate. You can easily use it
- anywhere in your application as well as with any Java Persistence provider
- (entity listener provided).</para>
-
- <para>When checking instances at runtime, Hibernate Validator returns
- information about constraint violations in an array of
- <classname>InvalidValue</classname> s. Among other information, the
- <classname>InvalidValue</classname> contains an error description message
- that can embed the parameter values bundle with the annotation (eg. length
- limit), and message strings that may be externalized to a
- <classname>ResourceBundle</classname> .</para>
+ <para>Hibernate Validator is an implementation of this JSR.</para>
</preface>
<!-- For the alpha release we will just include the getting started section, since the others are work in progress -->
+
<!--xi:include href="modules/introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /-->
- <xi:include href="modules/gettingstarted.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-<!--
+
+ <xi:include href="modules/gettingstarted.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <!--
<xi:include href="modules/usingvalidator.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="modules/customconstraints.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="modules/xmlconfiguration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
@@ -98,7 +142,7 @@
<xi:include href="modules/extendedri.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-->
-<!--
+ <!--
<xi:include href="modules/defineconstraints.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="modules/checkconstraints.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-->
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml 2009-02-11 10:00:19 UTC (rev 15936)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml 2009-02-11 11:55:31 UTC (rev 15937)
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id:$ -->
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
@@ -25,7 +26,7 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="validator-gettingstarted">
- <title>Getting started with Bean Validation RI in 5 minutes</title>
+ <title>Getting started in 5 minutes</title>
<para>This chapter will show you how to quickly get started with the
reference implementation (RI) of the Bean Validation API as specified by
@@ -35,7 +36,7 @@
<itemizedlist>
<listitem>
<para>As the Bean Validation API expresses constraints by the means of
- annotations, Java version 5 is or later must be installed</para>
+ annotations, Java version 5 or later must be installed</para>
</listitem>
<listitem>
@@ -46,28 +47,28 @@
functioning internet connection is required to allow Maven for the
download of all dependent libraries</para>
</listitem>
+
+ <listitem>
+ <para>Once Maven is installed you should configure your remote
+ repository by adding the following to your
+ <filename>settings.xml</filename>: <programlisting><repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.com/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+</repositories></programlisting>More information about
+ <filename>settings.xml</filename> can be found in the <ulink
+ url="http://maven.apache.org/ref/2.0.8/maven-settings/settings.html">Maven
+ Local Settings Model</ulink>.</para>
+ </listitem>
</itemizedlist>
- <section id="validator-gettingstarted-buildri" revision="1">
- <title>Build RI. TODO GM: Remove, if RI is in repo</title>
-
- <para>As the Bean Validation RI is not yet published in any Maven
- repository, you have to check it out from the Subversion repository at
- JBoss and build it yourself. The project can be checked out as
- follows:</para>
-
- <programlisting>svn co http://anonsvn.jboss.org/repos/hibernate/validator/trunk/</programlisting>
-
- <para>If all files are checked out, change into the trunk dir and build
- the reference implementation by running</para>
-
- <programlisting>mvn install</programlisting>
-
- <para>If the build has completed, the JSR 303 API and the reference
- implementation have been installed into your local Maven repository and
- can now be used in your projects.</para>
- </section>
-
<section id="validator-gettingstarted-createproject" revision="1">
<title>Setting up a new Maven project</title>
@@ -123,8 +124,7 @@
</listitem>
</itemizedlist>
- <para>Having done this, your pom.xml should look like this (TODO GM: keep
- an eye on versions):</para>
+ <para>Having done this, your pom.xml should look like this:</para>
<programlisting><project
xmlns="http://maven.apache.org/POM/4.0.0"
@@ -144,12 +144,12 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.Beta3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>4.0.0.Alpha1</version>
</dependency>
</dependencies>
<build>
15 years, 3 months
Hibernate SVN: r15936 - validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-02-11 05:00:19 -0500 (Wed, 11 Feb 2009)
New Revision: 15936
Added:
validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_fr.properties
Modified:
validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages.properties
validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_de.properties
Log:
added french properties file
Modified: validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages.properties
===================================================================
--- validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages.properties 2009-02-11 09:29:51 UTC (rev 15935)
+++ validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages.properties 2009-02-11 10:00:19 UTC (rev 15936)
@@ -9,3 +9,5 @@
validator.null=must be null
validator.past=must be in the past
validator.future=must be in the future
+validator.assertTrue=must be true
+validator.assertFalse=must be false
Modified: validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_de.properties
===================================================================
--- validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_de.properties 2009-02-11 09:29:51 UTC (rev 15935)
+++ validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_de.properties 2009-02-11 10:00:19 UTC (rev 15936)
@@ -4,8 +4,10 @@
validator.length=muss zwischen {min} und {max} liegen
validator.notEmpty=kann nicht leer sein
validator.pattern=muss auf Ausdruck "{regex}" passen
-validator.min=muss grösser sein als {value}
+validator.min=muss gr\u00F6\u00DFer sein als {value}
validator.max=muss kleiner sein als {value}
validator.null=muss null sein
validator.past=muss in der Vergangenheit liegen
validator.future=muss in der Zukunft liegen
+validator.assertTrue=muss wahr sein
+validator.assertFalse=muss falsch sein
Copied: validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_fr.properties (from rev 15930, validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_de.properties)
===================================================================
--- validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_fr.properties (rev 0)
+++ validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_fr.properties 2009-02-11 10:00:19 UTC (rev 15936)
@@ -0,0 +1,11 @@
+# $Id: ValidationMessages.properties 15846 2009-02-02 11:56:15Z hardy.ferentschik $
+validator.notNull=ne peut pas \u00EAtre nul
+validator.size=la taille doit \u00EAtre entre {min} et {max}
+validator.length=length must be between {min} and {max}
+validator.notEmpty=ne peut pas \u00EAtre vide
+validator.pattern=doit suivre "{regex}"
+validator.min=doit \u00EAtre plus grand que {value}
+validator.max=doit \u00EAtre plus petit que {value}
+validator.null=doit \u00EAtre nul
+validator.past=doit \u00EAtre dans le pass\u00E9
+validator.future=doit \u00EAtre dans le futur
Property changes on: validator/trunk/hibernate-validator/src/main/resources/org/hibernate/validation/ValidationMessages_fr.properties
___________________________________________________________________
Name: svn:mergeinfo
+
15 years, 3 months
Hibernate SVN: r15935 - in core/branches/envers-hibernate-3.3/src: main/java/org/hibernate/envers/synchronization/work and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-02-11 04:29:51 -0500 (Wed, 11 Feb 2009)
New Revision: 15935
Added:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java
Removed:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java
core/branches/envers-hibernate-3.3/src/test/resources/testng.xml
Log:
svn merge -r 15899:15934 https://svn.jboss.org/repos/hibernate/core/trunk/envers .
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -57,6 +57,7 @@
import org.hibernate.event.PreCollectionUpdateEvent;
import org.hibernate.event.PreCollectionUpdateEventListener;
import org.hibernate.persister.entity.EntityPersister;
+import org.hibernate.persister.collection.AbstractCollectionPersister;
import org.hibernate.proxy.HibernateProxy;
/**
@@ -206,7 +207,7 @@
AuditSync verSync = verCfg.getSyncManager().get(event.getSession());
PersistentCollectionChangeWorkUnit workUnit = new PersistentCollectionChangeWorkUnit(entityName, verCfg,
- newColl, collectionEntry.getRole(), oldColl, event.getAffectedOwnerIdOrNull());
+ newColl, collectionEntry, oldColl, event.getAffectedOwnerIdOrNull());
verSync.addWorkUnit(workUnit);
if (workUnit.containsWork()) {
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/synchronization/work/PersistentCollectionChangeWorkUnit.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -32,6 +32,8 @@
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.Session;
+import org.hibernate.persister.collection.AbstractCollectionPersister;
+import org.hibernate.engine.CollectionEntry;
import org.hibernate.collection.PersistentCollection;
/**
@@ -42,11 +44,12 @@
private final String referencingPropertyName;
public PersistentCollectionChangeWorkUnit(String entityName, AuditConfiguration verCfg,
- PersistentCollection collection, String role,
+ PersistentCollection collection, CollectionEntry collectionEntry,
Serializable snapshot, Serializable id) {
super(entityName, verCfg, null);
- referencingPropertyName = role.substring(entityName.length() + 1);
+ String ownerEntityName = ((AbstractCollectionPersister) collectionEntry.getLoadedPersister()).getOwnerEntityName();
+ referencingPropertyName = collectionEntry.getRole().substring(ownerEntityName.length() + 1);
collectionChanges = verCfg.getEntCfg().get(getEntityName()).getPropertyMapper()
.mapCollectionChanges(referencingPropertyName, collection, snapshot, id);
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional (from rev 15934, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional)
Deleted: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -1,73 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
-
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.InheritanceType;
-
-import org.hibernate.envers.Audited;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-@Inheritance(strategy = InheritanceType.JOINED)
-public abstract class AbstractContainedEntity {
- @Id
- @GeneratedValue
- private Long id;
-
- public AbstractContainedEntity() {
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof AbstractContainedEntity)) return false;
-
- AbstractContainedEntity that = (AbstractContainedEntity) o;
-
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return id != null ? id.hashCode() : 0;
- }
-}
\ No newline at end of file
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java (from rev 15934, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractContainedEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -0,0 +1,73 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+
+package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.InheritanceType;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+@Inheritance(strategy = InheritanceType.JOINED)
+public abstract class AbstractContainedEntity {
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ public AbstractContainedEntity() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AbstractContainedEntity)) return false;
+
+ AbstractContainedEntity that = (AbstractContainedEntity) o;
+
+ if (id != null ? !id.equals(that.id) : that.id != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
+}
\ No newline at end of file
Deleted: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -1,71 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.OneToMany;
-
-import org.hibernate.envers.Audited;
-
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Inheritance(strategy = InheritanceType.JOINED)
-@Audited
-public abstract class AbstractSetEntity {
- @Id
- @GeneratedValue
- private Integer id;
-
- @OneToMany
- private Set<AbstractContainedEntity> entities = new HashSet<AbstractContainedEntity>();
-
- public AbstractSetEntity() {
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Set<AbstractContainedEntity> getEntities() {
- return entities;
- }
-
- public void setEntities(Set<AbstractContainedEntity> entities) {
- this.entities = entities;
- }
-}
\ No newline at end of file
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java (from rev 15934, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/AbstractSetEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+
+package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.OneToMany;
+
+import org.hibernate.envers.Audited;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+@Audited
+public abstract class AbstractSetEntity {
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ @OneToMany
+ private Set<AbstractContainedEntity> entities = new HashSet<AbstractContainedEntity>();
+
+ public AbstractSetEntity() {
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Set<AbstractContainedEntity> getEntities() {
+ return entities;
+ }
+
+ public void setEntities(Set<AbstractContainedEntity> entities) {
+ this.entities = entities;
+ }
+}
\ No newline at end of file
Deleted: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -1,37 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
-
-import javax.persistence.Entity;
-
-import org.hibernate.envers.Audited;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class ContainedEntity extends AbstractContainedEntity {
-}
\ No newline at end of file
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java (from rev 15934, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/ContainedEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -0,0 +1,37 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+
+package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
+
+import javax.persistence.Entity;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class ContainedEntity extends AbstractContainedEntity {
+}
\ No newline at end of file
Deleted: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -1,37 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
-
-import javax.persistence.Entity;
-
-import org.hibernate.envers.Audited;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-@Entity
-@Audited
-public class SetEntity extends AbstractSetEntity {
-}
\ No newline at end of file
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java (from rev 15934, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/SetEntity.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -0,0 +1,37 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+
+package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
+
+import javax.persistence.Entity;
+
+import org.hibernate.envers.Audited;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+@Entity
+@Audited
+public class SetEntity extends AbstractSetEntity {
+}
\ No newline at end of file
Deleted: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -1,87 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-
-package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
-
-import javax.persistence.EntityManager;
-
-import org.hibernate.envers.test.AbstractEntityTest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import org.hibernate.ejb.Ejb3Configuration;
-
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * @author Adam Warski (adam at warski dot org)
- */
-public class UnidirectionalDoubleAbstract extends AbstractEntityTest {
- private Long cce1_id;
- private Integer cse1_id;
-
- public void configure(Ejb3Configuration cfg) {
- cfg.addAnnotatedClass(AbstractContainedEntity.class);
- cfg.addAnnotatedClass(AbstractSetEntity.class);
- cfg.addAnnotatedClass(ContainedEntity.class);
- cfg.addAnnotatedClass(SetEntity.class);
- }
-
- @BeforeClass(dependsOnMethods = "init")
- public void initData() {
- EntityManager em = getEntityManager();
-
- // Rev 1
- em.getTransaction().begin();
-
- ContainedEntity cce1 = new ContainedEntity();
- em.persist(cce1);
-
- SetEntity cse1 = new SetEntity();
- cse1.getEntities().add(cce1);
- em.persist(cse1);
-
- em.getTransaction().commit();
-
- cce1_id = cce1.getId();
- cse1_id = cse1.getId();
- }
-
- @Test
- public void testRevisionsCounts() {
- assert Arrays.asList(1).equals(getAuditReader().getRevisions(ContainedEntity.class, cce1_id));
- assert Arrays.asList(1).equals(getAuditReader().getRevisions(SetEntity.class, cse1_id));
- }
-
- @Test
- public void testHistoryOfReferencedCollection() {
- ContainedEntity cce1 = getEntityManager().find(ContainedEntity.class, cce1_id);
-
- Set<AbstractContainedEntity> entities = getAuditReader().find(SetEntity.class, cse1_id, 1).getEntities();
- assert entities.size() == 1;
- assert entities.iterator().next() instanceof ContainedEntity;
- assert entities.contains(cce1);
- }
-}
\ No newline at end of file
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java (from rev 15934, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/inheritance/joined/relation/unidirectional/UnidirectionalDoubleAbstract.java 2009-02-11 09:29:51 UTC (rev 15935)
@@ -0,0 +1,87 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+
+package org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+import java.util.Arrays;
+import java.util.Set;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class UnidirectionalDoubleAbstract extends AbstractEntityTest {
+ private Long cce1_id;
+ private Integer cse1_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(AbstractContainedEntity.class);
+ cfg.addAnnotatedClass(AbstractSetEntity.class);
+ cfg.addAnnotatedClass(ContainedEntity.class);
+ cfg.addAnnotatedClass(SetEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ // Rev 1
+ em.getTransaction().begin();
+
+ ContainedEntity cce1 = new ContainedEntity();
+ em.persist(cce1);
+
+ SetEntity cse1 = new SetEntity();
+ cse1.getEntities().add(cce1);
+ em.persist(cse1);
+
+ em.getTransaction().commit();
+
+ cce1_id = cce1.getId();
+ cse1_id = cse1.getId();
+ }
+
+ @Test
+ public void testRevisionsCounts() {
+ assert Arrays.asList(1).equals(getAuditReader().getRevisions(ContainedEntity.class, cce1_id));
+ assert Arrays.asList(1).equals(getAuditReader().getRevisions(SetEntity.class, cse1_id));
+ }
+
+ @Test
+ public void testHistoryOfReferencedCollection() {
+ ContainedEntity cce1 = getEntityManager().find(ContainedEntity.class, cce1_id);
+
+ Set<AbstractContainedEntity> entities = getAuditReader().find(SetEntity.class, cse1_id, 1).getEntities();
+ assert entities.size() == 1;
+ assert entities.iterator().next() instanceof ContainedEntity;
+ assert entities.contains(cce1);
+ }
+}
\ No newline at end of file
Modified: core/branches/envers-hibernate-3.3/src/test/resources/testng.xml
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/resources/testng.xml 2009-02-11 05:34:52 UTC (rev 15934)
+++ core/branches/envers-hibernate-3.3/src/test/resources/testng.xml 2009-02-11 09:29:51 UTC (rev 15935)
@@ -19,6 +19,7 @@
<package name="org.hibernate.envers.test.integration.inheritance.joined.emptychild" />
<package name="org.hibernate.envers.test.integration.inheritance.joined.notownedrelation" />
<package name="org.hibernate.envers.test.integration.inheritance.joined.relation" />
+ <package name="org.hibernate.envers.test.integration.inheritance.joined.relation.unidirectional" />
<package name="org.hibernate.envers.test.integration.inheritance.single" />
<package name="org.hibernate.envers.test.integration.inheritance.single.childrelation" />
<package name="org.hibernate.envers.test.integration.inheritance.single.notownedrelation" />
15 years, 3 months
Hibernate SVN: r15934 - in core/trunk: testsuite and 9 other directories.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-02-11 00:34:52 -0500 (Wed, 11 Feb 2009)
New Revision: 15934
Added:
core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java
core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/unit/lockhint/SybaseASE15LockHintsTest.java
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java
core/trunk/testsuite/pom.xml
core/trunk/testsuite/src/test/java/org/hibernate/test/connections/AggressiveReleaseTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/stats/StatsTest.java
Log:
HHH-3712 - Reorganize the Sybase dialect class hierarchy, add SybaseASE15Dialect, and mark SybaseDialect as deprecated
Added: core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -0,0 +1,263 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.dialect;
+
+import java.sql.CallableStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Map;
+import java.util.Iterator;
+
+import org.hibernate.Hibernate;
+import org.hibernate.LockMode;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.function.CharIndexFunction;
+import org.hibernate.dialect.function.NoArgSQLFunction;
+import org.hibernate.dialect.function.SQLFunctionTemplate;
+import org.hibernate.dialect.function.StandardSQLFunction;
+import org.hibernate.dialect.function.VarArgsSQLFunction;
+
+/**
+ * An abstract base class for Sybase and MS SQL Server dialects.
+ * @author Gavin King
+ */
+
+/* package-private */
+abstract class AbstractTransactSQLDialect extends Dialect {
+ public AbstractTransactSQLDialect() {
+ super();
+ registerColumnType( Types.BIT, "tinyint" ); //Sybase BIT type does not support null values
+ registerColumnType( Types.BIGINT, "numeric(19,0)" );
+ registerColumnType( Types.SMALLINT, "smallint" );
+ registerColumnType( Types.TINYINT, "tinyint" );
+ registerColumnType( Types.INTEGER, "int" );
+ registerColumnType( Types.CHAR, "char(1)" );
+ registerColumnType( Types.VARCHAR, "varchar($l)" );
+ registerColumnType( Types.FLOAT, "float" );
+ registerColumnType( Types.DOUBLE, "double precision" );
+ registerColumnType( Types.DATE, "datetime" );
+ registerColumnType( Types.TIME, "datetime" );
+ registerColumnType( Types.TIMESTAMP, "datetime" );
+ registerColumnType( Types.VARBINARY, "varbinary($l)" );
+ registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
+ registerColumnType( Types.BLOB, "image" );
+ registerColumnType( Types.CLOB, "text" );
+
+ registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
+ registerFunction( "char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
+ registerFunction( "len", new StandardSQLFunction("len", Hibernate.LONG) );
+ registerFunction( "lower", new StandardSQLFunction("lower") );
+ registerFunction( "upper", new StandardSQLFunction("upper") );
+ registerFunction( "str", new StandardSQLFunction("str", Hibernate.STRING) );
+ registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
+ registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
+ registerFunction( "reverse", new StandardSQLFunction("reverse") );
+ registerFunction( "space", new StandardSQLFunction("space", Hibernate.STRING) );
+
+ registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING) );
+
+ registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
+ registerFunction( "current_time", new NoArgSQLFunction("getdate", Hibernate.TIME) );
+ registerFunction( "current_date", new NoArgSQLFunction("getdate", Hibernate.DATE) );
+
+ registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
+ registerFunction( "getutcdate", new NoArgSQLFunction("getutcdate", Hibernate.TIMESTAMP) );
+ registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
+ registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
+ registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
+ registerFunction( "datename", new StandardSQLFunction("datename", Hibernate.STRING) );
+
+ registerFunction( "abs", new StandardSQLFunction("abs") );
+ registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+
+ registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
+ registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
+ registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
+ registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
+ registerFunction( "cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
+ registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
+ registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE) );
+ registerFunction( "log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
+ registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
+ registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
+ registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
+ registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
+ registerFunction( "square", new StandardSQLFunction("square") );
+ registerFunction( "rand", new StandardSQLFunction("rand", Hibernate.FLOAT) );
+
+ registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
+ registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
+
+ registerFunction( "round", new StandardSQLFunction("round") );
+ registerFunction( "ceiling", new StandardSQLFunction("ceiling") );
+ registerFunction( "floor", new StandardSQLFunction("floor") );
+
+ registerFunction( "isnull", new StandardSQLFunction("isnull") );
+
+ registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","+",")" ) );
+
+ registerFunction( "length", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
+ registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "ltrim(rtrim(?1))") );
+ registerFunction( "locate", new CharIndexFunction() );
+
+ getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
+ }
+
+ public String getAddColumnString() {
+ return "add";
+ }
+ public String getNullColumnString() {
+ return " null";
+ }
+ public boolean qualifyIndexName() {
+ return false;
+ }
+
+ public String getForUpdateString() {
+ return "";
+ }
+
+ public boolean supportsIdentityColumns() {
+ return true;
+ }
+ public String getIdentitySelectString() {
+ return "select @@identity";
+ }
+ public String getIdentityColumnString() {
+ return "identity not null"; //starts with 1, implicitly
+ }
+
+ public boolean supportsInsertSelectIdentity() {
+ return true;
+ }
+
+ public String appendIdentitySelectToInsert(String insertSQL) {
+ return insertSQL + "\nselect @@identity";
+ }
+
+ public String appendLockHint(LockMode mode, String tableName) {
+ if ( mode.greaterThan( LockMode.READ ) ) {
+ return tableName + " holdlock";
+ }
+ else {
+ return tableName;
+ }
+ }
+
+ public String applyLocksToSql(String sql, Map aliasedLockModes, Map keyColumnNames) {
+ Iterator itr = aliasedLockModes.entrySet().iterator();
+ StringBuffer buffer = new StringBuffer( sql );
+ int correction = 0;
+ while ( itr.hasNext() ) {
+ final Map.Entry entry = ( Map.Entry ) itr.next();
+ final LockMode lockMode = ( LockMode ) entry.getValue();
+ if ( lockMode.greaterThan( LockMode.READ ) ) {
+ final String alias = ( String ) entry.getKey();
+ int start = -1, end = -1;
+ if ( sql.endsWith( " " + alias ) ) {
+ start = ( sql.length() - alias.length() ) + correction;
+ end = start + alias.length();
+ }
+ else {
+ int position = sql.indexOf( " " + alias + " " );
+ if ( position <= -1 ) {
+ position = sql.indexOf( " " + alias + "," );
+ }
+ if ( position > -1 ) {
+ start = position + correction + 1;
+ end = start + alias.length();
+ }
+ }
+
+ if ( start > -1 ) {
+ final String lockHint = appendLockHint( lockMode, alias );
+ buffer.replace( start, end, lockHint );
+ correction += ( lockHint.length() - alias.length() );
+ }
+ }
+ }
+ return buffer.toString();
+ }
+
+ public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
+ return col; // sql server just returns automatically
+ }
+
+ public ResultSet getResultSet(CallableStatement ps) throws SQLException {
+ boolean isResultSet = ps.execute();
+// This assumes you will want to ignore any update counts
+ while ( !isResultSet && ps.getUpdateCount() != -1 ) {
+ isResultSet = ps.getMoreResults();
+ }
+// You may still have other ResultSets or update counts left to process here
+// but you can't do it now or the ResultSet you just got will be closed
+ return ps.getResultSet();
+ }
+
+ public boolean supportsCurrentTimestampSelection() {
+ return true;
+ }
+
+ public boolean isCurrentTimestampSelectStringCallable() {
+ return false;
+ }
+
+ public String getCurrentTimestampSelectString() {
+ return "select getdate()";
+ }
+
+ public boolean supportsTemporaryTables() {
+ return true;
+ }
+
+ public String generateTemporaryTableName(String baseTableName) {
+ return "#" + baseTableName;
+ }
+
+ public boolean dropTemporaryTableAfterUse() {
+ return true; // sql-server, at least needed this dropped after use; strange!
+ }
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean supportsExistsInSelect() {
+ return false;
+ }
+
+ public boolean doesReadCommittedCauseWritersToBlockReaders() {
+ return true;
+ }
+
+ public boolean doesRepeatableReadCauseReadersToBlockWriters() {
+ return true;
+ }
+}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -43,8 +43,12 @@
registerColumnType( Types.VARBINARY, "image" );
registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
+ registerFunction( "second", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(second, ?1)" ) );
+ registerFunction( "minute", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(minute, ?1)" ) );
+ registerFunction( "hour", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(hour, ?1)" ) );
registerFunction( "locate", new StandardSQLFunction( "charindex", Hibernate.INTEGER ) );
+ registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );
@@ -134,10 +138,6 @@
return false;
}
- public boolean supportsCascadeDelete() {
- return true;
- }
-
public boolean supportsCircularCascadeDeleteConstraints() {
// SQL Server (at least up through 2005) does not support defining
// cascade delete constraints which can circel back to the mutating
@@ -145,10 +145,6 @@
return false;
}
- public boolean supportsExpectedLobUsagePattern() {
- return true;
- }
-
public boolean supportsLobValueChangePropogation() {
// note: at least my local SQL Server 2005 Express shows this not working...
return false;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -31,7 +31,7 @@
* A SQL dialect suitable for use with Sybase 11.9.2 (specifically: avoids ANSI JOIN syntax)
* @author Colm O' Flaherty
*/
-public class Sybase11Dialect extends SybaseDialect {
+public class Sybase11Dialect extends AbstractTransactSQLDialect {
public Sybase11Dialect() {
super();
}
Added: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -0,0 +1,67 @@
+//$Id $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.dialect;
+
+import java.sql.CallableStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Map;
+import java.util.Iterator;
+
+import org.hibernate.Hibernate;
+import org.hibernate.LockMode;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.function.CharIndexFunction;
+import org.hibernate.dialect.function.NoArgSQLFunction;
+import org.hibernate.dialect.function.SQLFunctionTemplate;
+import org.hibernate.dialect.function.StandardSQLFunction;
+import org.hibernate.dialect.function.VarArgsSQLFunction;
+
+/**
+ * An SQL dialect compatible with Sybase and MS SQL Server.
+ * @author Gavin King
+ */
+
+public class SybaseASE15Dialect extends AbstractTransactSQLDialect {
+ public SybaseASE15Dialect() {
+ super();
+ registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(second, ?1)") );
+ registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
+ registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
+ registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
+ }
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsCascadeDelete() {
+ return false;
+ }
+
+ public boolean supportsExpectedLobUsagePattern() {
+ return false;
+ }
+}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -30,7 +30,7 @@
* (Tested on ASA 8.x)
* @author ?
*/
-public class SybaseAnywhereDialect extends SybaseDialect {
+public class SybaseAnywhereDialect extends AbstractTransactSQLDialect {
/**
* Sybase Anywhere syntax would require a "DEFAULT" for each column specified,
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -1,3 +1,4 @@
+//$Id $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -24,253 +25,16 @@
*/
package org.hibernate.dialect;
-import java.sql.CallableStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Map;
-import java.util.Iterator;
-
-import org.hibernate.Hibernate;
-import org.hibernate.LockMode;
-import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.function.CharIndexFunction;
-import org.hibernate.dialect.function.NoArgSQLFunction;
-import org.hibernate.dialect.function.SQLFunctionTemplate;
-import org.hibernate.dialect.function.StandardSQLFunction;
-import org.hibernate.dialect.function.VarArgsSQLFunction;
-
/**
- * An SQL dialect compatible with Sybase and MS SQL Server.
- * @author Gavin King
+ * SybaseDialect is being deprecated.
+ *
+ * AbstractTransactSQLDialect should be used as a base
+ * class for Sybase and MS SQL Server dialects.
+ *
+ * @author Gail Badner
+ * @deprecated SybaseASE15Dialect or SQLServerDialect should be
+ * used instead.
*/
-public class SybaseDialect extends Dialect {
- public SybaseDialect() {
- super();
- registerColumnType( Types.BIT, "tinyint" ); //Sybase BIT type does not support null values
- registerColumnType( Types.BIGINT, "numeric(19,0)" );
- registerColumnType( Types.SMALLINT, "smallint" );
- registerColumnType( Types.TINYINT, "tinyint" );
- registerColumnType( Types.INTEGER, "int" );
- registerColumnType( Types.CHAR, "char(1)" );
- registerColumnType( Types.VARCHAR, "varchar($l)" );
- registerColumnType( Types.FLOAT, "float" );
- registerColumnType( Types.DOUBLE, "double precision" );
- registerColumnType( Types.DATE, "datetime" );
- registerColumnType( Types.TIME, "datetime" );
- registerColumnType( Types.TIMESTAMP, "datetime" );
- registerColumnType( Types.VARBINARY, "varbinary($l)" );
- registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
- registerColumnType( Types.BLOB, "image" );
- registerColumnType( Types.CLOB, "text" );
-
- registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
- registerFunction( "char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
- registerFunction( "len", new StandardSQLFunction("len", Hibernate.LONG) );
- registerFunction( "lower", new StandardSQLFunction("lower") );
- registerFunction( "upper", new StandardSQLFunction("upper") );
- registerFunction( "str", new StandardSQLFunction("str", Hibernate.STRING) );
- registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
- registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
- registerFunction( "reverse", new StandardSQLFunction("reverse") );
- registerFunction( "space", new StandardSQLFunction("space", Hibernate.STRING) );
-
- registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING) );
-
- registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
- registerFunction( "current_time", new NoArgSQLFunction("getdate", Hibernate.TIME) );
- registerFunction( "current_date", new NoArgSQLFunction("getdate", Hibernate.DATE) );
-
- registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
- registerFunction( "getutcdate", new NoArgSQLFunction("getutcdate", Hibernate.TIMESTAMP) );
- registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
- registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
- registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
- registerFunction( "datename", new StandardSQLFunction("datename", Hibernate.STRING) );
- registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(second, ?1)") );
- registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
- registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
- registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
-
- registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
-
- registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction( "cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
- registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE) );
- registerFunction( "log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
- registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
- registerFunction( "square", new StandardSQLFunction("square") );
- registerFunction( "rand", new StandardSQLFunction("rand", Hibernate.FLOAT) );
-
- registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
- registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
-
- registerFunction( "round", new StandardSQLFunction("round") );
- registerFunction( "ceiling", new StandardSQLFunction("ceiling") );
- registerFunction( "floor", new StandardSQLFunction("floor") );
-
- registerFunction( "isnull", new StandardSQLFunction("isnull") );
-
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","+",")" ) );
-
- registerFunction( "length", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
- registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "ltrim(rtrim(?1))") );
- registerFunction( "locate", new CharIndexFunction() );
-
- registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );
-
- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
- }
-
- public String getAddColumnString() {
- return "add";
- }
- public String getNullColumnString() {
- return " null";
- }
- public boolean qualifyIndexName() {
- return false;
- }
-
- public String getForUpdateString() {
- return "";
- }
-
- public boolean supportsIdentityColumns() {
- return true;
- }
- public String getIdentitySelectString() {
- return "select @@identity";
- }
- public String getIdentityColumnString() {
- return "identity not null"; //starts with 1, implicitly
- }
-
- public boolean supportsInsertSelectIdentity() {
- return true;
- }
-
- public String appendIdentitySelectToInsert(String insertSQL) {
- return insertSQL + "\nselect @@identity";
- }
-
- public String appendLockHint(LockMode mode, String tableName) {
- if ( mode.greaterThan( LockMode.READ ) ) {
- return tableName + " holdlock";
- }
- else {
- return tableName;
- }
- }
-
- public String applyLocksToSql(String sql, Map aliasedLockModes, Map keyColumnNames) {
- Iterator itr = aliasedLockModes.entrySet().iterator();
- StringBuffer buffer = new StringBuffer( sql );
- int correction = 0;
- while ( itr.hasNext() ) {
- final Map.Entry entry = ( Map.Entry ) itr.next();
- final LockMode lockMode = ( LockMode ) entry.getValue();
- if ( lockMode.greaterThan( LockMode.READ ) ) {
- final String alias = ( String ) entry.getKey();
- int start = -1, end = -1;
- if ( sql.endsWith( " " + alias ) ) {
- start = ( sql.length() - alias.length() ) + correction;
- end = start + alias.length();
- }
- else {
- int position = sql.indexOf( " " + alias + " " );
- if ( position <= -1 ) {
- position = sql.indexOf( " " + alias + "," );
- }
- if ( position > -1 ) {
- start = position + correction + 1;
- end = start + alias.length();
- }
- }
-
- if ( start > -1 ) {
- final String lockHint = appendLockHint( lockMode, alias );
- buffer.replace( start, end, lockHint );
- correction += ( lockHint.length() - alias.length() );
- }
- }
- }
- return buffer.toString();
- }
-
- public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
- return col; // sql server just returns automatically
- }
-
- public ResultSet getResultSet(CallableStatement ps) throws SQLException {
- boolean isResultSet = ps.execute();
-// This assumes you will want to ignore any update counts
- while ( !isResultSet && ps.getUpdateCount() != -1 ) {
- isResultSet = ps.getMoreResults();
- }
-// You may still have other ResultSets or update counts left to process here
-// but you can't do it now or the ResultSet you just got will be closed
- return ps.getResultSet();
- }
-
- public boolean supportsCurrentTimestampSelection() {
- return true;
- }
-
- public boolean isCurrentTimestampSelectStringCallable() {
- return false;
- }
-
- public String getCurrentTimestampSelectString() {
- return "select getdate()";
- }
-
- public boolean supportsTemporaryTables() {
- return true;
- }
-
- public String generateTemporaryTableName(String baseTableName) {
- return "#" + baseTableName;
- }
-
- public boolean dropTemporaryTableAfterUse() {
- return true; // sql-server, at least needed this dropped after use; strange!
- }
-
-
- // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- public boolean supportsCascadeDelete() {
- return false;
- }
-
- public boolean supportsExpectedLobUsagePattern() {
- return false;
- }
-
- public boolean supportsEmptyInList() {
- return false;
- }
-
- public boolean supportsExistsInSelect() {
- return false;
- }
-
- public boolean doesReadCommittedCauseWritersToBlockReaders() {
- return true;
- }
-
- public boolean doesRepeatableReadCauseReadersToBlockWriters() {
- return true;
- }
+public class SybaseDialect extends AbstractTransactSQLDialect {
}
Modified: core/trunk/testsuite/pom.xml
===================================================================
--- core/trunk/testsuite/pom.xml 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/pom.xml 2009-02-11 05:34:52 UTC (rev 15934)
@@ -283,6 +283,25 @@
</properties>
</profile>
+ <profile>
+ <id>sybase15</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sybase</groupId>
+ <artifactId>jconnect</artifactId>
+ <version>6.0.5</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SybaseASE15Dialect</db.dialect>
+ <jdbc.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.driver>
+ <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/hibernate</jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
<!-- The SQLServer2005 (jTDS) test envionment -->
<profile>
<id>sqlserver-jtds</id>
@@ -324,4 +343,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/connections/AggressiveReleaseTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/connections/AggressiveReleaseTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/connections/AggressiveReleaseTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -107,7 +107,7 @@
// expected behavior
}
- // getting the first row only because Sybase throws NullPointerException
+ // getting the first row only because SybaseASE15Dialect throws NullPointerException
// if data is not read before closing the ResultSet
sr.next();
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/unit/lockhint/SybaseASE15LockHintsTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/unit/lockhint/SybaseASE15LockHintsTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/unit/lockhint/SybaseASE15LockHintsTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -0,0 +1,56 @@
+//$Id $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.dialect.unit.lockhint;
+
+import junit.framework.TestSuite;
+
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Gail Badner
+ */
+public class SybaseASE15LockHintsTest extends AbstractLockHintTest {
+ public static final Dialect DIALECT = new SybaseASE15Dialect();
+
+ public SybaseASE15LockHintsTest(String string) {
+ super( string );
+ }
+
+ protected String getLockHintUsed() {
+ return "holdlock";
+ }
+
+ protected Dialect getDialectUnderTest() {
+ return DIALECT;
+ }
+
+ public static TestSuite suite() {
+ return new TestSuite( SybaseASE15LockHintsTest.class );
+ }
+}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/generated/TimestampGeneratedValuesWithCachingTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -5,6 +5,10 @@
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseAnywhereDialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
+import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
/**
@@ -25,7 +29,9 @@
public boolean appliesTo(Dialect dialect) {
// this test is specific to Sybase/SQLServer as it is testing support
// for their TIMESTAMP datatype...
- return ( dialect instanceof SybaseDialect );
+ return ( dialect instanceof SybaseDialect || dialect instanceof Sybase11Dialect ||
+ dialect instanceof SybaseAnywhereDialect || dialect instanceof SybaseASE15Dialect ||
+ dialect instanceof SQLServerDialect);
}
public static Test suite() {
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-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -31,6 +31,9 @@
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
+import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.hql.ast.ASTQueryTranslatorFactory;
import org.hibernate.junit.functional.FunctionalTestCase;
@@ -1221,7 +1224,7 @@
if ( getDialect() instanceof DB2Dialect ) {
assertTrue( str.startsWith("1.234") );
}
- else if ( getDialect() instanceof SybaseDialect ) {
+ else if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect || getDialect() instanceof SQLServerDialect ) {
// str(val) on sybase assumes a default of 10 characters with no decimal point or decimal values
// str(val) on sybase result is right-justified
assertEquals( str.length(), 10 );
@@ -1233,7 +1236,7 @@
else {
assertTrue( str.startsWith("123.4") );
}
- if ( ! ( getDialect() instanceof SybaseDialect ) ) {
+ if ( ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && ! ( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) {
// In TransactSQL (the variant spoken by Sybase and SQLServer), the str() function
// is explicitly intended for numeric values only...
String dateStr1 = (String) session.createQuery("select str(current_date) from Animal").uniqueResult();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -20,7 +20,11 @@
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle9Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
+import org.hibernate.dialect.SQLServerDialect;
+import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.engine.SessionFactoryImplementor;
@@ -219,11 +223,14 @@
assertTranslation("from Animal a where abs(:param - a.bodyWeight) < 2.0");
assertTranslation("from Animal where abs(:x - :y) < 2.0");
assertTranslation("from Animal where lower(upper(:foo)) like 'f%'");
- if ( ! ( getDialect() instanceof SybaseDialect ) ) {
- // SybaseDialect maps the length function -> len; classic translator does not consider that *when nested*
+ if ( ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && ! ( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) {
+ // Transact-SQL dialects (except SybaseAnywhereDialect) map the length function -> len;
+ // classic translator does not consider that *when nested*;
+ // SybaseAnywhereDialect supports the length function
+
assertTranslation("from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0");
}
- if ( !( getDialect() instanceof MySQLDialect || getDialect() instanceof SybaseDialect ) ) {
+ if ( !( getDialect() instanceof MySQLDialect ) && ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) {
assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'");
}
if ( getDialect() instanceof PostgreSQLDialect ) {
@@ -594,7 +601,8 @@
}
public void testConcatenation() {
- if ( getDialect() instanceof MySQLDialect || getDialect() instanceof SybaseDialect ) {
+ if ( getDialect() instanceof MySQLDialect || getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect || getDialect() instanceof SQLServerDialect ) {
+ // SybaseASE15Dialect and SybaseAnywhereDialect support '||'
// MySQL uses concat(x, y, z)
// SQL Server replaces '||' with '+'
//
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -46,7 +46,7 @@
SecureDocument d2 = new SecureDocumentImpl();
d2.setName("Secret");
d2.setContent( Hibernate.createBlob( "wxyz wxyz".getBytes() ) );
- // Sybase only allows 7-bits in a byte to be inserted into a tinyint
+ // SybaseASE15Dialect only allows 7-bits in a byte to be inserted into a tinyint
// column (0 <= val < 128)
d2.setPermissionBits( (byte) 127 );
d2.setOwner("gavin");
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -58,6 +58,8 @@
import org.hibernate.dialect.SAPDBDialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.TimesTenDialect;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@@ -2136,7 +2138,8 @@
s.find("select count(*) from Baz as baz where 1 in indices(baz.fooArray)");
s.find("select count(*) from Bar as bar where 'abc' in elements(bar.baz.fooArray)");
s.find("select count(*) from Bar as bar where 1 in indices(bar.baz.fooArray)");
- if ( !(getDialect() instanceof DB2Dialect) && !(getDialect() instanceof Oracle9Dialect) && !(getDialect() instanceof Oracle8iDialect ) && !( getDialect() instanceof SybaseDialect && !(getDialect() instanceof SQLServerDialect ) ) ) {
+ if ( !(getDialect() instanceof DB2Dialect) && !(getDialect() instanceof Oracle9Dialect) && !(getDialect() instanceof Oracle8iDialect ) && !( getDialect() instanceof SybaseDialect ) && !( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect )) {
+ // SybaseAnywhereDialect supports implicit conversions from strings to ints
s.find("select count(*) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)");
s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)");
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -26,6 +26,9 @@
import org.hibernate.dialect.Oracle9Dialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
+import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.dialect.TimesTenDialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.function.SQLFunction;
@@ -370,7 +373,7 @@
s.find("from Simple s where not( upper( s.name ) ='yada' or 1=2 or 'foo'='bar' or not('foo'='foo') or 'foo' like 'bar' )").size()==1
);
}
- if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof SybaseDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof InterbaseDialect) && !(getDialect() instanceof TimesTenDialect) ) { //My SQL has a funny concatenation operator
+ if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof SybaseDialect) && !(getDialect() instanceof SQLServerDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof InterbaseDialect) && !(getDialect() instanceof TimesTenDialect) ) { //My SQL has a funny concatenation operator
assertTrue(
s.find("from Simple s where lower( s.name || ' foo' ) ='simple 1 foo'").size()==1
);
@@ -500,8 +503,8 @@
//assertTrue( b.getClob() instanceof ClobImpl );
s.flush();
- // Sybase ASE does not support ResultSet.getBlob(String)
- if ( getDialect() instanceof SybaseDialect && ! ( getDialect() instanceof SQLServerDialect ) ) {
+ // Sybase does not support ResultSet.getBlob(String)
+ if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect ) {
s.connection().rollback();
s.close();
return;
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -6,7 +6,9 @@
import org.hibernate.Session;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.SybaseDialect;
-import org.hibernate.dialect.SQLServerDialect;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
+import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@@ -35,8 +37,8 @@
}
public void testNewSerializableType() {
- // Sybase ASE does not support ResultSet.getBlob(String)
- if ( getDialect() instanceof SybaseDialect && ! ( getDialect() instanceof SQLServerDialect ) ) {
+ // Sybase dialects do not support ResultSet.getBlob(String)
+ if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect ) {
return;
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -46,7 +46,7 @@
SecureDocument d2 = new SecureDocument();
d2.setName( "Secret" );
d2.setContent( Hibernate.createBlob( "wxyz wxyz".getBytes() ) );
- // Sybase only allows 7-bits in a byte to be inserted into a tinyint
+ // SybaseASE15Dialect only allows 7-bits in a byte to be inserted into a tinyint
// column (0 <= val < 128)
d2.setPermissionBits( (byte) 127 );
d2.setOwner( "gavin" );
@@ -96,7 +96,7 @@
assertNotNull( d2.getContent() );
assertEquals( "max", d2.getOwner() );
assertEquals( "/", d2.getParent().getName() );
- // Sybase only allows 7-bits in a byte to be inserted into a tinyint
+ // SybaseASE15Dialect only allows 7-bits in a byte to be inserted into a tinyint
// column (0 <= val < 128)
assertEquals( (byte) 127, d2.getPermissionBits() );
assertNotNull( d2.getCreated() );
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/stats/StatsTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/stats/StatsTest.java 2009-02-10 21:45:05 UTC (rev 15933)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/stats/StatsTest.java 2009-02-11 05:34:52 UTC (rev 15934)
@@ -165,7 +165,7 @@
// same deal with scroll()...
assertEquals( "unexpected execution count", 3, continentStats.getExecutionCount() );
assertEquals( "unexpected row count", results, continentStats.getExecutionRowCount() );
- // scroll through data because Sybase throws NullPointerException
+ // scroll through data because SybaseASE15Dialect throws NullPointerException
// if data is not read before closing the ResultSet
while ( scrollableResults.next() ) {
// do nothing
15 years, 3 months