Hibernate SVN: r10970 - tags/annotations_v3_2_1_GA
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-12-10 14:38:35 -0500 (Sun, 10 Dec 2006)
New Revision: 10970
Added:
tags/annotations_v3_2_1_GA/HibernateExt/
Log:
made a copy
Copied: tags/annotations_v3_2_1_GA/HibernateExt (from rev 10969, branches/Branch_3_2/HibernateExt)
17 years, 4 months
Hibernate SVN: r10969 - tags
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-12-10 14:37:07 -0500 (Sun, 10 Dec 2006)
New Revision: 10969
Added:
tags/entitymanager_v3_2_1_GA/
Log:
17 years, 4 months
Hibernate SVN: r10968 - tags
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-12-10 14:36:50 -0500 (Sun, 10 Dec 2006)
New Revision: 10968
Added:
tags/annotations_v3_2_1_GA/
Log:
17 years, 4 months
Hibernate SVN: r10967 - in branches/Branch_3_2/HibernateExt: ejb ejb/lib metadata
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-12-10 14:34:58 -0500 (Sun, 10 Dec 2006)
New Revision: 10967
Modified:
branches/Branch_3_2/HibernateExt/ejb/changelog.txt
branches/Branch_3_2/HibernateExt/ejb/lib/hibernate-annotations.jar
branches/Branch_3_2/HibernateExt/ejb/readme.txt
branches/Branch_3_2/HibernateExt/metadata/changelog.txt
branches/Branch_3_2/HibernateExt/metadata/readme.txt
Log:
Release
Modified: branches/Branch_3_2/HibernateExt/ejb/changelog.txt
===================================================================
--- branches/Branch_3_2/HibernateExt/ejb/changelog.txt 2006-12-09 12:10:27 UTC (rev 10966)
+++ branches/Branch_3_2/HibernateExt/ejb/changelog.txt 2006-12-10 19:34:58 UTC (rev 10967)
@@ -1,6 +1,29 @@
Hibernate EntityManager Changelog
==================================
+3.2.1.GA (8-12-2006)
+--------------------
+
+** Bug
+ * [EJB-226] - JarVistor.getVisitor does not handle paths containing spaces correctly for an exploded par
+ * [EJB-229] - merge fails with detached obj in 1:1 relationship
+ * [EJB-237] - merge() causes version to increase
+ * [EJB-240] - attribute-override and embedded in orm.xml not working
+ * [EJB-244] - JarVisitor fails on exploded archives with spaces in path
+ * [EJB-247] - HibernatePersistence does not play well with other PersistenceProviders
+ * [EJB-252] - Clarify documentation on package use in persistence.xml <class> (and it's meaning)
+ * [EJB-253] - Support Weblogic JAR URL in JavaSE mode
+
+
+** Improvement
+ * [EJB-232] - Better documentation for <jar-file> and scanning outside of PU root
+ * [EJB-243] - Error in Documentation: persistence.xml for typical Java SE Environment
+ * [EJB-246] - Consider being in a JavaEE container when jta-datasource is used
+ * [EJB-248] - Wrap StaleStateException into an OptimisticLockException during em.getTransaction().commit()
+ * [EJB-254] - Allow DataSource overriding through createEntityManager(String, Map override)
+ * [EJB-256] - Avoid JAR locking on Windows and Tomcat due to URLConnection caching
+
+
3.2.0.GA (16-10-2006)
---------------------
Same code base as 3.2.0.CR3
Modified: branches/Branch_3_2/HibernateExt/ejb/lib/hibernate-annotations.jar
===================================================================
(Binary files differ)
Modified: branches/Branch_3_2/HibernateExt/ejb/readme.txt
===================================================================
--- branches/Branch_3_2/HibernateExt/ejb/readme.txt 2006-12-09 12:10:27 UTC (rev 10966)
+++ branches/Branch_3_2/HibernateExt/ejb/readme.txt 2006-12-10 19:34:58 UTC (rev 10967)
@@ -1,8 +1,8 @@
Hibernate EntityManager
==================================================
-Version: 3.2.0.GA, 16.10.2006
+Version: 3.2.1.GA, 8.12.2006
-THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE CORE 3.2.0.GA (or CR5) AND
+THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE CORE 3.2.0.GA (and above) AND
DOES NOT WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE.
Modified: branches/Branch_3_2/HibernateExt/metadata/changelog.txt
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/changelog.txt 2006-12-09 12:10:27 UTC (rev 10966)
+++ branches/Branch_3_2/HibernateExt/metadata/changelog.txt 2006-12-10 19:34:58 UTC (rev 10967)
@@ -1,6 +1,63 @@
Hibernate Annotations Changelog
===============================
+3.2.1.GA (8-12-2006)
+--------------------
+
+** Bug
+ * [ANN-395] - @Embedded can not map interface
+ * [ANN-425] - Property not found when defined in a @IdClass and referenced by a @OneToMany
+ * [ANN-430] - @ManyToOne results in default outer join eager fetch, should be lazy
+ * [ANN-448] - @OrderBy does not work with an association table when Set is used for collection
+ * [ANN-450] - @MapKey does not work with embedded fields
+ * [ANN-452] - Check lucene behavior on rollback()
+ * [ANN-458] - Hibernate Validator initialization always requires keys in ValidatorMessges.properties
+ * [ANN-466] - Discriminator values longer than 31 break in PostgreSQL
+ * [ANN-471] - lazily resolve default messages in DefaultMessageInterpolator
+ * [ANN-473] - Unable to define unique constraints on a denormalized table (union-subclass)
+ * [ANN-474] - <sequence-generator> and <table-generator> at the entity level can override those at the property level in JPA XML
+ * [ANN-477] - @Formula doesn't work in entities referenced by @JoinColumn(referencedColumnName="...")
+ * [ANN-491] - Collection mapped with javax.persistence.MapKey isn't loaded properly.
+ * [ANN-499] - @IdClass and @ManyToOne leads to repeated column exception
+
+
+** Improvement
+ * [ANN-37] - Support for SQL Overriding (L�szl� Benke, Assaf Berg)
+ * [ANN-387] - lucene integration does not support Inheritance
+ * [ANN-422] - Add targetEntity to MapKeyManyToMany annotation
+ * [ANN-449] - @Min, @Max store value as Integer. @Range stores values as Long.
+ * [ANN-456] - ClassValidator sould be able to get a reflectionManager from the caller (ie the event listener)
+ * [ANN-460] - Support for several entity types per Index
+ * [ANN-468] - IdFieldBridge should be introduced to cope with additional constraints on Brigdes used by document ids
+ * [ANN-475] - Make ClassValidator independent from javax.persistence annotations
+ * [ANN-476] - EJB3 naming strategy struggles with quoted identifiers when generating composed table/column names
+ * [ANN-497] - Reuse the same synchronization queue per transaction for Search operations
+
+** New Feature
+ * [ANN-363] - Support for a @FieldBridge
+ * [ANN-364] - @Boost or equivalent on entity and on fields
+ * [ANN-383] - Align with Lucene 2 APIs for annotations
+ * [ANN-384] - Reindex an object on a per instance basis (not triggered by a change)
+ * [ANN-454] - Support for Built-in bridges in Lucene
+ * [ANN-455] - Comprehensive built-in type support
+ * [ANN-457] - Support field annotations in Hibernate Lucene (Richard Hallier)
+ * [ANN-463] - @DateBridge
+ * [ANN-478] - French translation (Vincent Ricard)
+ * [ANN-482] - Use of transaction Synchronization rather than post-commit-* events
+ * [ANN-493] - @NonEmpty
+
+** Patch
+ * [ANN-445] - Add dutch (Nederlands) validator_nl.properties for hibernate validator
+ * [ANN-465] - SingleTableTest.testDefaultDiscriminatorColumn fix
+ * [ANN-498] - Add Spanish Validation Bundle
+ * [ANN-500] - Swedish default messages
+
+** Task
+ * [ANN-479] - Various optimizations of the Xlayer (reflection layer)
+ * [ANN-483] - reorganize lucene packaging
+ * [ANN-488] - Rename org.hibernate.lucene to org.hibernate.search
+
+
3.2.0.GA (16-10-2006)
---------------------
Same code base as 3.2.0.CR3
Modified: branches/Branch_3_2/HibernateExt/metadata/readme.txt
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/readme.txt 2006-12-09 12:10:27 UTC (rev 10966)
+++ branches/Branch_3_2/HibernateExt/metadata/readme.txt 2006-12-10 19:34:58 UTC (rev 10967)
@@ -1,8 +1,8 @@
Hibernate Annotations
==================================================
-Version: 3.2.0.GA, 16.10.2006
+Version: 3.2.1.GA, 8.12.2006
-THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE CORE 3.2.0.GA (or CR5) AND DOES NOT
+THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE CORE 3.2.0.GA (and above) AND DOES NOT
WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE.
17 years, 4 months
Hibernate SVN: r10966 - in branches/Branch_3_2/HibernateExt/tools/src: java/org/hibernate/tool/hbm2x/pojo templates/pojo test/org/hibernate/tool/hbm2x
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-12-09 07:10:27 -0500 (Sat, 09 Dec 2006)
New Revision: 10966
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
Log:
don't generate redundant {}'s for single element attributes.
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java 2006-12-09 12:00:48 UTC (rev 10965)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java 2006-12-09 12:10:27 UTC (rev 10966)
@@ -67,13 +67,7 @@
}
String key = (String) element.getKey();
b.append(key).append("=");
- if(s.length>1) {
- b.append( "{" );
- }
attributeToString( b, s );
- if(s.length>1) {
- b.append( "}" );
- }
addedBefore=true;
}
@@ -83,13 +77,22 @@
return b.toString();
}
- private void attributeToString(StringBuffer buffer, String[] values) {
+ private void attributeToString(StringBuffer buffer, String[] values) {
+ if(values.length>1) {
+ buffer.append( "{" );
+ }
+
for (int i = 0; i < values.length; i++) {
buffer.append(values[i]);
if(i<values.length-1) {
buffer.append(", ");
}
}
+
+ if(values.length>1) {
+ buffer.append( "}" );
+ }
+
}
public void addQuotedAttributes(String name, Iterator iterator) {
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-12-09 12:00:48 UTC (rev 10965)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-12-09 12:10:27 UTC (rev 10966)
@@ -521,7 +521,7 @@
}
String uniqueConstraint = generateAnnTableUniqueConstraint(table);
if ( uniqueConstraint.length() > 0 ) {
- annotation.append(", uniqueConstraints={").append(uniqueConstraint).append("} ");
+ annotation.append(", uniqueConstraints=").append(uniqueConstraint);
}
annotation.append( ", joinColumns = { ");
buildArrayOfJoinColumnAnnotation(
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl 2006-12-09 12:00:48 UTC (rev 10965)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl 2006-12-09 12:10:27 UTC (rev 10966)
@@ -11,7 +11,7 @@
</#if>
<#assign uniqueConstraint=pojo.generateAnnTableUniqueConstraint()>
<#if uniqueConstraint?has_content>
- , uniqueConstraints = { ${uniqueConstraint} }
+ , uniqueConstraints = ${uniqueConstraint}
</#if>)
</#if>
</#if>
\ No newline at end of file
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2006-12-09 12:00:48 UTC (rev 10965)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2006-12-09 12:10:27 UTC (rev 10966)
@@ -214,7 +214,7 @@
constraint.addAttribute( "single", "value" );
String attribute = constraint.getAttributeAsString("columnNames");
- assertEquals("\"first\", \"second\"", attribute);
+ assertEquals("{\"first\", \"second\"}", attribute);
assertEquals("value", constraint.getAttributeAsString( "single" ));
17 years, 4 months
Hibernate SVN: r10965 - in branches/Branch_3_2/HibernateExt/tools/src: java/org/hibernate/tool/hbm2x java/org/hibernate/tool/hbm2x/pojo templates/pojo test/org/hibernate/tool test/org/hibernate/tool/hbm2x
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-12-09 07:00:48 -0500 (Sat, 09 Dec 2006)
New Revision: 10965
Added:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Author.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
Log:
fixed multi uniqueconstraint issue
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -183,6 +183,20 @@
public boolean isManyToOne(Property property) {
return (property.getValue()!=null) && (property.getValue() instanceof ManyToOne);
}
+
+ public boolean isTemporalValue(Property property) {
+ if(property.getValue() instanceof SimpleValue) {
+ String typeName = ((SimpleValue)property.getValue()).getTypeName();
+ if("date".equals(typeName) || "java.sql.Date".equals(typeName)) {
+ return true;
+ } else if ("timestamp".equals(typeName) || "java.sql.Timestamp".equals(typeName)) {
+ return true;
+ } else if ("time".equals(typeName) || "java.sql.Time".equals(typeName)) {
+ return true;
+ }
+ }
+ return false;
+ }
public boolean isNamedQueries(Configuration cfg) {
Map nqry = cfg.getNamedQueries();
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/AnnotationBuilder.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -65,19 +65,16 @@
if(addedBefore) {
b.append(", ");
}
- b.append(element.getKey()).append("=");
+ String key = (String) element.getKey();
+ b.append(key).append("=");
if(s.length>1) {
b.append( "{" );
}
- for (int i = 0; i < s.length; i++) {
- b.append(s[i]);
- if(i<s.length-1) {
- b.append(", ");
- }
- }
+ attributeToString( b, s );
if(s.length>1) {
b.append( "}" );
}
+
addedBefore=true;
}
}
@@ -86,6 +83,15 @@
return b.toString();
}
+ private void attributeToString(StringBuffer buffer, String[] values) {
+ for (int i = 0; i < values.length; i++) {
+ buffer.append(values[i]);
+ if(i<values.length-1) {
+ buffer.append(", ");
+ }
+ }
+ }
+
public void addQuotedAttributes(String name, Iterator iterator) {
List values = new ArrayList();
while ( iterator.hasNext() ) {
@@ -119,6 +125,17 @@
return getResult();
}
+ public String getAttributeAsString(String name) {
+ StringBuffer buffer = new StringBuffer();
+ String[] object = (String[]) attributes.get( name );
+ if(object==null) {
+ return null;
+ } else {
+ attributeToString( buffer, object );
+ return buffer.toString();
+ }
+ }
+
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -157,10 +157,6 @@
return clazz.getIdentifierProperty();
}
- public boolean needsAnnTableUniqueConstraints() {
- return ( !( clazz instanceof Subclass ) && clazz.getTable().getUniqueKeyIterator().hasNext() );
- }
-
public String generateAnnTableUniqueConstraint() {
if ( ! ( clazz instanceof Subclass ) ) {
Table table = clazz.getTable();
@@ -169,10 +165,9 @@
return "";
}
- private String generateAnnTableUniqueConstraint(Table table) {
- StringBuffer constraints = new StringBuffer();
+ protected String generateAnnTableUniqueConstraint(Table table) {
Iterator uniqueKeys = table.getUniqueKeyIterator();
-
+ List cons = new ArrayList();
while ( uniqueKeys.hasNext() ) {
UniqueKey key = (UniqueKey) uniqueKeys.next();
if (table.hasPrimaryKey() && table.getPrimaryKey().getColumns().equals(key.getColumns())) {
@@ -184,9 +179,13 @@
return ((Column)object).getName();
}
});
- constraints.append(constraint.getResult());
+ cons.add( constraint.getResult() );
}
- return constraints.toString();
+
+ AnnotationBuilder builder = AnnotationBuilder.createAnnotation( "dummyAnnotation" );
+ builder.addAttributes( "dummyAttribute", cons.iterator() );
+ String attributeAsString = builder.getAttributeAsString( "dummyAttribute" );
+ return attributeAsString==null?"":attributeAsString;
}
@@ -522,7 +521,7 @@
}
String uniqueConstraint = generateAnnTableUniqueConstraint(table);
if ( uniqueConstraint.length() > 0 ) {
- annotation.append(", uniqueConstraints={").append(uniqueConstraint).append("}");
+ annotation.append(", uniqueConstraints={").append(uniqueConstraint).append("} ");
}
annotation.append( ", joinColumns = { ");
buildArrayOfJoinColumnAnnotation(
@@ -791,11 +790,11 @@
return clazz.getVersion();
}
- public abstract class IteratorTransformer implements Iterator {
+ static public abstract class IteratorTransformer implements Iterator {
private Iterator delegate;
- IteratorTransformer(Iterator delegate) {
+ public IteratorTransformer(Iterator delegate) {
this.delegate = delegate;
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -65,7 +65,6 @@
public boolean hasIdentifierProperty();
- public boolean needsAnnTableUniqueConstraints();
public String generateAnnColumnAnnotation(Property property);
public String generateAnnIdGenerator();
public String generateAnnTableUniqueConstraint();
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/pojo/Ejb3TypeDeclaration.ftl 2006-12-09 12:00:48 UTC (rev 10965)
@@ -9,8 +9,9 @@
</#if><#if clazz.table.catalog?exists>
,catalog="${clazz.table.catalog}"
</#if>
-<#if pojo.needsAnnTableUniqueConstraints()>
- , uniqueConstraints = { ${pojo.generateAnnTableUniqueConstraint()} }
+<#assign uniqueConstraint=pojo.generateAnnTableUniqueConstraint()>
+<#if uniqueConstraint?has_content>
+ , uniqueConstraints = { ${uniqueConstraint} }
</#if>)
</#if>
</#if>
\ No newline at end of file
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -23,12 +23,12 @@
private File outputdir;
public BaseTestCase(String name) {
- super(name);
+ super(name);
this.outputdir = new File("toolstestoutput", getClass().getName());
}
public BaseTestCase(String name, String out) {
- super(name);
+ super(name);
this.outputdir = new File("toolstestoutput", out);
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Author.hbm.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Author.hbm.xml 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Author.hbm.xml 2006-12-09 12:00:48 UTC (rev 10965)
@@ -22,8 +22,8 @@
</id>
<natural-id>
- <property name="name" type="string" not-null="true" length="100"/>
- <property name="address" type="string" not-null="true" length="200"/>
+ <property name="name" type="string" not-null="true" length="100" unique="true"/>
+ <property name="address" type="string" not-null="true" length="200" unique="true"/>
</natural-id>
<set name="articles"
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -8,12 +8,14 @@
import java.util.ArrayList;
import java.util.List;
+import org.hibernate.mapping.Column;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.tool.NonReflectiveTestCase;
import org.hibernate.tool.hbm2x.pojo.AnnotationBuilder;
import org.hibernate.tool.hbm2x.pojo.EntityPOJOClass;
import org.hibernate.tool.hbm2x.pojo.POJOClass;
+import org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.IteratorTransformer;
import org.hibernate.tool.test.TestHelper;
/**
@@ -199,6 +201,23 @@
assertEquals("@abc(it={\"42\", \"xxx\"})", builder.getResult());
+ List columns = new ArrayList();
+ columns.add("first");
+ columns.add("second");
+
+ AnnotationBuilder constraint = AnnotationBuilder.createAnnotation( "UniqueConstraint" );
+ constraint.addQuotedAttributes( "columnNames", new IteratorTransformer(columns.iterator()) {
+ public Object transform(Object object) {
+ return object.toString();
+ }
+ });
+ constraint.addAttribute( "single", "value" );
+
+ String attribute = constraint.getAttributeAsString("columnNames");
+ assertEquals("\"first\", \"second\"", attribute);
+
+ assertEquals("value", constraint.getAttributeAsString( "single" ));
+
}
protected void tearDown() throws Exception {
Added: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java 2006-12-08 16:06:49 UTC (rev 10964)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/JdbcHbm2JavaEjb3Test.java 2006-12-09 12:00:48 UTC (rev 10965)
@@ -0,0 +1,81 @@
+/*
+ * Created on 2004-12-01
+ *
+ */
+package org.hibernate.tool.hbm2x;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.tool.JDBCMetaDataBinderTestCase;
+import org.hibernate.tool.test.TestHelper;
+
+/**
+ * @author max
+ *
+ *
+ */
+public class JdbcHbm2JavaEjb3Test extends JDBCMetaDataBinderTestCase {
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ POJOExporter exporter = new POJOExporter(getConfiguration(), getOutputDir() );
+ exporter.setTemplatePath(new String[0]);
+ exporter.getProperties().setProperty("ejb3", "true");
+ exporter.getProperties().setProperty("jdk5", "true");
+
+ exporter.start();
+ }
+
+ public void testFileExistence() {
+ assertFileAndExists( new File(getOutputDir().getAbsolutePath() + "/Master.java") );
+ }
+
+ public void testUniqueConstraints() {
+ assertEquals(null, findFirstString( "uniqueConstraints", new File(getOutputDir(),"Master.java") ));
+ assertNotNull(findFirstString( "uniqueConstraints", new File(getOutputDir(),"UniqueMaster.java") ));
+ }
+ public void testCompile() {
+
+ File file = new File("ejb3compilable");
+ file.mkdir();
+
+ ArrayList list = new ArrayList();
+ List jars = new ArrayList();
+ jars.add("ejb3-persistence.jar");
+ jars.add("hibernate-annotations.jar");
+ TestHelper.compile(getOutputDir(), file, TestHelper.visitAllFiles(getOutputDir(), list), "1.5", TestHelper.buildClasspath(jars));
+
+ TestHelper.deleteDir(file);
+ }
+
+
+ protected void tearDown() throws Exception {
+
+ //super.tearDown();
+ }
+
+
+ protected String getBaseForMappings() {
+ return "org/hibernate/tool/hbm2x/";
+ }
+
+ protected String[] getCreateSQL() {
+
+ return new String[] {
+ "create table master ( id char not null, name varchar(20), othername varchar(20), primary key (id) )",
+ "create table uniquemaster ( id char not null, name varchar(20), othername varchar(20), primary key (id), constraint o1 unique (name), constraint o2 unique (othername) )",
+ };
+ }
+
+ protected String[] getDropSQL() {
+
+ return new String[] {
+ "drop table master",
+ "drop table uniquemaster"
+ };
+ }
+}
17 years, 4 months
Hibernate SVN: r10964 - in branches/Branch_3_2/Hibernate3: src/org/hibernate/dialect test/org/hibernate/test
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-12-08 11:06:49 -0500 (Fri, 08 Dec 2006)
New Revision: 10964
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Dialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/H2Dialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/IngresDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/TestCase.java
Log:
HHH-2286 : dialect informational metadata;
javadoc and code cleanup
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -634,4 +634,19 @@
return extractUsingTemplate( "constraint (", ") violated", sqle.getMessage() );
}
};
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean areStringComparisonsCaseInsensitive() {
+ return true;
+ }
+
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -201,7 +201,7 @@
}*/
/**
- * Render the <tt>rownumber() over ( .... ) as rownumber_,</tt>
+ * Render the <tt>rownumber() over ( .... ) as rownumber_,</tt>
* bit, that goes in the select list
*/
private String getRowNumber(String sql) {
@@ -309,13 +309,13 @@
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
boolean isResultSet = ps.execute();
- // This assumes you will want to ignore any update counts
+ // This assumes you will want to ignore any update counts
while (!isResultSet && ps.getUpdateCount() != -1) {
isResultSet = ps.getMoreResults();
}
ResultSet rs = ps.getResultSet();
- // 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
+ // 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 rs;
}
@@ -360,4 +360,10 @@
public String getCurrentTimestampSQLFunctionName() {
return "sysdate";
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -20,7 +20,7 @@
/**
* @author Simon Johnston
*
- * Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
+ * Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
* override for the identity column generator as well as for the case statement
* issue documented at:
* http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby
@@ -128,8 +128,8 @@
// are present and "do the right thing"
boolean leading = true; // should leading trim-characters be trimmed?
boolean trailing = true; // should trailing trim-characters be trimmed?
- String trimCharacter = null; // the trim-character
- String trimSource = null; // the trim-source
+ String trimCharacter; // the trim-character
+ String trimSource; // the trim-source
// potentialTrimCharacterArgIndex = 1 assumes that a
// trim-specification has been specified. we handle the
@@ -167,8 +167,7 @@
}
}
- List argsToUse = null;
- argsToUse = new ArrayList();
+ List argsToUse = new ArrayList();
argsToUse.add( trimSource );
argsToUse.add( trimCharacter );
@@ -189,4 +188,16 @@
}
}
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsExpectedLobUsagePattern() {
+ // My attempts on Derby show this not working with CLOBs or BLOBs.
+ // An example of the error message I get with CLOBs is:
+ // A truncation error was encountered trying to shrink CLOB 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&' to length 255.
+ //
+ // I highly suspect this would be the case with all DB2 variant databases...
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Dialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Dialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -105,7 +105,7 @@
}
if ( sqlTypes.length != 1 ) throw new QueryException( "multi-column type in sum()" );
int sqlType = sqlTypes[0];
-
+
// First allow the actual type to control the return value. (the actual underlying sqltype could actually be different)
if ( columnType == Hibernate.BIG_INTEGER ) {
return Hibernate.BIG_INTEGER;
@@ -118,21 +118,21 @@
}
else if ( columnType == Hibernate.FLOAT || columnType == Hibernate.DOUBLE) {
return Hibernate.DOUBLE;
- }
-
+ }
+
// finally use the sqltype if == on Hibernate types did not find a match.
if ( sqlType == Types.NUMERIC ) {
- return columnType; //because numeric can be anything
- }
+ return columnType; //because numeric can be anything
+ }
else if ( sqlType == Types.FLOAT || sqlType == Types.DOUBLE || sqlType == Types.DECIMAL || sqlType == Types.REAL) {
return Hibernate.DOUBLE;
- }
+ }
else if ( sqlType == Types.BIGINT || sqlType == Types.INTEGER || sqlType == Types.SMALLINT || sqlType == Types.TINYINT ) {
return Hibernate.LONG;
}
else {
return columnType;
- }
+ }
}
});
}
@@ -166,7 +166,7 @@
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "cast", new CastFunction() );
registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(?1 ?2 ?3)") );
-
+
//map second/minute/hour/day/month/year to ANSI extract(), override on subclasses
registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(second from ?1)") );
registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(minute from ?1)") );
@@ -174,7 +174,7 @@
registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(day from ?1)") );
registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(month from ?1)") );
registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(year from ?1)") );
-
+
registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as char)") );
// register hibernate types for default use in scalar sqlquery type auto detection
@@ -367,14 +367,14 @@
public String getHibernateTypeName(int code, int length, int precision, int scale) throws HibernateException {
String result = hibernateTypeNames.get( code, length, precision, scale );
if ( result == null ) {
- throw new HibernateException(
+ throw new HibernateException(
"No Hibernate type mapping for java.sql.Types code: " +
code +
", length: " +
- length
+ length
);
}
- return result;
+ return result;
}
/**
@@ -423,7 +423,7 @@
protected void registerKeyword(String word) {
sqlKeywords.add(word);
}
-
+
public Set getKeywords() {
return sqlKeywords;
}
@@ -1164,16 +1164,6 @@
}
/**
- * Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
- * {@link java.sql.PreparedStatement#setBinaryStream}).
- *
- * @return True if BLOBs and CLOBs should be bound using stream operations.
- */
- public boolean useInputStreamToInsertBlob() {
- return true;
- }
-
- /**
* Meant as a means for end users to affect the select strings being sent
* to the database and perhaps manipulate them in some fashion.
* <p/>
@@ -1206,33 +1196,7 @@
return bool ? "1" : "0";
}
- /**
- * Does this dialect support parameters within the select clause of
- * INSERT ... SELECT ... statements?
- *
- * @return True if this is supported; false otherwise.
- */
- public boolean supportsParametersInInsertSelect() {
- return true;
- }
- /**
- * Is this dialect known to support what ANSI-SQL terms "row value
- * constructor" syntax; sometimes called tuple syntax.
- * <p/>
- * Basically, does it support syntax like
- * "... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
- *
- * @return True if this SQL dialect is known to support "row value
- * constructor" syntax; false otherwise.
- * @since 3.2
- */
- public boolean supportsRowValueConstructorSyntax() {
- // return false here, as most databases do not properly support this construct...
- return false;
- }
-
-
// identifier quoting support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
@@ -1312,7 +1276,7 @@
public boolean supportsUnique() {
return true;
}
-
+
/**
* Does this dialect support adding Unique constraints via create and alter table ?
* @return boolean
@@ -1323,6 +1287,8 @@
/**
* The syntax used to add a column to a table (optional).
+ *
+ * @return The "add column" fragment.
*/
public String getAddColumnString() {
throw new UnsupportedOperationException( "No add column syntax supported by Dialect" );
@@ -1339,32 +1305,36 @@
/**
* The syntax used to add a foreign key constraint to a table.
- *
- * @param referencesPrimaryKey if false, constraint should be
+ *
+ * @param constraintName The FK constraint name.
+ * @param foreignKey The names of the columns comprising the FK
+ * @param referencedTable The table referenced by the FK
+ * @param primaryKey The explicit columns in the referencedTable referenced
+ * by this FK.
+ * @param referencesPrimaryKey if false, constraint should be
* explicit about which column names the constraint refers to
*
- * @return String
+ * @return the "add FK" fragment
*/
public String getAddForeignKeyConstraintString(
String constraintName,
String[] foreignKey,
String referencedTable,
- String[] primaryKey,
- boolean referencesPrimaryKey
- ) {
+ String[] primaryKey,
+ boolean referencesPrimaryKey) {
StringBuffer res = new StringBuffer( 30 );
-
+
res.append( " add constraint " )
- .append( constraintName )
- .append( " foreign key (" )
- .append( StringHelper.join( ", ", foreignKey ) )
- .append( ") references " )
- .append( referencedTable );
-
- if(!referencesPrimaryKey) {
- res.append(" (")
- .append( StringHelper.join(", ", primaryKey) )
- .append(')');
+ .append( constraintName )
+ .append( " foreign key (" )
+ .append( StringHelper.join( ", ", foreignKey ) )
+ .append( ") references " )
+ .append( referencedTable );
+
+ if ( !referencesPrimaryKey ) {
+ res.append( " (" )
+ .append( StringHelper.join( ", ", primaryKey ) )
+ .append( ')' );
}
return res.toString();
@@ -1373,7 +1343,8 @@
/**
* The syntax used to add a primary key constraint to a table.
*
- * @return String
+ * @param constraintName The name of the PK constraint.
+ * @return The "add PK" fragment
*/
public String getAddPrimaryKeyConstraintString(String constraintName) {
return " add constraint " + constraintName + " primary key ";
@@ -1414,6 +1385,9 @@
/**
* Does this dialect support column-level check constraints?
+ *
+ * @return True if column-level CHECK constraints are supported; false
+ * otherwise.
*/
public boolean supportsColumnCheck() {
return true;
@@ -1421,6 +1395,9 @@
/**
* Does this dialect support table-level check constraints?
+ *
+ * @return True if table-level CHECK constraints are supported; false
+ * otherwise.
*/
public boolean supportsTableCheck() {
return true;
@@ -1443,4 +1420,212 @@
return "";
}
+
+ // Informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * Does this dialect support empty IN lists?
+ * <p/>
+ * For example, is [where XYZ in ()] a supported construct?
+ *
+ * @return True if empty in lists are supported; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsEmptyInList() {
+ return true;
+ }
+
+ /**
+ * Are string comparisons implicitly case insensitive.
+ * <p/>
+ * In other words, does [where 'XYZ' = 'xyz'] resolve to true?
+ *
+ * @return True if comparisons are case insensitive.
+ * @since 3.2
+ */
+ public boolean areStringComparisonsCaseInsensitive() {
+ return false;
+ }
+
+ /**
+ * Is this dialect known to support what ANSI-SQL terms "row value
+ * constructor" syntax; sometimes called tuple syntax.
+ * <p/>
+ * Basically, does it support syntax like
+ * "... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
+ *
+ * @return True if this SQL dialect is known to support "row value
+ * constructor" syntax; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsRowValueConstructorSyntax() {
+ // return false here, as most databases do not properly support this construct...
+ return false;
+ }
+
+ /**
+ * If the dialect supports {@link #supportsRowValueConstructorSyntax() row values},
+ * does it offer such support in IN lists as well?
+ * <p/>
+ * For example, "... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ..."
+ *
+ * @return True if this SQL dialect is known to support "row value
+ * constructor" syntax in the IN list; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsRowValueConstructorSyntaxInInList() {
+ return false;
+ }
+
+ /**
+ * Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
+ * {@link java.sql.PreparedStatement#setBinaryStream}).
+ *
+ * @return True if BLOBs and CLOBs should be bound using stream operations.
+ * @since 3.2
+ */
+ public boolean useInputStreamToInsertBlob() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support parameters within the select clause of
+ * INSERT ... SELECT ... statements?
+ *
+ * @return True if this is supported; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsParametersInInsertSelect() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support asking the result set its positioning
+ * information on forward only cursors. Specifically, in the case of
+ * scrolling fetches, Hibernate needs to use
+ * {@link java.sql.ResultSet#isAfterLast} and
+ * {@link java.sql.ResultSet#isBeforeFirst}. Certain drivers do not
+ * allow access to these methods for forward only cursors.
+ * <p/>
+ * NOTE : this is highly driver dependent!
+ *
+ * @return True if methods like {@link java.sql.ResultSet#isAfterLast} and
+ * {@link java.sql.ResultSet#isBeforeFirst} are supported for forward
+ * only cursors; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support definition of cascade delete constraints
+ * which can cause circular chains?
+ *
+ * @return True if circular cascade delete constraints are supported; false
+ * otherwise.
+ * @since 3.2
+ */
+ public boolean supportsCircularCascadeDeleteConstraints() {
+ return true;
+ }
+
+ /**
+ * Are subselects supported as the left-hand-side (LHS) of
+ * IN-predicates.
+ * <p/>
+ * In other words, is syntax like "... <subquery> IN (1, 2, 3) ..." supported?
+ *
+ * @return True if subselects can appear as the LHS of an in-predicate;
+ * false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsSubselectAsInPredicateLHS() {
+ return true;
+ }
+
+ /**
+ * Expected LOB usage pattern is such that I can perform an insert
+ * via prepared statement with a parameter binding for a LOB value
+ * without crazy casting to JDBC driver implementation-specific classes...
+ * <p/>
+ * Part of the trickiness here is the fact that this is largely
+ * driver dependent. For example, Oracle (which is notoriously bad with
+ * LOB support in their drivers historically) actually does a pretty good
+ * job with LOB support as of the 10.2.x versions of their drivers...
+ *
+ * @return True if normal LOB usage patterns can be used with this driver;
+ * false if driver-specific hookiness needs to be applied.
+ * @since 3.2
+ */
+ public boolean supportsExpectedLobUsagePattern() {
+ return true;
+ }
+
+ /**
+ * Does the dialect support propogating changes to LOB
+ * values back to the database? Talking about mutating the
+ * internal value of the locator as opposed to supplying a new
+ * locator instance...
+ * <p/>
+ * For BLOBs, the internal value might be changed by:
+ * {@link java.sql.Blob#setBinaryStream},
+ * {@link java.sql.Blob#setBytes(long, byte[])},
+ * {@link java.sql.Blob#setBytes(long, byte[], int, int)},
+ * or {@link java.sql.Blob#truncate(long)}.
+ * <p/>
+ * For CLOBs, the internal value might be changed by:
+ * {@link java.sql.Clob#setAsciiStream(long)},
+ * {@link java.sql.Clob#setCharacterStream(long)},
+ * {@link java.sql.Clob#setString(long, String)},
+ * {@link java.sql.Clob#setString(long, String, int, int)},
+ * or {@link java.sql.Clob#truncate(long)}.
+ * <p/>
+ * NOTE : I do not know the correct answer currently for
+ * databases which (1) are not part of the cruise control process
+ * or (2) do not {@link #supportsExpectedLobUsagePattern}.
+ *
+ * @return True if the changes are propogated back to the
+ * database; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsLobValueChangePropogation() {
+ return true;
+ }
+
+ /**
+ * Is it supported to materialize a LOB locator outside the transaction in
+ * which it was created?
+ * <p/>
+ * Again, part of the trickiness here is the fact that this is largely
+ * driver dependent.
+ * <p/>
+ * NOTE: all database I have tested which {@link #supportsExpectedLobUsagePattern()}
+ * also support the ability to materialize a LOB outside the owning transaction...
+ *
+ * @return True if unbounded materialization is supported; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsUnboundedLobLocatorMaterialization() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support referencing the table being mutated in
+ * a subquery. The "table being mutated" is the table referenced in
+ * an UPDATE or a DELETE query. And so can that table then be
+ * referenced in a subquery of said UPDATE/DELETE query.
+ * <p/>
+ * For example, would the following two syntaxes be supported:<ul>
+ * <li>delete from TABLE_A where ID not in ( select ID from TABLE_A )</li>
+ * <li>update TABLE_A set NON_ID = 'something' where ID in ( select ID from TABLE_A)</li>
+ * </ul>
+ *
+ * @return True if this dialect allows references the mutating table from
+ * a subquery.
+ * @since 3.2
+ */
+ public boolean supportsSubqueryOnMutatingTable() {
+ return true;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/H2Dialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/H2Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/H2Dialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -275,4 +275,10 @@
return true;
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsLobValueChangePropogation() {
+ return false;
+ }
}
\ No newline at end of file
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -303,4 +303,15 @@
super.lock( id, version, object, session );
}
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean supportsLobValueChangePropogation() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/IngresDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/IngresDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/IngresDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -12,11 +12,11 @@
/**
* An Ingres SQL dialect.
- *
+ * <p/>
* Known limitations:
* - only supports simple constants or columns on the left side of an IN, making (1,2,3) in (...) or (<subselect) in (...) non-supported
* - supports only 31 digits in decimal
- *
+ *
* @author Ian Booth, Bruce Lunsford, Max Rydahl Andersen
*/
public class IngresDialect extends Dialect {
@@ -48,32 +48,32 @@
registerColumnType( Types.BLOB, "long byte" );
registerColumnType( Types.CLOB, "long varchar" );
- registerFunction( "abs", new StandardSQLFunction("abs") );
+ registerFunction( "abs", new StandardSQLFunction( "abs" ) );
registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "bit_add", new StandardSQLFunction("bit_add") );
- registerFunction( "bit_and", new StandardSQLFunction("bit_and") );
- registerFunction( "bit_length", new StandardSQLFunction("bit_length") );
- registerFunction( "bit_not", new StandardSQLFunction("bit_not") );
- registerFunction( "bit_or", new StandardSQLFunction("bit_or") );
- registerFunction( "bit_xor", new StandardSQLFunction("bit_xor") );
+ registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
+ registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
+ registerFunction( "bit_length", new StandardSQLFunction( "bit_length" ) );
+ registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
+ registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
+ registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","+",")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
- registerFunction( "current_time", new NoArgSQLFunction("date('now')", Hibernate.TIMESTAMP, false) );
- registerFunction( "current_timestamp", new NoArgSQLFunction("date('now')", Hibernate.TIMESTAMP, false) );
- registerFunction( "current_date", new NoArgSQLFunction("date('now')", Hibernate.TIMESTAMP, false) );
+ registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
- registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
+ registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
+ registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
- registerFunction( "hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
+ registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
@@ -81,10 +81,10 @@
registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "lower", new StandardSQLFunction("lower") );
- registerFunction( "lowercase", new StandardSQLFunction("lowercase") );
- registerFunction( "minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
- registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
+ registerFunction( "lower", new StandardSQLFunction( "lower" ) );
+ registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
+ registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
+ registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
@@ -93,18 +93,18 @@
registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
- registerFunction( "second", new StandardSQLFunction("second", Hibernate.INTEGER) );
+ registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
- registerFunction( "squeeze", new StandardSQLFunction("squeeze") );
+ registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
- registerFunction( "trim", new StandardSQLFunction("trim", Hibernate.STRING ) );
+ registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
- registerFunction( "upper", new StandardSQLFunction("upper") );
- registerFunction( "uppercase", new StandardSQLFunction("uppercase") );
+ registerFunction( "upper", new StandardSQLFunction( "upper" ) );
+ registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
@@ -112,42 +112,47 @@
registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
- registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
+ registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
}
-
+
/**
* Do we need to drop constraints before dropping tables in this dialect?
+ *
* @return boolean
*/
public boolean dropConstraints() {
return false;
}
-
+
/**
* Does this dialect support <tt>FOR UPDATE OF</tt>, allowing
* particular rows to be locked?
+ *
+ * @return True (Ingres does support "for update of" syntax...)
*/
public boolean supportsForUpdateOf() {
return true;
}
-
+
/**
* The syntax used to add a column to a table (optional).
*/
public String getAddColumnString() {
return "add column";
}
-
+
/**
* The keyword used to specify a nullable column.
+ *
* @return String
*/
public String getNullColumnString() {
return " with null";
}
-
+
/**
* Does this dialect support sequences?
+ *
* @return boolean
*/
public boolean supportsSequences() {
@@ -156,9 +161,10 @@
/**
* The syntax that fetches the next value of a sequence, if sequences are supported.
+ *
* @param sequenceName the name of the sequence
+ *
* @return String
- * @throws MappingException if no sequences
*/
public String getSequenceNextValString(String sequenceName) {
return "select nextval for " + sequenceName;
@@ -166,9 +172,10 @@
/**
* The syntax used to create a sequence, if sequences are supported.
+ *
* @param sequenceName the name of the sequence
+ *
* @return String
- * @throws MappingException if no sequences
*/
public String getCreateSequenceString(String sequenceName) {
return "create sequence " + sequenceName;
@@ -176,9 +183,10 @@
/**
* The syntax used to drop a sequence, if sequences are supported.
+ *
* @param sequenceName the name of the sequence
+ *
* @return String
- * @throws MappingException if no sequences
*/
public String getDropSequenceString(String sequenceName) {
return "drop sequence " + sequenceName + " restrict";
@@ -190,49 +198,50 @@
public String getQuerySequencesString() {
return "select seq_name from iisequence";
}
-
+
/**
- * The name of the SQL function that transforms a string to
+ * The name of the SQL function that transforms a string to
* lowercase
- *
+ *
* @return String
*/
public String getLowercaseFunction() {
return "lowercase";
}
-
+
/**
* Does this <tt>Dialect</tt> have some kind of <tt>LIMIT</tt> syntax?
*/
public boolean supportsLimit() {
return true;
}
-
+
/**
* Does this dialect support an offset?
*/
public boolean supportsLimitOffset() {
return false;
}
-
+
/**
* Add a <tt>LIMIT</tt> clause to the given SQL <tt>SELECT</tt>
+ *
* @return the modified SQL
*/
public String getLimitString(String querySelect, int offset, int limit) {
- if (offset > 0) {
+ if ( offset > 0 ) {
throw new UnsupportedOperationException( "offset not supported" );
}
- return new StringBuffer( querySelect.length()+16 )
- .append(querySelect)
- .insert(6, " first " + limit )
- .toString();
+ return new StringBuffer( querySelect.length() + 16 )
+ .append( querySelect )
+ .insert( 6, " first " + limit )
+ .toString();
}
public boolean supportsVariableLimit() {
return false;
}
-
+
/**
* Does the <tt>LIMIT</tt> clause take a "maximum" row number instead
* of a total number of returned rows?
@@ -240,6 +249,7 @@
public boolean useMaxForLimit() {
return true;
}
+
/**
* Ingres explicitly needs "unique not null", because "with null" is default
*/
@@ -249,7 +259,7 @@
/**
* Does this dialect support temporary tables?
- */
+ */
public boolean supportsTemporaryTables() {
return true;
}
@@ -263,14 +273,20 @@
}
public String generateTemporaryTableName(String baseTableName) {
- return "session." + super.generateTemporaryTableName(baseTableName);
+ return "session." + super.generateTemporaryTableName( baseTableName );
}
-
+
/**
* Expression for current_timestamp
*/
public String getCurrentTimestampSQLFunctionName() {
return "date(now)";
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsSubselectAsInPredicateLHS() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -163,7 +163,7 @@
public String getAddColumnString() {
return "add column";
}
-
+
public boolean qualifyIndexName() {
return false;
}
@@ -171,7 +171,7 @@
public boolean supportsIdentityColumns() {
return true;
}
-
+
public String getIdentitySelectString() {
return "select last_insert_id()";
}
@@ -181,9 +181,9 @@
}
public String getAddForeignKeyConstraintString(
- String constraintName,
- String[] foreignKey,
- String referencedTable,
+ String constraintName,
+ String[] foreignKey,
+ String referencedTable,
String[] primaryKey, boolean referencesPrimaryKey
) {
String cols = StringHelper.join(", ", foreignKey);
@@ -207,7 +207,7 @@
public boolean supportsLimit() {
return true;
}
-
+
public String getDropForeignKeyString() {
return " drop foreign key ";
}
@@ -218,7 +218,7 @@
.append( hasOffset ? " limit ?, ?" : " limit ?")
.toString();
}
-
+
/*
* Temporary, until MySQL fix Connector/J bug
*/
@@ -264,7 +264,7 @@
public boolean supportsCascadeDelete() {
return false;
}
-
+
public String getTableComment(String comment) {
return " comment='" + comment + "'";
}
@@ -310,15 +310,14 @@
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
return col;
- }
-
+ }
+
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
- boolean isResultSet = ps.execute();
- while (!isResultSet && ps.getUpdateCount() != -1) {
- isResultSet = ps.getMoreResults();
- }
- ResultSet rs = ps.getResultSet();
- return rs;
+ boolean isResultSet = ps.execute();
+ while (!isResultSet && ps.getUpdateCount() != -1) {
+ isResultSet = ps.getMoreResults();
+ }
+ return ps.getResultSet();
}
public boolean supportsRowValueConstructorSyntax() {
@@ -328,4 +327,24 @@
public Boolean performTemporaryTableDDLInIsolation() {
return Boolean.FALSE;
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean areStringComparisonsCaseInsensitive() {
+ return true;
+ }
+
+ public boolean supportsLobValueChangePropogation() {
+ // note: at least my local MySQL 5.1 install shows this not working...
+ return false;
+ }
+
+ public boolean supportsSubqueryOnMutatingTable() {
+ return false;
+ }
}
\ No newline at end of file
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -94,7 +94,7 @@
registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
-
+
registerFunction( "lastday", new StandardSQLFunction("lastday", Hibernate.DATE) );
registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
@@ -177,14 +177,14 @@
}
public String getLimitString(String sql, boolean hasOffset) {
-
+
sql = sql.trim();
boolean isForUpdate = false;
if ( sql.toLowerCase().endsWith(" for update") ) {
sql = sql.substring( 0, sql.length()-11 );
isForUpdate = true;
}
-
+
StringBuffer pagingSelect = new StringBuffer( sql.length()+100 );
if (hasOffset) {
pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
@@ -203,7 +203,7 @@
if ( isForUpdate ) {
pagingSelect.append( " for update" );
}
-
+
return pagingSelect.toString();
}
@@ -222,7 +222,7 @@
public boolean useMaxForLimit() {
return true;
}
-
+
public boolean forUpdateOfColumns() {
return true;
}
@@ -234,7 +234,7 @@
public String getSelectGUIDString() {
return "select rawtohex(sys_guid()) from dual";
}
-
+
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
return EXTRACTER;
}
@@ -264,7 +264,7 @@
};
// not final-static to avoid possible classcast exceptions if using different oracle drivers.
- int oracletypes_cursor_value = 0;
+ int oracletypes_cursor_value = 0;
public int registerResultSetOutParameter(java.sql.CallableStatement statement,int col) throws SQLException {
if(oracletypes_cursor_value==0) {
try {
@@ -272,24 +272,23 @@
oracletypes_cursor_value = types.getField("CURSOR").getInt(types.newInstance());
} catch (Exception se) {
throw new HibernateException("Problem while trying to load or access OracleTypes.CURSOR value",se);
- }
+ }
}
// register the type of the out param - an Oracle specific type
statement.registerOutParameter(col, oracletypes_cursor_value);
col++;
return col;
}
-
+
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
ps.execute();
- ResultSet rs = (ResultSet) ps.getObject(1);
- return rs;
+ return ( ResultSet ) ps.getObject( 1 );
}
public boolean supportsUnionAll() {
return true;
}
-
+
public boolean supportsCommentOn() {
return true;
}
@@ -326,4 +325,19 @@
public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean supportsRowValueConstructorSyntax() {
+ return true;
+ }
+
+ public boolean supportsRowValueConstructorSyntaxInInList() {
+ return true;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -293,7 +293,14 @@
}
};
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
public boolean supportsRowValueConstructorSyntax() {
return true;
}
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -10,7 +10,8 @@
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
/**
- * A dialect for Microsoft SQL Server 2000
+ * A dialect for Microsoft SQL Server 2000 and 2005
+ *
* @author Gavin King
*/
public class SQLServerDialect extends SybaseDialect {
@@ -103,4 +104,27 @@
public String getCurrentTimestampSelectString() {
return "select current_timestamp";
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean areStringComparisonsCaseInsensitive() {
+ return true;
+ }
+
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ return false;
+ }
+
+ public boolean supportsCircularCascadeDeleteConstraints() {
+ // SQL Server (at least up through 2005) does not support defining
+ // cascade delete constraints which can circel back to the mutating
+ // table
+ return false;
+ }
+
+ public boolean supportsLobValueChangePropogation() {
+ // note: at least my local SQL Server 2005 Express shows this not working...
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -56,7 +56,7 @@
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) );
@@ -92,7 +92,7 @@
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() );
@@ -140,21 +140,20 @@
return tableName;
}
}
-
+
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();
- }
- ResultSet rs = ps.getResultSet();
-// 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 rs;
+ 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() {
@@ -180,4 +179,11 @@
public boolean dropTemporaryTableAfterUse() {
return true; // sql-server, at least needed this dropped after use; strange!
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -16,21 +16,21 @@
/**
* A SQL dialect for TimesTen 5.1.
- *
+ *
* Known limitations:
* joined-subclass support because of no CASE support in TimesTen
* No support for subqueries that includes aggregation
* - size() in HQL not supported
* - user queries that does subqueries with aggregation
- * No CLOB/BLOB support
+ * No CLOB/BLOB support
* No cascade delete support.
* No Calendar support
* No support for updating primary keys.
- *
+ *
* @author Sherry Listgarten and Max Andersen
*/
public class TimesTenDialect extends Dialect {
-
+
public TimesTenDialect() {
super();
registerColumnType( Types.BIT, "TINYINT" );
@@ -47,11 +47,11 @@
registerColumnType( Types.TIMESTAMP, "TIMESTAMP" );
registerColumnType( Types.VARBINARY, "VARBINARY($l)" );
registerColumnType( Types.NUMERIC, "DECIMAL($p, $s)" );
- // TimesTen has no BLOB/CLOB support, but these types may be suitable
+ // TimesTen has no BLOB/CLOB support, but these types may be suitable
// for some applications. The length is limited to 4 million bytes.
- registerColumnType( Types.BLOB, "VARBINARY(4000000)" );
+ registerColumnType( Types.BLOB, "VARBINARY(4000000)" );
registerColumnType( Types.CLOB, "VARCHAR(4000000)" );
-
+
getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
registerFunction( "lower", new StandardSQLFunction("lower") );
@@ -66,11 +66,11 @@
registerFunction( "nvl", new StandardSQLFunction("nvl") );
}
-
+
public boolean dropConstraints() {
return true;
}
-
+
public boolean qualifyIndexName() {
return false;
}
@@ -78,11 +78,11 @@
public boolean supportsUnique() {
return false;
}
-
+
public boolean supportsUniqueConstraintInCreateAlterTable() {
return false;
}
-
+
public String getAddColumnString() {
return "add";
}
@@ -119,11 +119,11 @@
/*public boolean supportsForUpdateNowait() {
return false;
}*/
-
+
public String getForUpdateString() {
return "";
}
-
+
public boolean supportsColumnCheck() {
return false;
}
@@ -131,7 +131,7 @@
public boolean supportsTableCheck() {
return false;
}
-
+
public boolean supportsLimitOffset() {
return false;
}
@@ -148,17 +148,13 @@
return true;
}
- private static int getAfterSelectInsertPoint(String sql) {
- return 6; //sql.startsWith("select distinct") ? 15 : 6;
- }
-
public String getLimitString(String querySelect, int offset, int limit) {
if ( offset > 0 ) {
throw new UnsupportedOperationException( "TimesTen does not support offset" );
}
return new StringBuffer( querySelect.length()+8 )
.append(querySelect)
- .insert( getAfterSelectInsertPoint(querySelect), " first " + limit )
+ .insert( 6, " first " + limit )
.toString();
}
@@ -200,4 +196,10 @@
return new SelectLockingStrategy( lockable, lockMode );
}
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/TestCase.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/TestCase.java 2006-12-08 16:06:14 UTC (rev 10963)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/TestCase.java 2006-12-08 16:06:49 UTC (rev 10964)
@@ -20,17 +20,7 @@
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.dialect.Dialect;
-import org.hibernate.dialect.HSQLDialect;
-import org.hibernate.dialect.IngresDialect;
-import org.hibernate.dialect.MySQLDialect;
-import org.hibernate.dialect.Oracle9Dialect;
-import org.hibernate.dialect.PostgreSQLDialect;
-import org.hibernate.dialect.SQLServerDialect;
-import org.hibernate.dialect.SybaseDialect;
-import org.hibernate.dialect.TimesTenDialect;
import org.hibernate.dialect.DerbyDialect;
-import org.hibernate.dialect.Cache71Dialect;
-import org.hibernate.dialect.H2Dialect;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
@@ -193,12 +183,8 @@
Property prop = (Property) props.next();
if ( prop.getValue().isSimpleValue() ) {
String type = ( (SimpleValue) prop.getValue() ).getTypeName();
- if ( "blob".equals( type ) || "clob".equals( type ) ) {
- hasLob = true;
- }
- if ( Blob.class.getName().equals( type ) || Clob.class.getName().equals( type ) ) {
- hasLob = true;
- }
+ if ( "blob".equals(type) || "clob".equals(type) ) hasLob = true;
+ if ( Blob.class.getName().equals(type) || Clob.class.getName().equals(type) ) hasLob = true;
}
}
if ( !hasLob && !clazz.isInherited() && overrideCacheStrategy() ) {
@@ -486,24 +472,11 @@
* @return true if is allowed
*/
protected boolean dialectSupportsEmptyInList(String testDescription) {
- boolean canDoIt = dialectIsNot(
- new Class[] {
- Oracle9Dialect.class,
- MySQLDialect.class,
- DB2Dialect.class,
- HSQLDialect.class,
- SQLServerDialect.class,
- SybaseDialect.class,
- PostgreSQLDialect.class,
- TimesTenDialect.class,
- Cache71Dialect.class
- }
- );
-
- if ( !canDoIt ) {
- reportSkip( "Dialect does not support SQL: \'x in ()\'.", testDescription );
+ if ( ! getDialect().supportsEmptyInList() ) {
+ reportSkip( "Dialect does not support SQL empty in list : x in ()", testDescription );
+ return false;
}
- return canDoIt;
+ return true;
}
/**
@@ -512,35 +485,23 @@
* @return true if sensitive
*/
protected boolean dialectIsCaseSensitive(String testDescription) {
- // MySQL and SQLServer is case insensitive on strings (at least in default installation)
- boolean canDoIt = dialectIsNot(
- new Class[] { MySQLDialect.class, SQLServerDialect.class, Cache71Dialect.class }
- );
-
- if ( !canDoIt ) {
+ if ( getDialect().areStringComparisonsCaseInsensitive() ) {
reportSkip( "Dialect is case sensitive. ", testDescription );
+ return true;
}
- return canDoIt;
+ return false;
}
protected boolean supportsRowValueConstructorSyntaxInInList() {
- // this is a bit more lenient than Dialect.supportsRowValueConstructorSyntax() check
- boolean supported = ! (getDialect() instanceof HSQLDialect ||
- getDialect() instanceof PostgreSQLDialect ||
- getDialect() instanceof MySQLDialect ||
- getDialect() instanceof DB2Dialect ||
- getDialect() instanceof SybaseDialect ||
- getDialect() instanceof Cache71Dialect
- );
-
- if ( !supported ) {
+ if ( ! getDialect().supportsRowValueConstructorSyntaxInInList() ) {
reportSkip( "Dialect does not support 'tuple' syntax as part of an IN value list", "query support" );
+ return false;
}
- return supported;
+ return true;
}
protected boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
- if ( getDialect() instanceof SQLServerDialect || getDialect() instanceof Cache71Dialect ) {
+ if ( ! getDialect().supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() ) {
reportSkip( "Driver does not support 'position query' methods on forward-only cursors", "query support" );
return false;
}
@@ -548,20 +509,19 @@
}
protected boolean supportsCircularCascadeDelete() {
- if ( getDialect() instanceof SQLServerDialect ) {
+ if ( ! getDialect().supportsCircularCascadeDeleteConstraints() ) {
reportSkip( "db/dialect does not support 'circular' cascade delete constraints", "cascade delete constraint support" );
return false;
}
return true;
}
-
+
protected boolean supportsSubselectOnLeftSideIn() {
- if (dialectIsNot( IngresDialect.class )) {
- return true;
- } else {
+ if ( ! getDialect().supportsSubselectAsInPredicateLHS() ) {
reportSkip( "Database does not support (<subselect>) in ( ... ) ", "query support" );
return false;
}
+ return true;
}
/**
@@ -577,9 +537,7 @@
* @return True if expected usage pattern is support; false otherwise.
*/
protected boolean supportsExpectedLobUsagePattern() {
- // note : For Derby, the insertions get truncated...
- Class[] exceptions = new Class[] { DerbyDialect.class };
- if ( dialectIsOneOf( exceptions ) ) {
+ if ( ! getDialect().supportsExpectedLobUsagePattern() ) {
reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
return false;
}
@@ -596,12 +554,7 @@
* database; false otherwise.
*/
protected boolean supportsLobValueChangePropogation() {
- // note: at least my local MySQL 5.1 install shows this not working...
- // note: at least my local SQL Server 2005 Express shows this not working...
- Class[] exceptions = new Class[] {
- HSQLDialect.class, H2Dialect.class, MySQLDialect.class, SQLServerDialect.class
- };
- if ( dialectIsOneOf( exceptions ) ) {
+ if ( ! getDialect().supportsLobValueChangePropogation() ) {
reportSkip( "database/driver does not support propogating LOB value change back to database", "LOB support" );
return false;
}
@@ -617,12 +570,11 @@
* <p/>
* NOTE: all database I have tested which {@link #supportsExpectedLobUsagePattern()}
* also support the ability to materialize a LOB outside the owning transaction...
- *
+ *
* @return True if unbounded materialization is supported; false otherwise.
*/
protected boolean supportsUnboundedLobLocatorMaterialization() {
- Class[] exceptions = new Class[] { }; // none known of...
- if ( dialectIsOneOf( exceptions ) ) {
+ if ( !getDialect().supportsUnboundedLobLocatorMaterialization() ) {
reportSkip( "database/driver does not support materializing a LOB locator outside the 'owning' transaction", "LOB support" );
return false;
}
@@ -630,19 +582,18 @@
}
protected boolean supportsSubqueryOnMutatingTable() {
- // I only know of MySQL having this limitation...
- return dialectIsNot( MySQLDialect.class );
+ if ( !getDialect().supportsSubqueryOnMutatingTable() ) {
+ reportSkip( "database/driver does not support referencing mutating table in subquery", "bulk DML support" );
+ return false;
+ }
+ return true;
}
- private boolean dialectIs(Class dialectClass) {
+ protected boolean dialectIs(Class dialectClass) {
return dialectClass.isInstance( getDialect() );
}
- private boolean dialectIsNot(Class dialectClass) {
- return ! dialectIs( dialectClass );
- }
-
- private boolean dialectIsOneOf(Class[] dialectClasses) {
+ protected boolean dialectIsOneOf(Class[] dialectClasses) {
for ( int i = 0; i < dialectClasses.length; i++ ) {
if ( dialectClasses[i].isInstance( getDialect() ) ) {
return true;
@@ -651,7 +602,11 @@
return false;
}
- private boolean dialectIsNot(Class[] dialectClasses) {
+ protected boolean dialectIsNot(Class dialectClass) {
+ return ! dialectIs( dialectClass );
+ }
+
+ protected boolean dialectIsNot(Class[] dialectClasses) {
return ! dialectIsOneOf( dialectClasses );
}
17 years, 4 months
Hibernate SVN: r10963 - in trunk/Hibernate3: src/org/hibernate/dialect test/org/hibernate/test
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-12-08 11:06:14 -0500 (Fri, 08 Dec 2006)
New Revision: 10963
Modified:
trunk/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java
trunk/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java
trunk/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/Dialect.java
trunk/Hibernate3/src/org/hibernate/dialect/H2Dialect.java
trunk/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/IngresDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java
trunk/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java
trunk/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java
trunk/Hibernate3/test/org/hibernate/test/TestCase.java
Log:
HHH-2286 : dialect informational metadata;
javadoc and code cleanup
Modified: trunk/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/Cache71Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -634,4 +634,19 @@
return extractUsingTemplate( "constraint (", ") violated", sqle.getMessage() );
}
};
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean areStringComparisonsCaseInsensitive() {
+ return true;
+ }
+
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -360,4 +360,10 @@
public String getCurrentTimestampSQLFunctionName() {
return "sysdate";
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/DerbyDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -128,8 +128,8 @@
// are present and "do the right thing"
boolean leading = true; // should leading trim-characters be trimmed?
boolean trailing = true; // should trailing trim-characters be trimmed?
- String trimCharacter = null; // the trim-character
- String trimSource = null; // the trim-source
+ String trimCharacter; // the trim-character
+ String trimSource; // the trim-source
// potentialTrimCharacterArgIndex = 1 assumes that a
// trim-specification has been specified. we handle the
@@ -167,8 +167,7 @@
}
}
- List argsToUse = null;
- argsToUse = new ArrayList();
+ List argsToUse = new ArrayList();
argsToUse.add( trimSource );
argsToUse.add( trimCharacter );
@@ -189,4 +188,16 @@
}
}
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsExpectedLobUsagePattern() {
+ // My attempts on Derby show this not working with CLOBs or BLOBs.
+ // An example of the error message I get with CLOBs is:
+ // A truncation error was encountered trying to shrink CLOB 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&' to length 255.
+ //
+ // I highly suspect this would be the case with all DB2 variant databases...
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/Dialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/Dialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -1164,16 +1164,6 @@
}
/**
- * Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
- * {@link java.sql.PreparedStatement#setBinaryStream}).
- *
- * @return True if BLOBs and CLOBs should be bound using stream operations.
- */
- public boolean useInputStreamToInsertBlob() {
- return true;
- }
-
- /**
* Meant as a means for end users to affect the select strings being sent
* to the database and perhaps manipulate them in some fashion.
* <p/>
@@ -1206,33 +1196,7 @@
return bool ? "1" : "0";
}
- /**
- * Does this dialect support parameters within the select clause of
- * INSERT ... SELECT ... statements?
- *
- * @return True if this is supported; false otherwise.
- */
- public boolean supportsParametersInInsertSelect() {
- return true;
- }
- /**
- * Is this dialect known to support what ANSI-SQL terms "row value
- * constructor" syntax; sometimes called tuple syntax.
- * <p/>
- * Basically, does it support syntax like
- * "... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
- *
- * @return True if this SQL dialect is known to support "row value
- * constructor" syntax; false otherwise.
- * @since 3.2
- */
- public boolean supportsRowValueConstructorSyntax() {
- // return false here, as most databases do not properly support this construct...
- return false;
- }
-
-
// identifier quoting support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
@@ -1323,6 +1287,8 @@
/**
* The syntax used to add a column to a table (optional).
+ *
+ * @return The "add column" fragment.
*/
public String getAddColumnString() {
throw new UnsupportedOperationException( "No add column syntax supported by Dialect" );
@@ -1340,31 +1306,35 @@
/**
* The syntax used to add a foreign key constraint to a table.
*
+ * @param constraintName The FK constraint name.
+ * @param foreignKey The names of the columns comprising the FK
+ * @param referencedTable The table referenced by the FK
+ * @param primaryKey The explicit columns in the referencedTable referenced
+ * by this FK.
* @param referencesPrimaryKey if false, constraint should be
* explicit about which column names the constraint refers to
*
- * @return String
+ * @return the "add FK" fragment
*/
public String getAddForeignKeyConstraintString(
String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey,
- boolean referencesPrimaryKey
- ) {
+ boolean referencesPrimaryKey) {
StringBuffer res = new StringBuffer( 30 );
res.append( " add constraint " )
- .append( constraintName )
- .append( " foreign key (" )
- .append( StringHelper.join( ", ", foreignKey ) )
- .append( ") references " )
- .append( referencedTable );
+ .append( constraintName )
+ .append( " foreign key (" )
+ .append( StringHelper.join( ", ", foreignKey ) )
+ .append( ") references " )
+ .append( referencedTable );
- if(!referencesPrimaryKey) {
- res.append(" (")
- .append( StringHelper.join(", ", primaryKey) )
- .append(')');
+ if ( !referencesPrimaryKey ) {
+ res.append( " (" )
+ .append( StringHelper.join( ", ", primaryKey ) )
+ .append( ')' );
}
return res.toString();
@@ -1373,7 +1343,8 @@
/**
* The syntax used to add a primary key constraint to a table.
*
- * @return String
+ * @param constraintName The name of the PK constraint.
+ * @return The "add PK" fragment
*/
public String getAddPrimaryKeyConstraintString(String constraintName) {
return " add constraint " + constraintName + " primary key ";
@@ -1414,6 +1385,9 @@
/**
* Does this dialect support column-level check constraints?
+ *
+ * @return True if column-level CHECK constraints are supported; false
+ * otherwise.
*/
public boolean supportsColumnCheck() {
return true;
@@ -1421,6 +1395,9 @@
/**
* Does this dialect support table-level check constraints?
+ *
+ * @return True if table-level CHECK constraints are supported; false
+ * otherwise.
*/
public boolean supportsTableCheck() {
return true;
@@ -1443,4 +1420,211 @@
return "";
}
+
+ // Informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * Does this dialect support empty IN lists?
+ * <p/>
+ * For example, is [where XYZ in ()] a supported construct?
+ *
+ * @return True if empty in lists are supported; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsEmptyInList() {
+ return true;
+ }
+
+ /**
+ * Are string comparisons implicitly case insensitive.
+ * <p/>
+ * In other words, does [where 'XYZ' = 'xyz'] resolve to true?
+ *
+ * @return True if comparisons are case insensitive.
+ * @since 3.2
+ */
+ public boolean areStringComparisonsCaseInsensitive() {
+ return false;
+ }
+
+ /**
+ * Is this dialect known to support what ANSI-SQL terms "row value
+ * constructor" syntax; sometimes called tuple syntax.
+ * <p/>
+ * Basically, does it support syntax like
+ * "... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
+ *
+ * @return True if this SQL dialect is known to support "row value
+ * constructor" syntax; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsRowValueConstructorSyntax() {
+ // return false here, as most databases do not properly support this construct...
+ return false;
+ }
+
+ /**
+ * If the dialect supports {@link #supportsRowValueConstructorSyntax() row values},
+ * does it offer such support in IN lists as well?
+ * <p/>
+ * For example, "... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ..."
+ *
+ * @return True if this SQL dialect is known to support "row value
+ * constructor" syntax in the IN list; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsRowValueConstructorSyntaxInInList() {
+ return false;
+ }
+
+ /**
+ * Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
+ * {@link java.sql.PreparedStatement#setBinaryStream}).
+ *
+ * @return True if BLOBs and CLOBs should be bound using stream operations.
+ * @since 3.2
+ */
+ public boolean useInputStreamToInsertBlob() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support parameters within the select clause of
+ * INSERT ... SELECT ... statements?
+ *
+ * @return True if this is supported; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsParametersInInsertSelect() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support asking the result set its positioning
+ * information on forward only cursors. Specifically, in the case of
+ * scrolling fetches, Hibernate needs to use
+ * {@link java.sql.ResultSet#isAfterLast} and
+ * {@link java.sql.ResultSet#isBeforeFirst}. Certain drivers do not
+ * allow access to these methods for forward only cursors.
+ * <p/>
+ * NOTE : this is highly driver dependent!
+ *
+ * @return True if methods like {@link java.sql.ResultSet#isAfterLast} and
+ * {@link java.sql.ResultSet#isBeforeFirst} are supported for forward
+ * only cursors; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support definition of cascade delete constraints
+ * which can cause circular chains?
+ *
+ * @return True if circular cascade delete constraints are supported; false
+ * otherwise.
+ * @since 3.2
+ */
+ public boolean supportsCircularCascadeDeleteConstraints() {
+ return true;
+ }
+
+ /**
+ * Are subselects supported as the left-hand-side (LHS) of
+ * IN-predicates.
+ * <p/>
+ * In other words, is syntax like "... <subquery> IN (1, 2, 3) ..." supported?
+ *
+ * @return True if subselects can appear as the LHS of an in-predicate;
+ * false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsSubselectAsInPredicateLHS() {
+ return true;
+ }
+
+ /**
+ * Expected LOB usage pattern is such that I can perform an insert
+ * via prepared statement with a parameter binding for a LOB value
+ * without crazy casting to JDBC driver implementation-specific classes...
+ * <p/>
+ * Part of the trickiness here is the fact that this is largely
+ * driver dependent. For example, Oracle (which is notoriously bad with
+ * LOB support in their drivers historically) actually does a pretty good
+ * job with LOB support as of the 10.2.x versions of their drivers...
+ *
+ * @return True if normal LOB usage patterns can be used with this driver;
+ * false if driver-specific hookiness needs to be applied.
+ * @since 3.2
+ */
+ public boolean supportsExpectedLobUsagePattern() {
+ return true;
+ }
+
+ /**
+ * Does the dialect support propogating changes to LOB
+ * values back to the database? Talking about mutating the
+ * internal value of the locator as opposed to supplying a new
+ * locator instance...
+ * <p/>
+ * For BLOBs, the internal value might be changed by:
+ * {@link java.sql.Blob#setBinaryStream},
+ * {@link java.sql.Blob#setBytes(long, byte[])},
+ * {@link java.sql.Blob#setBytes(long, byte[], int, int)},
+ * or {@link java.sql.Blob#truncate(long)}.
+ * <p/>
+ * For CLOBs, the internal value might be changed by:
+ * {@link java.sql.Clob#setAsciiStream(long)},
+ * {@link java.sql.Clob#setCharacterStream(long)},
+ * {@link java.sql.Clob#setString(long, String)},
+ * {@link java.sql.Clob#setString(long, String, int, int)},
+ * or {@link java.sql.Clob#truncate(long)}.
+ * <p/>
+ * NOTE : I do not know the correct answer currently for
+ * databases which (1) are not part of the cruise control process
+ * or (2) do not {@link #supportsExpectedLobUsagePattern}.
+ *
+ * @return True if the changes are propogated back to the
+ * database; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsLobValueChangePropogation() {
+ return true;
+ }
+
+ /**
+ * Is it supported to materialize a LOB locator outside the transaction in
+ * which it was created?
+ * <p/>
+ * Again, part of the trickiness here is the fact that this is largely
+ * driver dependent.
+ * <p/>
+ * NOTE: all database I have tested which {@link #supportsExpectedLobUsagePattern()}
+ * also support the ability to materialize a LOB outside the owning transaction...
+ *
+ * @return True if unbounded materialization is supported; false otherwise.
+ * @since 3.2
+ */
+ public boolean supportsUnboundedLobLocatorMaterialization() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support referencing the table being mutated in
+ * a subquery. The "table being mutated" is the table referenced in
+ * an UPDATE or a DELETE query. And so can that table then be
+ * referenced in a subquery of said UPDATE/DELETE query.
+ * <p/>
+ * For example, would the following two syntaxes be supported:<ul>
+ * <li>delete from TABLE_A where ID not in ( select ID from TABLE_A )</li>
+ * <li>update TABLE_A set NON_ID = 'something' where ID in ( select ID from TABLE_A)</li>
+ * </ul>
+ *
+ * @return True if this dialect allows references the mutating table from
+ * a subquery.
+ */
+ public boolean supportsSubqueryOnMutatingTable() {
+ return true;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/H2Dialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/H2Dialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/H2Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -275,4 +275,10 @@
return true;
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsLobValueChangePropogation() {
+ return false;
+ }
}
\ No newline at end of file
Modified: trunk/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/HSQLDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -303,4 +303,15 @@
super.lock( id, version, object, session );
}
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean supportsLobValueChangePropogation() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/IngresDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/IngresDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/IngresDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -12,11 +12,11 @@
/**
* An Ingres SQL dialect.
- *
+ * <p/>
* Known limitations:
* - only supports simple constants or columns on the left side of an IN, making (1,2,3) in (...) or (<subselect) in (...) non-supported
* - supports only 31 digits in decimal
- *
+ *
* @author Ian Booth, Bruce Lunsford, Max Rydahl Andersen
*/
public class IngresDialect extends Dialect {
@@ -48,32 +48,32 @@
registerColumnType( Types.BLOB, "long byte" );
registerColumnType( Types.CLOB, "long varchar" );
- registerFunction( "abs", new StandardSQLFunction("abs") );
+ registerFunction( "abs", new StandardSQLFunction( "abs" ) );
registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "bit_add", new StandardSQLFunction("bit_add") );
- registerFunction( "bit_and", new StandardSQLFunction("bit_and") );
- registerFunction( "bit_length", new StandardSQLFunction("bit_length") );
- registerFunction( "bit_not", new StandardSQLFunction("bit_not") );
- registerFunction( "bit_or", new StandardSQLFunction("bit_or") );
- registerFunction( "bit_xor", new StandardSQLFunction("bit_xor") );
+ registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
+ registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
+ registerFunction( "bit_length", new StandardSQLFunction( "bit_length" ) );
+ registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
+ registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
+ registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","+",")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
- registerFunction( "current_time", new NoArgSQLFunction("date('now')", Hibernate.TIMESTAMP, false) );
- registerFunction( "current_timestamp", new NoArgSQLFunction("date('now')", Hibernate.TIMESTAMP, false) );
- registerFunction( "current_date", new NoArgSQLFunction("date('now')", Hibernate.TIMESTAMP, false) );
+ registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
- registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
+ registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
+ registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
- registerFunction( "hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
+ registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
@@ -81,10 +81,10 @@
registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "lower", new StandardSQLFunction("lower") );
- registerFunction( "lowercase", new StandardSQLFunction("lowercase") );
- registerFunction( "minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
- registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
+ registerFunction( "lower", new StandardSQLFunction( "lower" ) );
+ registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
+ registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
+ registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
@@ -93,18 +93,18 @@
registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
- registerFunction( "second", new StandardSQLFunction("second", Hibernate.INTEGER) );
+ registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
- registerFunction( "squeeze", new StandardSQLFunction("squeeze") );
+ registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
- registerFunction( "trim", new StandardSQLFunction("trim", Hibernate.STRING ) );
+ registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
- registerFunction( "upper", new StandardSQLFunction("upper") );
- registerFunction( "uppercase", new StandardSQLFunction("uppercase") );
+ registerFunction( "upper", new StandardSQLFunction( "upper" ) );
+ registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
@@ -112,42 +112,47 @@
registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
- registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
+ registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
}
-
+
/**
* Do we need to drop constraints before dropping tables in this dialect?
+ *
* @return boolean
*/
public boolean dropConstraints() {
return false;
}
-
+
/**
* Does this dialect support <tt>FOR UPDATE OF</tt>, allowing
* particular rows to be locked?
+ *
+ * @return True (Ingres does support "for update of" syntax...)
*/
public boolean supportsForUpdateOf() {
return true;
}
-
+
/**
* The syntax used to add a column to a table (optional).
*/
public String getAddColumnString() {
return "add column";
}
-
+
/**
* The keyword used to specify a nullable column.
+ *
* @return String
*/
public String getNullColumnString() {
return " with null";
}
-
+
/**
* Does this dialect support sequences?
+ *
* @return boolean
*/
public boolean supportsSequences() {
@@ -156,9 +161,10 @@
/**
* The syntax that fetches the next value of a sequence, if sequences are supported.
+ *
* @param sequenceName the name of the sequence
+ *
* @return String
- * @throws MappingException if no sequences
*/
public String getSequenceNextValString(String sequenceName) {
return "select nextval for " + sequenceName;
@@ -166,9 +172,10 @@
/**
* The syntax used to create a sequence, if sequences are supported.
+ *
* @param sequenceName the name of the sequence
+ *
* @return String
- * @throws MappingException if no sequences
*/
public String getCreateSequenceString(String sequenceName) {
return "create sequence " + sequenceName;
@@ -176,9 +183,10 @@
/**
* The syntax used to drop a sequence, if sequences are supported.
+ *
* @param sequenceName the name of the sequence
+ *
* @return String
- * @throws MappingException if no sequences
*/
public String getDropSequenceString(String sequenceName) {
return "drop sequence " + sequenceName + " restrict";
@@ -190,49 +198,50 @@
public String getQuerySequencesString() {
return "select seq_name from iisequence";
}
-
+
/**
- * The name of the SQL function that transforms a string to
+ * The name of the SQL function that transforms a string to
* lowercase
- *
+ *
* @return String
*/
public String getLowercaseFunction() {
return "lowercase";
}
-
+
/**
* Does this <tt>Dialect</tt> have some kind of <tt>LIMIT</tt> syntax?
*/
public boolean supportsLimit() {
return true;
}
-
+
/**
* Does this dialect support an offset?
*/
public boolean supportsLimitOffset() {
return false;
}
-
+
/**
* Add a <tt>LIMIT</tt> clause to the given SQL <tt>SELECT</tt>
+ *
* @return the modified SQL
*/
public String getLimitString(String querySelect, int offset, int limit) {
- if (offset > 0) {
+ if ( offset > 0 ) {
throw new UnsupportedOperationException( "offset not supported" );
}
- return new StringBuffer( querySelect.length()+16 )
- .append(querySelect)
- .insert(6, " first " + limit )
- .toString();
+ return new StringBuffer( querySelect.length() + 16 )
+ .append( querySelect )
+ .insert( 6, " first " + limit )
+ .toString();
}
public boolean supportsVariableLimit() {
return false;
}
-
+
/**
* Does the <tt>LIMIT</tt> clause take a "maximum" row number instead
* of a total number of returned rows?
@@ -240,6 +249,7 @@
public boolean useMaxForLimit() {
return true;
}
+
/**
* Ingres explicitly needs "unique not null", because "with null" is default
*/
@@ -249,7 +259,7 @@
/**
* Does this dialect support temporary tables?
- */
+ */
public boolean supportsTemporaryTables() {
return true;
}
@@ -263,14 +273,20 @@
}
public String generateTemporaryTableName(String baseTableName) {
- return "session." + super.generateTemporaryTableName(baseTableName);
+ return "session." + super.generateTemporaryTableName( baseTableName );
}
-
+
/**
* Expression for current_timestamp
*/
public String getCurrentTimestampSQLFunctionName() {
return "date(now)";
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsSubselectAsInPredicateLHS() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/MySQLDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -317,8 +317,7 @@
while (!isResultSet && ps.getUpdateCount() != -1) {
isResultSet = ps.getMoreResults();
}
- ResultSet rs = ps.getResultSet();
- return rs;
+ return ps.getResultSet();
}
public boolean supportsRowValueConstructorSyntax() {
@@ -328,4 +327,24 @@
public Boolean performTemporaryTableDDLInIsolation() {
return Boolean.FALSE;
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean areStringComparisonsCaseInsensitive() {
+ return true;
+ }
+
+ public boolean supportsLobValueChangePropogation() {
+ // note: at least my local MySQL 5.1 install shows this not working...
+ return false;
+ }
+
+ public boolean supportsSubqueryOnMutatingTable() {
+ return false;
+ }
}
\ No newline at end of file
Modified: trunk/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/Oracle9Dialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -282,8 +282,7 @@
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
ps.execute();
- ResultSet rs = (ResultSet) ps.getObject(1);
- return rs;
+ return ( ResultSet ) ps.getObject( 1 );
}
public boolean supportsUnionAll() {
@@ -326,4 +325,19 @@
public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
+
+ public boolean supportsRowValueConstructorSyntax() {
+ return true;
+ }
+
+ public boolean supportsRowValueConstructorSyntaxInInList() {
+ return true;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/PostgreSQLDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -293,7 +293,14 @@
}
};
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
public boolean supportsRowValueConstructorSyntax() {
return true;
}
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/SQLServerDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -2,22 +2,16 @@
package org.hibernate.dialect;
import java.sql.Types;
-import java.util.List;
-import java.util.ArrayList;
import org.hibernate.Hibernate;
import org.hibernate.LockMode;
-import org.hibernate.QueryException;
-import org.hibernate.engine.Mapping;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.type.Type;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
-import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
/**
- * A dialect for Microsoft SQL Server 2000
+ * A dialect for Microsoft SQL Server 2000 and 2005
+ *
* @author Gavin King
*/
public class SQLServerDialect extends SybaseDialect {
@@ -111,4 +105,26 @@
return "select current_timestamp";
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean areStringComparisonsCaseInsensitive() {
+ return true;
+ }
+
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
+ return false;
+ }
+
+ public boolean supportsCircularCascadeDeleteConstraints() {
+ // SQL Server (at least up through 2005) does not support defining
+ // cascade delete constraints which can circel back to the mutating
+ // table
+ return false;
+ }
+
+ public boolean supportsLobValueChangePropogation() {
+ // note: at least my local SQL Server 2005 Express shows this not working...
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/SybaseDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -144,17 +144,16 @@
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();
+ boolean isResultSet = ps.execute();
// This assumes you will want to ignore any update counts
- while (!isResultSet && ps.getUpdateCount() != -1) {
- isResultSet = ps.getMoreResults();
- }
- ResultSet rs = ps.getResultSet();
-// 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 rs;
+ 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() {
@@ -180,4 +179,11 @@
public boolean dropTemporaryTableAfterUse() {
return true; // sql-server, at least needed this dropped after use; strange!
}
+
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/src/org/hibernate/dialect/TimesTenDialect.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -148,17 +148,13 @@
return true;
}
- private static int getAfterSelectInsertPoint(String sql) {
- return 6; //sql.startsWith("select distinct") ? 15 : 6;
- }
-
public String getLimitString(String querySelect, int offset, int limit) {
if ( offset > 0 ) {
throw new UnsupportedOperationException( "TimesTen does not support offset" );
}
return new StringBuffer( querySelect.length()+8 )
.append(querySelect)
- .insert( getAfterSelectInsertPoint(querySelect), " first " + limit )
+ .insert( 6, " first " + limit )
.toString();
}
@@ -200,4 +196,10 @@
return new SelectLockingStrategy( lockable, lockMode );
}
}
+
+ // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public boolean supportsEmptyInList() {
+ return false;
+ }
}
Modified: trunk/Hibernate3/test/org/hibernate/test/TestCase.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/TestCase.java 2006-12-08 13:03:52 UTC (rev 10962)
+++ trunk/Hibernate3/test/org/hibernate/test/TestCase.java 2006-12-08 16:06:14 UTC (rev 10963)
@@ -20,17 +20,7 @@
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.dialect.Dialect;
-import org.hibernate.dialect.HSQLDialect;
-import org.hibernate.dialect.IngresDialect;
-import org.hibernate.dialect.MySQLDialect;
-import org.hibernate.dialect.Oracle9Dialect;
-import org.hibernate.dialect.PostgreSQLDialect;
-import org.hibernate.dialect.SQLServerDialect;
-import org.hibernate.dialect.SybaseDialect;
-import org.hibernate.dialect.TimesTenDialect;
import org.hibernate.dialect.DerbyDialect;
-import org.hibernate.dialect.Cache71Dialect;
-import org.hibernate.dialect.H2Dialect;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
@@ -482,24 +472,11 @@
* @return true if is allowed
*/
protected boolean dialectSupportsEmptyInList(String testDescription) {
- boolean canDoIt = dialectIsNot(
- new Class[] {
- Oracle9Dialect.class,
- MySQLDialect.class,
- DB2Dialect.class,
- HSQLDialect.class,
- SQLServerDialect.class,
- SybaseDialect.class,
- PostgreSQLDialect.class,
- TimesTenDialect.class,
- Cache71Dialect.class
- }
- );
-
- if ( !canDoIt ) {
- reportSkip( "Dialect does not support SQL: \'x in ()\'.", testDescription );
+ if ( ! getDialect().supportsEmptyInList() ) {
+ reportSkip( "Dialect does not support SQL empty in list : x in ()", testDescription );
+ return false;
}
- return canDoIt;
+ return true;
}
/**
@@ -508,34 +485,23 @@
* @return true if sensitive
*/
protected boolean dialectIsCaseSensitive(String testDescription) {
- // MySQL and SQLServer is case insensitive on strings (at least in default installation)
- boolean canDoIt = dialectIsNot(
- new Class[] { MySQLDialect.class, SQLServerDialect.class, Cache71Dialect.class }
- );
-
- if ( !canDoIt ) {
+ if ( getDialect().areStringComparisonsCaseInsensitive() ) {
reportSkip( "Dialect is case sensitive. ", testDescription );
+ return true;
}
- return canDoIt;
+ return false;
}
protected boolean supportsRowValueConstructorSyntaxInInList() {
- boolean supported = ! (getDialect() instanceof HSQLDialect ||
- getDialect() instanceof PostgreSQLDialect ||
- getDialect() instanceof MySQLDialect ||
- getDialect() instanceof DB2Dialect ||
- getDialect() instanceof SybaseDialect ||
- getDialect() instanceof Cache71Dialect
- );
-
- if ( !supported ) {
+ if ( ! getDialect().supportsRowValueConstructorSyntaxInInList() ) {
reportSkip( "Dialect does not support 'tuple' syntax as part of an IN value list", "query support" );
+ return false;
}
- return supported;
+ return true;
}
protected boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
- if ( getDialect() instanceof SQLServerDialect || getDialect() instanceof Cache71Dialect ) {
+ if ( ! getDialect().supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() ) {
reportSkip( "Driver does not support 'position query' methods on forward-only cursors", "query support" );
return false;
}
@@ -543,7 +509,7 @@
}
protected boolean supportsCircularCascadeDelete() {
- if ( getDialect() instanceof SQLServerDialect ) {
+ if ( ! getDialect().supportsCircularCascadeDeleteConstraints() ) {
reportSkip( "db/dialect does not support 'circular' cascade delete constraints", "cascade delete constraint support" );
return false;
}
@@ -551,12 +517,11 @@
}
protected boolean supportsSubselectOnLeftSideIn() {
- if (dialectIsNot( IngresDialect.class )) {
- return true;
- } else {
+ if ( ! getDialect().supportsSubselectAsInPredicateLHS() ) {
reportSkip( "Database does not support (<subselect>) in ( ... ) ", "query support" );
return false;
}
+ return true;
}
/**
@@ -572,9 +537,7 @@
* @return True if expected usage pattern is support; false otherwise.
*/
protected boolean supportsExpectedLobUsagePattern() {
- // note : For Derby, the insertions get truncated...
- Class[] exceptions = new Class[] { DerbyDialect.class };
- if ( dialectIsOneOf( exceptions ) ) {
+ if ( ! getDialect().supportsExpectedLobUsagePattern() ) {
reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
return false;
}
@@ -591,12 +554,7 @@
* database; false otherwise.
*/
protected boolean supportsLobValueChangePropogation() {
- // note: at least my local MySQL 5.1 install shows this not working...
- // note: at least my local SQL Server 2005 Express shows this not working...
- Class[] exceptions = new Class[] {
- HSQLDialect.class, H2Dialect.class, MySQLDialect.class, SQLServerDialect.class
- };
- if ( dialectIsOneOf( exceptions ) ) {
+ if ( ! getDialect().supportsLobValueChangePropogation() ) {
reportSkip( "database/driver does not support propogating LOB value change back to database", "LOB support" );
return false;
}
@@ -616,8 +574,7 @@
* @return True if unbounded materialization is supported; false otherwise.
*/
protected boolean supportsUnboundedLobLocatorMaterialization() {
- Class[] exceptions = new Class[] { }; // none known of...
- if ( dialectIsOneOf( exceptions ) ) {
+ if ( !getDialect().supportsUnboundedLobLocatorMaterialization() ) {
reportSkip( "database/driver does not support materializing a LOB locator outside the 'owning' transaction", "LOB support" );
return false;
}
@@ -625,19 +582,18 @@
}
protected boolean supportsSubqueryOnMutatingTable() {
- // I only know of MySQL having this limitation...
- return dialectIsNot( MySQLDialect.class );
+ if ( !getDialect().supportsSubqueryOnMutatingTable() ) {
+ reportSkip( "database/driver does not support referencing mutating table in subquery", "bulk DML support" );
+ return false;
+ }
+ return true;
}
- private boolean dialectIs(Class dialectClass) {
+ protected boolean dialectIs(Class dialectClass) {
return dialectClass.isInstance( getDialect() );
}
- private boolean dialectIsNot(Class dialectClass) {
- return ! dialectIs( dialectClass );
- }
-
- private boolean dialectIsOneOf(Class[] dialectClasses) {
+ protected boolean dialectIsOneOf(Class[] dialectClasses) {
for ( int i = 0; i < dialectClasses.length; i++ ) {
if ( dialectClasses[i].isInstance( getDialect() ) ) {
return true;
@@ -646,7 +602,11 @@
return false;
}
- private boolean dialectIsNot(Class[] dialectClasses) {
+ protected boolean dialectIsNot(Class dialectClass) {
+ return ! dialectIs( dialectClass );
+ }
+
+ protected boolean dialectIsNot(Class[] dialectClasses) {
return ! dialectIsOneOf( dialectClasses );
}
17 years, 4 months
Hibernate SVN: r10962 - trunk/Hibernate3/test/org/hibernate/test/hql
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-12-08 08:03:52 -0500 (Fri, 08 Dec 2006)
New Revision: 10962
Modified:
trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
Log:
fixed org.hibernate.test.hql.HQLTest#testExpressionWithParamInFunction failure on sql server
Modified: trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-12-08 13:03:23 UTC (rev 10961)
+++ trunk/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-12-08 13:03:52 UTC (rev 10962)
@@ -31,6 +31,7 @@
import org.hibernate.dialect.Oracle9Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.stat.QueryStatistics;
import org.hibernate.test.TestCase;
import org.hibernate.test.any.PropertyValue;
@@ -95,6 +96,9 @@
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
}
+ /**
+ * Copied from {@link HQLTest#testConcatenation}
+ */
public void testConcatenation() {
// simple syntax checking...
Session s = openSession();
@@ -104,6 +108,25 @@
s.close();
}
+ /**
+ * Copied from {@link HQLTest#testExpressionWithParamInFunction}
+ */
+ public void testExpressionWithParamInFunction() {
+ Session s = openSession();
+ s.beginTransaction();
+ s.createQuery( "from Animal a where abs(a.bodyWeight-:param) < 2.0" ).setLong( "param", 1 ).list();
+ s.createQuery( "from Animal a where abs(:param - a.bodyWeight) < 2.0" ).setLong( "param", 1 ).list();
+ s.createQuery( "from Animal where abs(:x - :y) < 2.0" ).setLong( "x", 1 ).setLong( "y", 1 ).list();
+ s.createQuery( "from Animal where lower(upper(:foo)) like 'f%'" ).setString( "foo", "foo" ).list();
+ s.createQuery( "from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0" ).setLong( "param", 1 ).list();
+ s.createQuery( "from Animal where lower(upper('foo') || upper(:bar)) like 'f%'" ).setString( "bar", "xyz" ).list();
+ if ( ! ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof MySQLDialect ) ) {
+ s.createQuery( "from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0" ).setLong( "param", 1 ).list();
+ }
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testCrazyIdFieldNames() {
MoreCrazyIdFieldNameStuffEntity top = new MoreCrazyIdFieldNameStuffEntity( "top" );
HeresAnotherCrazyIdFieldName next = new HeresAnotherCrazyIdFieldName( "next" );
Modified: trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java 2006-12-08 13:03:23 UTC (rev 10961)
+++ trunk/Hibernate3/test/org/hibernate/test/hql/HQLTest.java 2006-12-08 13:03:52 UTC (rev 10962)
@@ -198,10 +198,16 @@
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%'");
- assertTranslation("from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0");
- if ( getDialect() instanceof MySQLDialect ) return;
- assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'");
- if ( getDialect() instanceof PostgreSQLDialect ) return;
+ if ( ! ( getDialect() instanceof SybaseDialect ) ) {
+ // SybaseDialect maps the length function -> len; classic translator does not consider that *when nested*
+ 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 ) ) {
+ assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'");
+ }
+ if ( getDialect() instanceof PostgreSQLDialect ) {
+ return;
+ }
assertTranslation("from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0");
}
17 years, 4 months
Hibernate SVN: r10961 - branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-12-08 08:03:23 -0500 (Fri, 08 Dec 2006)
New Revision: 10961
Modified:
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
Log:
fixed org.hibernate.test.hql.HQLTest#testExpressionWithParamInFunction failure on sql server
Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-12-08 12:34:41 UTC (rev 10960)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java 2006-12-08 13:03:23 UTC (rev 10961)
@@ -32,6 +32,7 @@
import org.hibernate.dialect.Oracle9Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
+import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.stat.QueryStatistics;
import org.hibernate.test.TestCase;
import org.hibernate.test.any.PropertyValue;
@@ -96,6 +97,9 @@
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
}
+ /**
+ * Copied from {@link HQLTest#testConcatenation}
+ */
public void testConcatenation() {
// simple syntax checking...
Session s = openSession();
@@ -105,6 +109,25 @@
s.close();
}
+ /**
+ * Copied from {@link HQLTest#testExpressionWithParamInFunction}
+ */
+ public void testExpressionWithParamInFunction() {
+ Session s = openSession();
+ s.beginTransaction();
+ s.createQuery( "from Animal a where abs(a.bodyWeight-:param) < 2.0" ).setLong( "param", 1 ).list();
+ s.createQuery( "from Animal a where abs(:param - a.bodyWeight) < 2.0" ).setLong( "param", 1 ).list();
+ s.createQuery( "from Animal where abs(:x - :y) < 2.0" ).setLong( "x", 1 ).setLong( "y", 1 ).list();
+ s.createQuery( "from Animal where lower(upper(:foo)) like 'f%'" ).setString( "foo", "foo" ).list();
+ s.createQuery( "from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0" ).setLong( "param", 1 ).list();
+ s.createQuery( "from Animal where lower(upper('foo') || upper(:bar)) like 'f%'" ).setString( "bar", "xyz" ).list();
+ if ( ! ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof MySQLDialect ) ) {
+ s.createQuery( "from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0" ).setLong( "param", 1 ).list();
+ }
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testCrazyIdFieldNames() {
MoreCrazyIdFieldNameStuffEntity top = new MoreCrazyIdFieldNameStuffEntity( "top" );
HeresAnotherCrazyIdFieldName next = new HeresAnotherCrazyIdFieldName( "next" );
Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java 2006-12-08 12:34:41 UTC (rev 10960)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/hql/HQLTest.java 2006-12-08 13:03:23 UTC (rev 10961)
@@ -198,10 +198,16 @@
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%'");
- assertTranslation("from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0");
- if ( getDialect() instanceof MySQLDialect ) return;
- assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'");
- if ( getDialect() instanceof PostgreSQLDialect ) return;
+ if ( ! ( getDialect() instanceof SybaseDialect ) ) {
+ // SybaseDialect maps the length function -> len; classic translator does not consider that *when nested*
+ 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 ) ) {
+ assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'");
+ }
+ if ( getDialect() instanceof PostgreSQLDialect ) {
+ return;
+ }
assertTranslation("from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0");
}
17 years, 4 months