Hibernate SVN: r20277 - in core/trunk/documentation/quickstart: src/main/docbook/en-US and 30 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-27 17:44:03 -0400 (Fri, 27 Aug 2010)
New Revision: 20277
Added:
core/trunk/documentation/quickstart/tutorials/
core/trunk/documentation/quickstart/tutorials/annotations/
core/trunk/documentation/quickstart/tutorials/annotations/pom.xml
core/trunk/documentation/quickstart/tutorials/annotations/src/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java
core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java
core/trunk/documentation/quickstart/tutorials/annotations/src/test/resources/
core/trunk/documentation/quickstart/tutorials/annotations/src/test/resources/hibernate.cfg.xml
core/trunk/documentation/quickstart/tutorials/basic/
core/trunk/documentation/quickstart/tutorials/basic/pom.xml
core/trunk/documentation/quickstart/tutorials/basic/src/
core/trunk/documentation/quickstart/tutorials/basic/src/test/
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java
core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java
core/trunk/documentation/quickstart/tutorials/basic/src/test/resources/
core/trunk/documentation/quickstart/tutorials/basic/src/test/resources/hibernate.cfg.xml
core/trunk/documentation/quickstart/tutorials/entitymanager/
core/trunk/documentation/quickstart/tutorials/entitymanager/pom.xml
core/trunk/documentation/quickstart/tutorials/entitymanager/src/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/resources/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/resources/META-INF/
core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml
core/trunk/documentation/quickstart/tutorials/pom.xml
Modified:
core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
Log:
HHH-5441 - Create "Getting Started Guide" - separate tutorial project for bundling
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml 2010-08-27 11:10:51 UTC (rev 20276)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -8,9 +8,29 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Book_Info.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/preface.xml" />
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/community.xml" />
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/obtaining.xml" />
+ <part label="I">
+ <title>Basic Information</title>
+ <partintro>
+ <para>
+ The sections in Part I present basic information you will
+ likely need to get started utilizing Hibernate
+ </para>
+ </partintro>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/community.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/obtaining.xml" />
+ </part>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_native.xml" />
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_annotations.xml" />
+ <part label="II">
+ <title>Tutorials</title>
+ <partintro>
+ <para>
+ The sections in Part II dive into illustrative examples of using Hibernate in various
+ ways. The referenced projects and code are available for download at
+ <ulink url="http://sourceforge.net/projects/hibernate/files/hibernate/&version;"/>
+ </para>
+ </partintro>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_native.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_annotations.xml" />
+ </part>
+
</book>
\ No newline at end of file
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml 2010-08-27 11:10:51 UTC (rev 20276)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -4,123 +4,85 @@
<chapter id="hibernate-gsg-tutorial-annotations">
<title>Tutorial Using Native Hibernate APIs and Annotation Mappings</title>
- <procedure>
- <title>Steps</title>
+ <para>
+ This tutorial is located within the download bundle under <filename>basic</filename> and illustrates
+ <itemizedlist>
+ <listitem>
+ <para>
+ using annotations to provide mapping information
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ using the <phrase>native</phrase> Hibernate APIs
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
- <step id="hibernate-gsg-tutorial-annotations-pom">
- <title>Create the Maven POM file</title>
- <para>
- Create a file named <filename>pom.xml</filename> in the root of your project directory, containing
- the text in <xref linkend="hibernate-gsg-tutorial-annotations-pom-ex1"/>.
- </para>
- <example id="hibernate-gsg-tutorial-annotations-pom-ex1">
- <title><filename>pom.xml</filename></title>
- <programlisting role="XML"><xi:include href="extras/examples/annotations/pom.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
- </step>
+ <section id="hibernate-gsg-tutorial-annotations-config">
+ <title>The Hibernate configuration file</title>
- <step id="hibernate-gsg-tutorial-native-entity">
- <title>Create the annotated entity Java class</title>
+ <para>
+ The contents are exactly the same as in <xref linkend="hibernate-gsg-tutorial-basic-config"/>.
+ The single difference is the <literal>mapping</literal> element at the very end naming the
+ annotated entity class using the <literal>class</literal> attribute.
+ </para>
+ </section>
- <para>
- Create a file named <filename>src/main/java/org/hibernate/tutorial/annotations/Event.java</filename>,
- containing the text in <xref linkend="hibernate-gsg-tutorial-annotations-entity-ex1"/>.
- </para>
+ <section id="hibernate-gsg-tutorial-basic-entity">
+ <title>The annotated entity Java class</title>
+ <para>
+ The entity class in this tutorial is <classname>org.hibernate.tutorial.annotations.Event</classname>
+ <itemizedlist>
+ <title>Notes About the Entity</title>
+ <listitem>
+ <para>
+ The entity class is still using JavaBean conventions. In fact the class itself is exactly
+ the same as we saw in <xref linkend="hibernate-gsg-tutorial-basic-entity"/>, the only
+ difference being the use of annotations to provide the metadata instead of a separate
+ <filename>hbm.xml</filename> file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <interfacename>@javax.persistence.Entity</interfacename> annotation is used to mark a
+ class as an entity. It's function is essentially the same as the <literal>class</literal>
+ mapping element discussed in <xref linkend="hibernate-gsg-tutorial-basic-mapping"/>.
+ Additionally the <interfacename>@javax.persistence.Table</interfacename> annotation is
+ used to explicitly specify the table name (the default table name would have been
+ <database class="table">EVENT</database>).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <interfacename>@javax.persistence.Id</interfacename> marks the property defining the
+ entity's identifier. <interfacename>@javax.persistence.GeneratedValue</interfacename> and
+ <interfacename>@org.hibernate.annotations.GenericGenerator</interfacename> work in tandem
+ to indicate that Hibernate should use Hibernate's <literal>increment</literal> generation
+ strategy for this entity's identifier values.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Just as discussed in <xref linkend="hibernate-gsg-tutorial-basic-mapping"/>, the
+ <literal>date</literal> property needs special handling to account for its special naming
+ and its SQL type.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </section>
- <example id="hibernate-gsg-tutorial-annotations-entity-ex1">
- <title><filename>Entity.java</filename></title>
- <programlisting role="JAVA"><xi:include href="extras/examples/annotations/org/hibernate/tutorial/annotations/Event.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
- <para>
- <itemizedlist>
- <title>Notes About the Entity</title>
- <listitem>
- <para>
- The entity class is still using JavaBean conventions. In fact the class itself is exactly
- the same as we saw in <xref linkend="hibernate-gsg-tutorial-native-entity-ex1"/>, the only
- difference being the use of annotations to provide the metadata instead of a separate
- <filename>hbm.xml</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- The <interfacename>@javax.persistence.Entity</interfacename> annotation is used to mark a
- class as an entity. It's function is essentially the same as the <literal>class</literal>
- mapping element we see in <xref linkend="hibernate-gsg-tutorial-native-hbm-xml-ex1"/>.
- Additionally the <interfacename>@javax.persistence.Table</interfacename> annotation is
- used to explicitly specify the table name (the default table name would have been
- <database class="table">EVENT</database>).
- </para>
- </listitem>
- <listitem>
- <para>
- <interfacename>@javax.persistence.Id</interfacename> marks the property defining the
- entity's identifier.
- </para>
- </listitem>
- <!-- todo : example of defining the generator -->
- <listitem>
- <para>
- Just as in <xref linkend="hibernate-gsg-tutorial-native-hbm-xml-ex1"/>, the
- <literal>date</literal> property needs special handling to account for its special naming
- and its SQL type.
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </step>
+ <section id="hibernate-gsg-tutorial-annotations-test">
+ <title>Example code</title>
+ <para>
+ <classname>org.hibernate.tutorial.annotations.AnnotationsIllustrationTest</classname> is essentially the
+ same as <classname>org.hibernate.tutorial.hbm.NativeApiIllustrationTest</classname> discussed in
+ <xref linkend="hibernate-gsg-tutorial-basic-test"/>.
+ </para>
+ </section>
- <step id="hibernate-gsg-tutorial-annotations-config">
- <title>Create the Hibernate configuration file</title>
-
- <para>
- Create a file named <filename>src/main/resources/hibernate.cfg.xml</filename> with the following contents:
- </para>
-
- <example id="hibernate-gsg-tutorial-annotations-config-ex1">
- <title><filename>hibernate.cfg.xml</filename></title>
- <programlisting role="XML"><xi:include href="extras/examples/annotations/hibernate.cfg.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
-
- <para>
- Most of the contents are exactly the same as in <xref linkend="hibernate-gsg-tutorial-native-config-ex1"/>.
- The single difference is the <literal>mapping</literal> element at the very end naming the
- annotated entity class using the <literal>class</literal> attribute.
- </para>
- </step>
-
- <step id="hibernate-gsg-tutorial-annotations-working">
- <title>Do stuff</title>
- <para>
- Create a file named <filename>src/main/java/org/hibernate/tutorial/annotations/EventManager.java</filename>
- containing the text in <xref linkend="hibernate-gsg-tutorial-native-working-ex1"/>.
- </para>
-
- <example id="hibernate-gsg-tutorial-native-working-ex1">
- <title>
- <filename>EventManager.java</filename>
- </title>
- <programlisting role="JAVA"><xi:include href="extras/examples/annotations/org/hibernate/tutorial/annotations/EventManager.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
-
- <para>
- Refer back to <xref linkend="hibernate-gsg-tutorial-native-working"/> for a discussion
- </para>
- </step>
-
- <step id="hibernate-gsg-tutorial-annotations-compileAndRun">
- <title>Compile and run the code</title>
-
- <para>
- Follow the directions at <xref linkend="hibernate-gsg-tutorial-native-compile"/> and
- <xref linkend="hibernate-gsg-tutorial-native-running"/> to compile and then run the code. Be sure
- to reference the <classname>org.hibernate.tutorial.annotations.EventManager</classname> class
- instead of the <classname>org.hibernate.tutorial.hbm.EventManager</classname> class.
- </para>
- </step>
-
- </procedure>
-
<section id="hibernate-gsg-tutorial-annotations-further">
<title>Take it further!</title>
<para>
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-27 11:10:51 UTC (rev 20276)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -1,312 +1,252 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="hibernate-gsg-tutorial-native">
- <title>Tutorial Using Native Hibernate APIs and <filename>hbm.xml</filename> Mappings</title>
+<chapter id="hibernate-gsg-tutorial-basic">
+ <title>Tutorial Using Native Hibernate APIs and <phrase>hbm.xml</phrase> Mappings</title>
- <note>
+ <para>
+ This tutorial is located within the download bundle under <filename>basic</filename> and illustrates
+ <itemizedlist>
+ <listitem>
+ <para>
+ using Hibernate mapping files (<phrase>hbm.xml</phrase>) to provide mapping information
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ using the <phrase>native</phrase> Hibernate APIs
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ <section id="hibernate-gsg-tutorial-basic-config">
+ <title>The Hibernate configuration file</title>
+
<para>
- This tutorial uses the <phrase>standard layout</phrase> described in
- <ulink url="http://maven.apache.org/guides/introduction/introduction-to-the-standard-..."/>.
+ The resource file <filename>hibernate.cfg.xml</filename> defines Hibernate configuration
+ information.
</para>
- </note>
- <tip>
<para>
- The tutorials in this guide use Maven, in order to leverage its transitive dependency management
- capabilities and its integration with many development environments (IDEs). You can use another build
- tool, adapting the examples to fit your needs.
+ The first few <literal>property</literal> elements define JDBC connection information. These tutorials
+ utilize the H2 in-memory database. So these are all specific to running H2 in its in-memory mode.
+ The 'connection.pool_size' is used to configure Hibernate's built-in connection pool how many
+ connections
+ to pool.
</para>
- </tip>
- <procedure>
- <title>Steps</title>
-
- <step id="hibernate-gsg-tutorial-native-pom">
- <title>Create the Maven POM file</title>
+ <important>
<para>
- Create a file named <filename>pom.xml</filename> in the root of your project directory, containing
- the text in<xref linkend="hibernate-gsg-tutorial-native-pom-ex1"/>.
+ The built-in Hibernate connection pool is in no way intended for production use. It
+ lacks several features found on any decent connection pool. See the section
+ <citetitle pubwork="section">JDBC Connections</citetitle> in the
+ <citetitle pubwork="chapter">Database Access</citetitle> chapter of the
+ <citetitle pubwork="book">Hibernate Developer Guide</citetitle> for further information.
</para>
- <example id="hibernate-gsg-tutorial-native-pom-ex1">
- <title>
- <filename>pom.xml</filename>
- </title>
- <programlisting role="XML"><xi:include href="extras/examples/hbm/pom.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
- </step>
+ </important>
- <step id="hibernate-gsg-tutorial-native-entity">
- <title>Create the entity Java class</title>
+ <para>
+ The <literal>dialect</literal> option specifies the particular SQL variant Hibernate should generate.
+ </para>
+ <tip>
<para>
- Create a file named <filename>src/main/java/org/hibernate/tutorial/hbm/Event.java</filename>,
- containing the text in <xref linkend="hibernate-gsg-tutorial-native-entity-ex1"/>.
+ In most cases, Hibernate is able to properly determine which dialect to use which is invaluable if
+ your application targets multiple databases. See the section
+ <citetitle pubwork="section">Database Dialects</citetitle> in the
+ <citetitle pubwork="chapter">Database Access</citetitle> chapter of the
+ <citetitle pubwork="book">Hibernate Developer Guide</citetitle> for further information.
</para>
+ </tip>
- <example id="hibernate-gsg-tutorial-native-entity-ex1">
- <title>
- <filename>Entity.java</filename>
- </title>
- <programlisting role="JAVA"><xi:include href="extras/examples/hbm/org/hibernate/tutorial/hbm/Event.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
- <para>
- <!-- todo : what's the best way to refer to content in other books? -->
- <!-- like here it would be nice to say something like: -->
- <!-- "Entity class requirements are covered in detail in <x.y.z Some Developer Guide Chapter/Section>" -->
- <itemizedlist>
- <title>Notes About the Entity</title>
- <listitem>
- <para>
- This class uses standard JavaBean naming conventions
- for property getter and setter methods, as well as
- private visibility for the fields. Although this is
- the recommended design, it is not required.
- </para>
- </listitem>
- <listitem>
- <para>
- The no-argument constructor, which is also a JavaBean
- convention, is a requirement for all persistent
- classes. Hibernate needs to create objects for you,
- using Java Reflection. The constructor can be
- private. However, package or public visibility is
- required for runtime proxy generation and efficient
- data retrieval without bytecode instrumentation.
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </step>
+ <para>
+ The <literal>hbm2ddl.auto</literal> option turns on automatic generation of database schemas directly
+ into the database.
+ </para>
- <step id="hibernate-gsg-tutorial-native-mapping">
- <title>Create the entity mapping file</title>
+ <para>
+ Finally, add the mapping file(s) for persistent classes to the configuration. The <literal>resource</literal>
+ attribute of the <literal>mapping</literal> element says to attempt to locate that mapping as a
+ classpath resource (via a <classname>java.lang.ClassLoader</classname> lookup).
+ </para>
- <para>
- Create a file named <filename>src/main/resources/org/hibernate/tutorial/native/Event.hbm.xml</filename>,
- containing the text in <xref linkend="hibernate-gsg-tutorial-native-hbm-xml-ex1"/>.
- </para>
+ </section>
- <example id="hibernate-gsg-tutorial-native-hbm-xml-ex1">
- <title>
- <filename>Event.hbm.xml</filename>
- </title>
- <programlisting role="XML"><xi:include href="extras/examples/hbm/org/hibernate/tutorial/hbm/Event.hbm.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
- <para>
- Hibernate uses the mapping metadata to find out how to load and
- store objects of the persistent class. The Hibernate mapping
- file is one choice for providing Hibernate with this metadata.
- </para>
-
- <orderedlist>
- <title>Functions of the <literal>class</literal> element</title>
+ <section id="hibernate-gsg-tutorial-basic-entity">
+ <title>The entity Java class</title>
+ <para>
+ The entity class for this tutorial is <classname>org.hibernate.tutorial.hbm.Event</classname>.
+ <itemizedlist>
+ <title>Notes About the Entity</title>
<listitem>
<para>
- The <literal>name</literal> attribute (combined here with the <literal>package</literal>
- attribute from the containing <literal>hibernate-mapping</literal> element) names the FQN of
- the class you want to define as an entity.
+ This class uses standard JavaBean naming conventions
+ for property getter and setter methods, as well as
+ private visibility for the fields. Although this is
+ the recommended design, it is not required.
</para>
</listitem>
<listitem>
<para>
- The <literal>table</literal> attribute names the database table which contains the data for
- this entity.
+ The no-argument constructor, which is also a JavaBean
+ convention, is a requirement for all persistent
+ classes. Hibernate needs to create objects for you,
+ using Java Reflection. The constructor can be
+ private. However, package or public visibility is
+ required for runtime proxy generation and efficient
+ data retrieval without bytecode instrumentation.
</para>
</listitem>
- </orderedlist>
+ </itemizedlist>
+ </para>
+ </section>
- <para>
- Instances of the <classname>Event</classname> class are now mapped to rows in the
- <database class="table">EVENTS</database> table. Hibernate uses the <literal>id</literal> element to
- uniquely identify rows in the table.
- </para>
- <important>
- <para>
- It is not strictly necessary for the <literal>id</literal> element to map to the table's actual
- primary key column(s), but it is the normal convention. Tables mapped in Hibernate do not even
- need to define primary keys. However, the Hibernate team <emphasis>strongly</emphasis>
- recommends that all schemas define proper referential integrity. Therefore <literal>id</literal>
- and <phrase>primary key</phrase> are used interchangeably throughout Hibernate documentation.
- </para>
- </important>
- <para>
- The <literal>id</literal> element here identifies the <database class="field">EVENT_ID</database>
- column as the primary key of the <database class="table">EVENTS</database> table. It also identifies
- the <literal>id</literal> property of the <classname>Event</classname> class as the property
- containing the identifier value.
- </para>
- <para>
- The <literal>generator</literal> element nested inside the <literal>id</literal> element informs
- Hibernate about which strategy is used to generated primary key values for this entity. In this
- example, a sequence-like value generation is used.
- </para>
- <para>
- The two <literal>property</literal> elements declare the remaining two properties of the
- <classname>Event</classname> class: <literal>date</literal> and<literal>title</literal>. The
- <literal>date</literal> property mapping includes the <literal>column</literal> attribute, but the
- <literal>title</literal> does not. In the absence of a <literal>column</literal> attribute, Hibernate
- uses the property name as the column name. This is appropriate for <literal>title</literal>, but since
- <literal>date</literal> is a reserved keyword in most databases, you need to specify a non-reserved
- word for the column name.
- </para>
- <para>
- The <literal>title</literal> mapping also lacks a <literal>type</literal> attribute. The types
- declared and used in the mapping files are neither Java data types nor SQL database types. Instead,
- they are <firstterm><phrase>Hibernate mapping types</phrase></firstterm>. Hibernate mapping types are
- converters which translate between Java and SQL data types. Hibernate attempts to determine the correct
- conversion and mapping type autonomously if the <literal>type</literal> attribute is not present in the
- mapping, by using Java reflection to determine the Java type of the declared property and using a
- default mapping type for that Java type.
- </para>
- <para>
- In some cases this automatic detection might not chose the default you expect or need, as seen with the
- <literal>date</literal> property. Hibernate cannot know if the property, which is of type
- <classname>java.util.Date</classname>, should map to a SQL <database class="datatype">DATE</database>,
- <database class="datatype">TIME</database>, or <database class="datatype">TIMESTAMP</database> datatype.
- Full date and time information is preserved by mapping the property to a <literal>timestamp</literal>
- converter (which identifies an instance of the class
- <classname>org.hibernate.type.TimestampType</classname>).
- </para>
- <tip>
- <para>
- Hibernate makes this mapping type determination using reflection when the mapping files are
- processed. This process can take time and resources. If startup performance is important, consider
- explicitly defining the type to use.
- </para>
- </tip>
- </step>
+ <section id="hibernate-gsg-tutorial-basic-mapping">
+ <title>The mapping file</title>
+ <para>
+ The <phrase>hbm.xml</phrase> mapping file for this tutorial is the classpath resource
+ <filename>org/hibernate/tutorial/hbm/Event.hbm.xml</filename> as we saw in
+ <xref linkend="hibernate-gsg-tutorial-basic-config"/>
+ </para>
- <step id="hibernate-gsg-tutorial-native-config">
- <title>Create the Hibernate configuration file</title>
+ <para>
+ Hibernate uses the mapping metadata to find out how to load and
+ store objects of the persistent class. The Hibernate mapping
+ file is one choice for providing Hibernate with this metadata.
+ </para>
- <para>
- Create a file named <filename>src/main/resources/hibernate.cfg.xml</filename> containing the text in
- <xref linkend="hibernate-gsg-tutorial-native-config-ex1"/>.
- </para>
-
- <example id="hibernate-gsg-tutorial-native-config-ex1">
- <title><filename>hibernate.cfg.xml</filename></title>
- <programlisting role="XML"><xi:include href="extras/examples/hbm/hibernate.cfg.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
-
- <para>
- The first few <literal>property</literal> elements define JDBC connection information. These tutorials
- utilize the H2 in-memory database. So these are all specific to running H2 in its in-memory mode.
- The 'connection.pool_size' is used to configure Hibernate's built-in connection pool how many
- connections
- to pool.
- </para>
-
- <warning>
+ <orderedlist>
+ <title>Functions of the <literal>class</literal> element</title>
+ <listitem>
<para>
- The built-in Hibernate connection pool is in no way intended for production use. It
- lacks several features found on any decent connection pool. See the section "JDBC Connections" in
- the "Database Access" chapter of the "Hibernate Developer Guide" for further information.
+ The <literal>name</literal> attribute (combined here with the <literal>package</literal>
+ attribute from the containing <literal>hibernate-mapping</literal> element) names the FQN of
+ the class you want to define as an entity.
</para>
- </warning>
-
- <para>
- The <literal>dialect</literal> option specifies the particular SQL variant Hibernate should generate.
- </para>
-
- <tip>
+ </listitem>
+ <listitem>
<para>
- In most cases, Hibernate is able to properly determine which dialect to use which is invaluable if
- your application targets multiple databases. See the section "Database Dialects" in the
- "Database Access" chapter of the "Hibernate Developer Guide" for further information.
+ The <literal>table</literal> attribute names the database table which contains the data for
+ this entity.
</para>
- </tip>
+ </listitem>
+ </orderedlist>
+ <para>
+ Instances of the <classname>Event</classname> class are now mapped to rows in the
+ <database class="table">EVENTS</database> table. Hibernate uses the <literal>id</literal> element to
+ uniquely identify rows in the table.
+ </para>
+ <important>
<para>
- The <literal>hbm2ddl.auto</literal> option turns on automatic generation of database schemas directly
- into the database.
+ It is not strictly necessary for the <literal>id</literal> element to map to the table's actual
+ primary key column(s), but it is the normal convention. Tables mapped in Hibernate do not even
+ need to define primary keys. However, the Hibernate team <emphasis>strongly</emphasis>
+ recommends that all schemas define proper referential integrity. Therefore <literal>id</literal>
+ and <phrase>primary key</phrase> are used interchangeably throughout Hibernate documentation.
</para>
- <para>
- Finally, add the mapping file(s) for persistent classes to the configuration.
- </para>
- </step>
+ </important>
+ <para>
+ The <literal>id</literal> element here identifies the <database class="field">EVENT_ID</database>
+ column as the primary key of the <database class="table">EVENTS</database> table. It also identifies
+ the <literal>id</literal> property of the <classname>Event</classname> class as the property
+ containing the identifier value.
+ </para>
+ <para>
+ The <literal>generator</literal> element nested inside the <literal>id</literal> element informs
+ Hibernate about which strategy is used to generated primary key values for this entity. In this
+ example, a simple incrementing count is used.
+ </para>
+ <para>
+ The two <literal>property</literal> elements declare the remaining two properties of the
+ <classname>Event</classname> class: <literal>date</literal> and<literal>title</literal>. The
+ <literal>date</literal> property mapping includes the <literal>column</literal> attribute, but the
+ <literal>title</literal> does not. In the absence of a <literal>column</literal> attribute, Hibernate
+ uses the property name as the column name. This is appropriate for <literal>title</literal>, but since
+ <literal>date</literal> is a reserved keyword in most databases, you need to specify a non-reserved
+ word for the column name.
+ </para>
+ <para>
+ The <literal>title</literal> mapping also lacks a <literal>type</literal> attribute. The types
+ declared and used in the mapping files are neither Java data types nor SQL database types. Instead,
+ they are <firstterm><phrase>Hibernate mapping types</phrase></firstterm>. Hibernate mapping types are
+ converters which translate between Java and SQL data types. Hibernate attempts to determine the correct
+ conversion and mapping type autonomously if the <literal>type</literal> attribute is not present in the
+ mapping, by using Java reflection to determine the Java type of the declared property and using a
+ default mapping type for that Java type.
+ </para>
+ <para>
+ In some cases this automatic detection might not chose the default you expect or need, as seen with the
+ <literal>date</literal> property. Hibernate cannot know if the property, which is of type
+ <classname>java.util.Date</classname>, should map to a SQL <database class="datatype">DATE</database>,
+ <database class="datatype">TIME</database>, or <database class="datatype">TIMESTAMP</database> datatype.
+ Full date and time information is preserved by mapping the property to a <literal>timestamp</literal>
+ converter (which identifies an instance of the class
+ <classname>org.hibernate.type.TimestampType</classname>).
+ </para>
- <step id="hibernate-gsg-tutorial-native-working">
- <title>Do stuff</title>
+ <tip>
<para>
- Create a file named <filename>src/main/java/org/hibernate/tutorial/hbm/EventManager.java</filename>
- containing the text in <xref linkend="hibernate-gsg-tutorial-native-working-ex1"/>.
+ Hibernate makes this mapping type determination using reflection when the mapping files are
+ processed. This process can take time and resources. If startup performance is important, consider
+ explicitly defining the type to use.
</para>
+ </tip>
- <example id="hibernate-gsg-tutorial-native-working-ex1">
- <title>
- <filename>EventManager.java</filename>
- </title>
- <programlisting role="JAVA"><xi:include href="extras/examples/hbm/org/hibernate/tutorial/hbm/EventManager.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
- </example>
+ </section>
+ <section id="hibernate-gsg-tutorial-basic-test">
+ <title>Example code</title>
+ <para>
+ The <classname>org.hibernate.tutorial.hbm.NativeApiIllustrationTest</classname> class illustrates using
+ the Hibernate <phrase>native API</phrase>.
+ </para>
+ <note>
<para>
- The <classname>org.hibernate.cfg.Configuration</classname> class is the first thing to notice. In this
- tutorial we simply configure everything via the <filename>hibernate.cfg.xml</filename> file
- discussed in<xref linkend="hibernate-gsg-tutorial-native-config"/>.
+ The example code in these tutorials is done as JUnit tests mainly for ease of use. However it is
+ nice in that <methodname>setUp</methodname> and <methodname>tearDown</methodname> roughly illustrate
+ how a <interfacename>org.hibernate.SessionFactory</interfacename> would be created at the start up
+ of an application and closed at the end of the application lifecycle.
</para>
+ </note>
- <para>
- The <classname>org.hibernate.cfg.Configuration</classname> is then used to create the
- <interfacename>org.hibernate.SessionFactory</interfacename> which is a thread-safe object that is
- instantiated once to serve the entire application.
- </para>
+ <para>
+ The <classname>org.hibernate.cfg.Configuration</classname> class is the first thing to notice. In this
+ tutorial everything is simply configured via the <filename>hibernate.cfg.xml</filename> file
+ discussed in<xref linkend="hibernate-gsg-tutorial-basic-config"/>.
+ </para>
- <para>
- The <interfacename>org.hibernate.SessionFactory</interfacename> acts as a factory for
- <interfacename>org.hibernate.Session</interfacename> instances as can be seen in the
- <methodname>createAndStoreEvent</methodname> and <methodname>listEvents</methodname> methods of the
- <classname>EventManager</classname> class. A <interfacename>org.hibernate.Session</interfacename>
- should be thought of as a corollary to a "unit of work". <!-- todo : reference to a discussion in dev guide -->
- </para>
+ <para>
+ The <classname>org.hibernate.cfg.Configuration</classname> is then used to create the
+ <interfacename>org.hibernate.SessionFactory</interfacename> which is a thread-safe object that is
+ instantiated once to serve the entire application.
+ </para>
- <para>
- <methodname>createAndStoreEvent</methodname> creates a new <classname>Event</classname> object
- and hands it over to Hibernate for "management". At that point, Hibernate takes responsibility to
- perform an <literal>INSERT</literal> on the database.
- </para>
+ <para>
+ The <interfacename>org.hibernate.SessionFactory</interfacename> acts as a factory for
+ <interfacename>org.hibernate.Session</interfacename> instances as can be seen in the
+ <methodname>testBasicUsage</methodname> method. A <interfacename>org.hibernate.Session</interfacename>
+ should be thought of as a corollary to a "unit of work".
+ <!-- todo : reference to a discussion in dev guide -->
+ </para>
- <para>
- <methodname>listEvents</methodname> illustrates use of the Hibernate Query Language (HQL) to load all
- existing <classname>Event</classname> objects from the database. Hibernate will generate the
- appropriate <literal>SELECT</literal> SQL, send it to the database and populate
- <classname>Event</classname> objects with the result set data.
- </para>
- </step>
+ <para>
+ <methodname>testBasicUsage</methodname> first creates some new <classname>Event</classname> objects
+ and hands them over to Hibernate for "management" via the <methodname>save</methodname> method. At that
+ point, Hibernate takes responsibility to perform an <literal>INSERT</literal> on the database.
+ </para>
- <step id="hibernate-gsg-tutorial-native-compile">
- <title>Compile the source</title>
- <screen><xi:include href="extras/examples/hbm/compile-output.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></screen>
- </step>
+ <para>
+ <methodname>testBasicUsage</methodname> then illustrates use of the Hibernate Query Language (HQL) to
+ load all existing <classname>Event</classname> objects from the database. Hibernate will generate the
+ appropriate <literal>SELECT</literal> SQL, send it to the database and populate
+ <classname>Event</classname> objects with the result set data.
+ </para>
+ </section>
- <step id="hibernate-gsg-tutorial-native-running">
- <title>Run the code</title>
- <para>
- To perform a store (leveraging the maven exec plugin):
- <command>mvn exec:java -Dexec.mainClass="org.hibernate.tutorial.hbm.EventManager" -Dexec.args="store"</command>
- You should see Hibernate starting up and, depending on your configuration, lots of log output. Towards
- the end, the following line will be displayed:
- <screen>[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (?, ?, ?)</screen>
- This is the <literal>INSERT</literal>executed by Hibernate.
- </para>
-
- <para>
- To perform a list:
- <command>mvn exec:java -Dexec.mainClass="org.hibernate.tutorial.hbm.EventManager"-Dexec.args="list"</command>
- </para>
-
- <note>
- <para>
- Currently nothing will ever be output when performing the list because the database is recreated
- every time the <interfacename>org.hibernate.SessionFactory</interfacename> is created.
- </para>
- </note>
- </step>
- </procedure>
-
<section id="hibernate-gsg-tutorial-annotations-further">
<title>Take it further!</title>
<para>
Property changes on: core/trunk/documentation/quickstart/tutorials
___________________________________________________________________
Name: svn:ignore
+ target
local
*.ipr
*.iws
*.iml
.classpath
.project
.settings
.nbattrs
*.log
*.properties
.clover
Property changes on: core/trunk/documentation/quickstart/tutorials/annotations
___________________________________________________________________
Name: svn:ignore
+ target
local
*.ipr
*.iws
*.iml
.classpath
.project
.settings
.nbattrs
*.log
*.properties
.clover
Added: core/trunk/documentation/quickstart/tutorials/annotations/pom.xml
===================================================================
--- core/trunk/documentation/quickstart/tutorials/annotations/pom.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/annotations/pom.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.hibernate.tutorials</groupId>
+ <artifactId>hibernate-tutorials</artifactId>
+ <version>3.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hibernate-tutorial-annotations</artifactId>
+ <name>Hibernate Annotations Tutorial</name>
+ <description>Hibernate tutorial illustrating the use of native APIs and annotations for mapping metadata</description>
+
+ <properties>
+ <!-- Skip artifact deployment -->
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+</project>
Added: core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java
===================================================================
--- core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/AnnotationsIllustrationTest.java 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,77 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.tutorial.annotations;
+
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class AnnotationsIllustrationTest extends TestCase {
+ private SessionFactory sessionFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ // A SessionFactory is set up once for an application
+ sessionFactory = new Configuration()
+ .configure() // configures settings from hibernate.cfg.xml
+ .buildSessionFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if ( sessionFactory != null ) {
+ sessionFactory.close();
+ }
+ }
+
+ public void testBasicUsage() {
+ // create a couple of events...
+ Session session = sessionFactory.openSession();
+ session.beginTransaction();
+ session.save( new Event( "Our very first event!", new Date() ) );
+ session.save( new Event( "A follow up event", new Date() ) );
+ session.getTransaction().commit();
+ session.close();
+
+ // now lets pull events from the database and list them
+ session = sessionFactory.openSession();
+ session.beginTransaction();
+ List result = session.createQuery( "from Event" ).list();
+ for ( Event event : (List<Event>) result ) {
+ System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+ }
+ session.getTransaction().commit();
+ session.close();
+ }
+}
Added: core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java
===================================================================
--- core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/annotations/src/test/java/org/hibernate/tutorial/annotations/Event.java 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.tutorial.annotations;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+
+@Entity
+@Table( name = "EVENTS" )
+public class Event {
+ private Long id;
+
+ private String title;
+ private Date date;
+
+ public Event() {
+ // this form used by Hibernate
+ }
+
+ public Event(String title, Date date) {
+ // for application use, to create new events
+ this.title = title;
+ this.date = date;
+ }
+
+ @Id
+ @GeneratedValue(generator="increment")
+ @GenericGenerator(name="increment", strategy = "increment")
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "EVENT_DATE")
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
\ No newline at end of file
Copied: core/trunk/documentation/quickstart/tutorials/annotations/src/test/resources/hibernate.cfg.xml (from rev 20248, core/trunk/documentation/quickstart/src/main/docbook/en-US/content/extras/examples/annotations/hibernate.cfg.xml)
===================================================================
--- core/trunk/documentation/quickstart/tutorials/annotations/src/test/resources/hibernate.cfg.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/annotations/src/test/resources/hibernate.cfg.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,59 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+ <session-factory>
+
+ <!-- Database connection settings -->
+ <property name="connection.driver_class">org.h2.Driver</property>
+ <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+ <property name="connection.username">sa</property>
+ <property name="connection.password"></property>
+
+ <!-- JDBC connection pool (use the built-in) -->
+ <property name="connection.pool_size">1</property>
+
+ <!-- SQL dialect -->
+ <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+ <!-- Disable the second-level cache -->
+ <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+ <!-- Echo all executed SQL to stdout -->
+ <property name="show_sql">true</property>
+
+ <!-- Drop and re-create the database schema on startup -->
+ <property name="hbm2ddl.auto">update</property>
+
+ <!-- Names the annotated entity class -->
+ <mapping class="org.hibernate.tutorial.annotations.Event"/>
+
+ </session-factory>
+
+</hibernate-configuration>
\ No newline at end of file
Property changes on: core/trunk/documentation/quickstart/tutorials/basic
___________________________________________________________________
Name: svn:ignore
+ target
local
*.ipr
*.iws
*.iml
.classpath
.project
.settings
.nbattrs
*.log
*.properties
.clover
Added: core/trunk/documentation/quickstart/tutorials/basic/pom.xml
===================================================================
--- core/trunk/documentation/quickstart/tutorials/basic/pom.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/basic/pom.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.hibernate.tutorials</groupId>
+ <artifactId>hibernate-tutorials</artifactId>
+ <version>3.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hibernate-tutorial-hbm</artifactId>
+ <name>Hibernate hbm.xml Tutorial</name>
+ <description>Hibernate tutorial illustrating the use of native APIs and hbm.xml for mapping metadata</description>
+
+ <properties>
+ <!-- Skip artifact deployment -->
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+</project>
Added: core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml
===================================================================
--- core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.hbm.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tutorial.hbm">
+
+ <class name="Event" table="EVENTS">
+ <id name="id" column="EVENT_ID">
+ <generator class="increment"/>
+ </id>
+ <property name="date" type="timestamp" column="EVENT_DATE"/>
+ <property name="title"/>
+ </class>
+
+</hibernate-mapping>
Added: core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java
===================================================================
--- core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/Event.java 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.tutorial.hbm;
+
+import java.util.Date;
+
+public class Event {
+ private Long id;
+
+ private String title;
+ private Date date;
+
+ public Event() {
+ // this form used by Hibernate
+ }
+
+ public Event(String title, Date date) {
+ // for application use, to create new events
+ this.title = title;
+ this.date = date;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
\ No newline at end of file
Added: core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java
===================================================================
--- core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/basic/src/test/java/org/hibernate/tutorial/hbm/NativeApiIllustrationTest.java 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,77 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.tutorial.hbm;
+
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class NativeApiIllustrationTest extends TestCase {
+ private SessionFactory sessionFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ // A SessionFactory is set up once for an application
+ sessionFactory = new Configuration()
+ .configure() // configures settings from hibernate.cfg.xml
+ .buildSessionFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if ( sessionFactory != null ) {
+ sessionFactory.close();
+ }
+ }
+
+ public void testBasicUsage() {
+ // create a couple of events...
+ Session session = sessionFactory.openSession();
+ session.beginTransaction();
+ session.save( new Event( "Our very first event!", new Date() ) );
+ session.save( new Event( "A follow up event", new Date() ) );
+ session.getTransaction().commit();
+ session.close();
+
+ // now lets pull events from the database and list them
+ session = sessionFactory.openSession();
+ session.beginTransaction();
+ List result = session.createQuery( "from Event" ).list();
+ for ( Event event : (List<Event>) result ) {
+ System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+ }
+ session.getTransaction().commit();
+ session.close();
+ }
+}
Copied: core/trunk/documentation/quickstart/tutorials/basic/src/test/resources/hibernate.cfg.xml (from rev 20248, core/trunk/documentation/quickstart/src/main/docbook/en-US/content/extras/examples/hbm/hibernate.cfg.xml)
===================================================================
--- core/trunk/documentation/quickstart/tutorials/basic/src/test/resources/hibernate.cfg.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/basic/src/test/resources/hibernate.cfg.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+ <session-factory>
+
+ <!-- Database connection settings -->
+ <property name="connection.driver_class">org.h2.Driver</property>
+ <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+ <property name="connection.username">sa</property>
+ <property name="connection.password"/>
+
+ <!-- JDBC connection pool (use the built-in) -->
+ <property name="connection.pool_size">1</property>
+
+ <!-- SQL dialect -->
+ <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+ <!-- Disable the second-level cache -->
+ <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+ <!-- Echo all executed SQL to stdout -->
+ <property name="show_sql">true</property>
+
+ <!-- Drop and re-create the database schema on startup -->
+ <property name="hbm2ddl.auto">update</property>
+
+ <mapping resource="org/hibernate/tutorial/hbm/Event.hbm.xml"/>
+
+ </session-factory>
+
+</hibernate-configuration>
\ No newline at end of file
Property changes on: core/trunk/documentation/quickstart/tutorials/entitymanager
___________________________________________________________________
Name: svn:ignore
+ target
local
*.ipr
*.iws
*.iml
.classpath
.project
.settings
.nbattrs
*.log
*.properties
.clover
Added: core/trunk/documentation/quickstart/tutorials/entitymanager/pom.xml
===================================================================
--- core/trunk/documentation/quickstart/tutorials/entitymanager/pom.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/entitymanager/pom.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>hibernate-tutorials</artifactId>
+ <groupId>org.hibernate.tutorials</groupId>
+ <version>3.6.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>hibernate-tutorial-entitymanager</artifactId>
+ <name>Hibernate JPA Tutorial</name>
+ <description>Hibernate tutorial illustrating the use of JPA APIs and annotations for mapping metadata</description>
+
+ <properties>
+ <!-- Skip artifact deployment -->
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java
===================================================================
--- core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/EntityManagerIllustrationTest.java 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,72 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.tutorial.em;
+
+import java.util.Date;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import junit.framework.TestCase;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class EntityManagerIllustrationTest extends TestCase {
+ private EntityManagerFactory entityManagerFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ // like discussed with regards to SessionFactory, an EntityManagerFactory is set up once for an application
+ entityManagerFactory = Persistence.createEntityManagerFactory( "hibernate-jpa-tutorial" );
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ entityManagerFactory.close();
+ }
+
+ public void testBasicUsage() {
+ // create a couple of events...
+ EntityManager entityManager = entityManagerFactory.createEntityManager();
+ entityManager.getTransaction().begin();
+ entityManager.persist( new Event( "Our very first event!", new Date() ) );
+ entityManager.persist( new Event( "A follow up event", new Date() ) );
+ entityManager.getTransaction().commit();
+ entityManager.close();
+
+ // now lets pull events from the database and list them
+ entityManager = entityManagerFactory.createEntityManager();
+ entityManager.getTransaction().begin();
+ List<Event> result = entityManager.createQuery( "from Event", Event.class ).getResultList();
+ for ( Event event : result ) {
+ System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+ }
+ entityManager.getTransaction().commit();
+ entityManager.close();
+ }
+}
Added: core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java
===================================================================
--- core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/java/org/hibernate/tutorial/em/Event.java 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,83 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.tutorial.em;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.annotations.GenericGenerator;
+
+@Entity
+@Table( name = "EVENTS" )
+public class Event {
+ private Long id;
+
+ private String title;
+ private Date date;
+
+ public Event() {
+ // this form used by Hibernate
+ }
+
+ public Event(String title, Date date) {
+ // for application use, to create new events
+ this.title = title;
+ this.date = date;
+ }
+
+ @Id
+ @GeneratedValue(generator="increment")
+ @GenericGenerator(name="increment", strategy = "increment")
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "EVENT_DATE")
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
\ No newline at end of file
Added: core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml
===================================================================
--- core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/entitymanager/src/test/resources/META-INF/persistence.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,49 @@
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+
+ <persistence-unit name="hibernate-jpa-tutorial">
+ <description>
+ Persistence unit for the JPA tutorial of the Hibernate Getting Started Guide
+ </description>
+
+ <class>org.hibernate.tutorial.em.Event</class>
+
+ <properties>
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE" />
+ <property name="javax.persistence.jdbc.user" value="sa" />
+ <property name="javax.persistence.jdbc.password" value="" />
+
+ <property name="hibernate.show_sql" value="true" />
+ <property name="hibernate.hbm2ddl.auto" value="update" />
+
+ </properties>
+
+ </persistence-unit>
+
+</persistence>
Added: core/trunk/documentation/quickstart/tutorials/pom.xml
===================================================================
--- core/trunk/documentation/quickstart/tutorials/pom.xml (rev 0)
+++ core/trunk/documentation/quickstart/tutorials/pom.xml 2010-08-27 21:44:03 UTC (rev 20277)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.hibernate.tutorials</groupId>
+ <artifactId>hibernate-tutorials</artifactId>
+ <version>3.6.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Hibernate Getting Started Guide Tutorials</name>
+ <description>Aggregator for the Hibernate tutorials presented in the Getting Started Guide</description>
+
+ <properties>
+ <!-- Skip artifact deployment -->
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+ <modules>
+ <module>basic</module>
+ <module>annotations</module>
+ <module>entitymanager</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+
+ <!-- Hibernate gives you a choice of bytecode providers between cglib and javassist -->
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.12.0.GA</version>
+ </dependency>
+
+ <!-- The tutorials use JUnit test cases to illustrate usage -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ </dependency>
+
+ <!-- The tutorials use the H2 in-memory database -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.2.140</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <testResources>
+ <testResource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </testResource>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ </build>
+
+</project>
13 years, 8 months
Hibernate SVN: r20276 - core/trunk/parent.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-27 07:10:51 -0400 (Fri, 27 Aug 2010)
New Revision: 20276
Modified:
core/trunk/parent/pom.xml
Log:
HHH-5510 - Upgrade to maven-jdocbook-plugin 2.3.3
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2010-08-27 10:48:39 UTC (rev 20275)
+++ core/trunk/parent/pom.xml 2010-08-27 11:10:51 UTC (rev 20276)
@@ -226,18 +226,6 @@
<version>2.0.1</version>
<type>jdocbook-style</type>
</dependency>
- <!-- Workaround http://jira.codehaus.org/browse/MNG-4761 -->
- <dependency>
- <groupId>saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>6.5.3</version>
- </dependency>
- <dependency>
- <groupId>xml-resolver</groupId>
- <artifactId>xml-resolver</artifactId>
- <version>1.1</version>
- </dependency>
- <!-- (end of) Workaround http://jira.codehaus.org/browse/MNG-4761 -->
</dependencies>
<configuration>
<formats>
13 years, 8 months
Hibernate SVN: r20275 - in core/trunk/core: src/test/java/org/hibernate/jmx and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-27 06:48:39 -0400 (Fri, 27 Aug 2010)
New Revision: 20275
Modified:
core/trunk/core/pom.xml
core/trunk/core/src/test/java/org/hibernate/jmx/TrivialTest.java
Log:
HHH-1189 - interfaces for Proxies are not regonized as interfaces
Modified: core/trunk/core/pom.xml
===================================================================
--- core/trunk/core/pom.xml 2010-08-27 06:22:01 UTC (rev 20274)
+++ core/trunk/core/pom.xml 2010-08-27 10:48:39 UTC (rev 20275)
@@ -129,6 +129,19 @@
</dependencies>
<build>
+ <testResources>
+ <testResource>
+ <filtering>false</filtering>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </testResource>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Modified: core/trunk/core/src/test/java/org/hibernate/jmx/TrivialTest.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/jmx/TrivialTest.java 2010-08-27 06:22:01 UTC (rev 20274)
+++ core/trunk/core/src/test/java/org/hibernate/jmx/TrivialTest.java 2010-08-27 10:48:39 UTC (rev 20275)
@@ -1,11 +1,36 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.jmx;
+import junit.framework.TestCase;
+
/**
* Test copied over from o.h.t.legacy.FooBarTest
*
* @author Steve Ebersole
*/
-public class TrivialTest {
+public class TrivialTest extends TestCase {
public void testService() throws Exception {
HibernateService hs = new HibernateService();
hs.setJndiName( "SessionFactory" );
13 years, 8 months
Hibernate SVN: r20274 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-08-27 02:22:01 -0400 (Fri, 27 Aug 2010)
New Revision: 20274
Modified:
search/trunk/pom.xml
Log:
HSEARCH-590 correct postgresql version
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2010-08-27 05:29:28 UTC (rev 20273)
+++ search/trunk/pom.xml 2010-08-27 06:22:01 UTC (rev 20274)
@@ -571,8 +571,7 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.4-701</version>
- <classifier>jdbc4</classifier>
+ <version>8.4-701.jdbc4</version>
</dependency>
</dependencies>
<properties>
@@ -592,8 +591,7 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.4-701</version>
- <classifier>jdbc4</classifier>
+ <version>8.4-701.jdbc4</version>
</dependency>
</dependencies>
<properties>
13 years, 8 months
Hibernate SVN: r20273 - core/trunk/parent.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-08-27 01:29:28 -0400 (Fri, 27 Aug 2010)
New Revision: 20273
Modified:
core/trunk/parent/pom.xml
Log:
HHH-5510 Upgrade to maven-jdocbook-plugin 2.3.3
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2010-08-27 01:50:32 UTC (rev 20272)
+++ core/trunk/parent/pom.xml 2010-08-27 05:29:28 UTC (rev 20273)
@@ -217,7 +217,7 @@
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.3.0</version>
+ <version>2.3.3</version>
<extensions>true</extensions>
<dependencies>
<dependency>
13 years, 8 months
Hibernate SVN: r20272 - in core/trunk/core/src: test/java/org/hibernate and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-26 21:50:32 -0400 (Thu, 26 Aug 2010)
New Revision: 20272
Added:
core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/
core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Doctor.java
core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/IDoctor.java
core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.hbm.xml
core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.java
core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java
Modified:
core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java
Log:
HHH-1189 - interfaces for Proxies are not regonized as interfaces
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java 2010-08-26 21:00:47 UTC (rev 20271)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java 2010-08-27 01:50:32 UTC (rev 20272)
@@ -116,7 +116,7 @@
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
// determine the id getter and setter methods from the proxy interface (if any)
// determine all interfaces needed by the resulting proxy
- HashSet proxyInterfaces = new HashSet();
+ HashSet<Class> proxyInterfaces = new HashSet<Class>();
proxyInterfaces.add( HibernateProxy.class );
Class mappedClass = persistentClass.getMappedClass();
@@ -125,9 +125,8 @@
if ( proxyInterface!=null && !mappedClass.equals( proxyInterface ) ) {
if ( !proxyInterface.isInterface() ) {
throw new MappingException(
- "proxy must be either an interface, or the class itself: " +
- getEntityName()
- );
+ "proxy must be either an interface, or the class itself: " + getEntityName()
+ );
}
proxyInterfaces.add( proxyInterface );
}
@@ -136,16 +135,15 @@
proxyInterfaces.add( mappedClass );
}
- Iterator iter = persistentClass.getSubclassIterator();
- while ( iter.hasNext() ) {
- Subclass subclass = ( Subclass ) iter.next();
- Class subclassProxy = subclass.getProxyInterface();
- Class subclassClass = subclass.getMappedClass();
+ Iterator subclasses = persistentClass.getSubclassIterator();
+ while ( subclasses.hasNext() ) {
+ final Subclass subclass = ( Subclass ) subclasses.next();
+ final Class subclassProxy = subclass.getProxyInterface();
+ final Class subclassClass = subclass.getMappedClass();
if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
- if ( !proxyInterface.isInterface() ) {
+ if ( !subclassProxy.isInterface() ) {
throw new MappingException(
- "proxy must be either an interface, or the class itself: " +
- subclass.getEntityName()
+ "proxy must be either an interface, or the class itself: " + subclass.getEntityName()
);
}
proxyInterfaces.add( subclassProxy );
Added: core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Doctor.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Doctor.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Doctor.java 2010-08-27 01:50:32 UTC (rev 20272)
@@ -0,0 +1,40 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.subclassProxyInterface;
+
+/**
+ * @author Steve Ebersole
+ */
+public class Doctor extends Person implements IDoctor {
+ public Doctor() {
+ }
+
+ public Doctor(String name) {
+ super( name );
+ }
+
+ public String operate() {
+ return "Dr. " + getName() + " is in";
+ }
+}
Added: core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/IDoctor.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/IDoctor.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/IDoctor.java 2010-08-27 01:50:32 UTC (rev 20272)
@@ -0,0 +1,31 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.subclassProxyInterface;
+
+/**
+ * @author Steve Ebersole
+ */
+public interface IDoctor {
+ String operate();
+}
Added: core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.hbm.xml
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.hbm.xml (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.hbm.xml 2010-08-27 01:50:32 UTC (rev 20272)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.subclassProxyInterface">
+ <class name="Person">
+ <id name="id" type="long">
+ <generator class="increment"/>
+ </id>
+ <discriminator column="personType" type="string" />
+ <property name="name" type="string" />
+ <subclass name="Doctor" discriminator-value="doctor" proxy="IDoctor" />
+ </class>
+</hibernate-mapping>
Added: core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/Person.java 2010-08-27 01:50:32 UTC (rev 20272)
@@ -0,0 +1,55 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.subclassProxyInterface;
+
+/**
+ * @author Steve Ebersole
+ */
+public class Person {
+ private Long id;
+ private String name;
+
+ public Person() {
+ }
+
+ public Person(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/subclassProxyInterface/SubclassProxyInterfaceTest.java 2010-08-27 01:50:32 UTC (rev 20272)
@@ -0,0 +1,44 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.subclassProxyInterface;
+
+import junit.framework.TestCase;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.H2Dialect;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class SubclassProxyInterfaceTest extends TestCase {
+ public void testSubclassProxyInterfaces() {
+ final Configuration cfg = new Configuration()
+ .setProperty( Environment.DIALECT, H2Dialect.class.getName() );
+ cfg.addClass( Person.class );
+ cfg.buildSessionFactory().close();
+ }
+}
13 years, 8 months
Hibernate SVN: r20271 - in core/trunk: core/src/main/java/org/hibernate/cfg and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-26 17:00:47 -0400 (Thu, 26 Aug 2010)
New Revision: 20271
Added:
core/trunk/core/src/main/java/org/hibernate/annotations/MapKeyType.java
Modified:
core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java
Log:
HHH-5507 - Add @MapKeyType annotation
Added: core/trunk/core/src/main/java/org/hibernate/annotations/MapKeyType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/annotations/MapKeyType.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/annotations/MapKeyType.java 2010-08-26 21:00:47 UTC (rev 20271)
@@ -0,0 +1,41 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.annotations;
+
+import java.lang.annotation.*;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Allows defining the type of the key of a persistent map.
+ *
+ * @author Steve Ebersole
+ */
+(a)java.lang.annotation.Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface MapKeyType {
+ Type value();
+}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-08-26 20:24:12 UTC (rev 20270)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-08-26 21:00:47 UTC (rev 20271)
@@ -112,6 +112,7 @@
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.ManyToAny;
+import org.hibernate.annotations.MapKeyType;
import org.hibernate.annotations.NaturalId;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
@@ -1682,11 +1683,12 @@
!indexColumn.isImplicit(),
property.isAnnotationPresent( CollectionOfElements.class )
|| property.isAnnotationPresent( org.hibernate.annotations.MapKey.class )
+ || property.isAnnotationPresent( MapKeyType.class )
+
// || property.isAnnotationPresent( ManyToAny.class )
);
collectionBinder.setIndexColumn( indexColumn );
- MapKey mapKeyAnn = property.getAnnotation( MapKey.class );
- collectionBinder.setMapKey( mapKeyAnn );
+ collectionBinder.setMapKey( property.getAnnotation( MapKey.class ) );
collectionBinder.setPropertyName( inferredData.getPropertyName() );
BatchSize batchAnn = property.getAnnotation( BatchSize.class );
collectionBinder.setBatchSize( batchAnn );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java 2010-08-26 20:24:12 UTC (rev 20270)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java 2010-08-26 21:00:47 UTC (rev 20271)
@@ -37,6 +37,7 @@
import org.hibernate.MappingException;
import org.hibernate.annotations.MapKey;
import org.hibernate.annotations.MapKeyManyToMany;
+import org.hibernate.annotations.MapKeyType;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.cfg.AccessType;
@@ -288,7 +289,13 @@
elementBinder.setExplicitType( mapKeyAnn.type() );
}
else {
- elementBinder.setType( property, elementClass );
+ MapKeyType mapKeyTypeAnnotation = property.getAnnotation( MapKeyType.class );
+ if ( mapKeyTypeAnnotation != null && ! BinderHelper.isDefault( mapKeyTypeAnnotation.value().type() ) ) {
+ elementBinder.setExplicitType( mapKeyTypeAnnotation.value() );
+ }
+ else {
+ elementBinder.setType( property, elementClass );
+ }
}
mapValue.setIndex( elementBinder.make() );
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java 2010-08-26 20:24:12 UTC (rev 20270)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java 2010-08-26 21:00:47 UTC (rev 20271)
@@ -9,7 +9,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import org.hibernate.annotations.MapKey;
+import org.hibernate.annotations.MapKeyType;
import org.hibernate.annotations.Sort;
import org.hibernate.annotations.SortType;
import org.hibernate.annotations.Type;
@@ -22,8 +22,8 @@
@Id
@GeneratedValue
private Integer id;
-
- @MapKey(type = @Type(type="integer") )
+
+ @MapKeyType( @Type(type="integer") )
@ElementCollection
@Sort(type = SortType.NATURAL)
@Type(type = "float")
13 years, 8 months
Hibernate SVN: r20270 - in core/trunk/core/src/main/java/org/hibernate/dialect: function and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-26 16:24:12 -0400 (Thu, 26 Aug 2010)
New Revision: 20270
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Cache71Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/DB2390Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/DB2400Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/DB2Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/DataDirectOracle9Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/FirebirdDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/FrontBaseDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/InformixDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Ingres10Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/IngresDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/InterbaseDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/JDataStoreDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MckoiDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5InnoDBDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MySQLInnoDBDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/MySQLMyISAMDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/OracleDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/PointbaseDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/PostgresPlusDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/ProgressDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java
core/trunk/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SQLServer2008Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/TeradataDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/TimesTenDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/TypeNames.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/AbstractAnsiTrimEmulationFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimEmulationFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/CharIndexFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicAvgFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicCountFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicSumFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/ConditionalParenthesisFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/ConvertFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/DerbyConcatFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/NoArgSQLFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/NvlFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/PositionSubstringFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/SQLFunctionRegistry.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/StandardJDBCEscapeFunction.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/TrimFunctionTemplate.java
core/trunk/core/src/main/java/org/hibernate/dialect/function/package.html
core/trunk/core/src/main/java/org/hibernate/dialect/lock/OptimisticLockingStrategy.java
core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java
core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java
core/trunk/core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java
core/trunk/core/src/main/java/org/hibernate/dialect/package.html
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/AbstractDialectResolver.java
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicDialectResolver.java
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicSQLExceptionConverter.java
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectFactory.java
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolver.java
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolverSet.java
core/trunk/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java
Log:
HHH-5509 - Leverage StandardBasicTypes internaly
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,11 +1,10 @@
-//$Id: $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -21,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -32,7 +30,6 @@
import java.util.Map;
import java.util.Iterator;
-import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.cfg.Environment;
@@ -41,13 +38,13 @@
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* An abstract base class for Sybase and MS SQL Server dialects.
+ *
* @author Gavin King
*/
-
-/* package-private */
abstract class AbstractTransactSQLDialect extends Dialect {
public AbstractTransactSQLDialect() {
super();
@@ -68,50 +65,50 @@
registerColumnType( Types.BLOB, "image" );
registerColumnType( Types.CLOB, "text" );
- registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
- registerFunction( "char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
- registerFunction( "len", new StandardSQLFunction("len", Hibernate.LONG) );
+ registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
+ registerFunction( "char", new StandardSQLFunction("char", StandardBasicTypes.CHARACTER) );
+ registerFunction( "len", new StandardSQLFunction("len", StandardBasicTypes.LONG) );
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "upper", new StandardSQLFunction("upper") );
- registerFunction( "str", new StandardSQLFunction("str", Hibernate.STRING) );
+ registerFunction( "str", new StandardSQLFunction("str", StandardBasicTypes.STRING) );
registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
registerFunction( "reverse", new StandardSQLFunction("reverse") );
- registerFunction( "space", new StandardSQLFunction("space", Hibernate.STRING) );
+ registerFunction( "space", new StandardSQLFunction("space", StandardBasicTypes.STRING) );
- registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING) );
+ registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING) );
- registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
- registerFunction( "current_time", new NoArgSQLFunction("getdate", Hibernate.TIME) );
- registerFunction( "current_date", new NoArgSQLFunction("getdate", Hibernate.DATE) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", StandardBasicTypes.TIMESTAMP) );
+ registerFunction( "current_time", new NoArgSQLFunction("getdate", StandardBasicTypes.TIME) );
+ registerFunction( "current_date", new NoArgSQLFunction("getdate", StandardBasicTypes.DATE) );
- registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
- registerFunction( "getutcdate", new NoArgSQLFunction("getutcdate", Hibernate.TIMESTAMP) );
- registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
- registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
- registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
- registerFunction( "datename", new StandardSQLFunction("datename", Hibernate.STRING) );
+ registerFunction( "getdate", new NoArgSQLFunction("getdate", StandardBasicTypes.TIMESTAMP) );
+ registerFunction( "getutcdate", new NoArgSQLFunction("getutcdate", StandardBasicTypes.TIMESTAMP) );
+ registerFunction( "day", new StandardSQLFunction("day", StandardBasicTypes.INTEGER) );
+ registerFunction( "month", new StandardSQLFunction("month", StandardBasicTypes.INTEGER) );
+ registerFunction( "year", new StandardSQLFunction("year", StandardBasicTypes.INTEGER) );
+ registerFunction( "datename", new StandardSQLFunction("datename", StandardBasicTypes.STRING) );
registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
- registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction( "cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
- registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE) );
- registerFunction( "log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
- registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
+ registerFunction( "acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE) );
+ registerFunction( "exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE) );
+ registerFunction( "log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE) );
registerFunction( "square", new StandardSQLFunction("square") );
- registerFunction( "rand", new StandardSQLFunction("rand", Hibernate.FLOAT) );
+ registerFunction( "rand", new StandardSQLFunction("rand", StandardBasicTypes.FLOAT) );
- registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
- registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
+ registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
+ registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
registerFunction( "round", new StandardSQLFunction("round") );
registerFunction( "ceiling", new StandardSQLFunction("ceiling") );
@@ -119,10 +116,10 @@
registerFunction( "isnull", new StandardSQLFunction("isnull") );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","+",")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","+",")" ) );
- registerFunction( "length", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
- registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "ltrim(rtrim(?1))") );
+ registerFunction( "length", new StandardSQLFunction( "len", StandardBasicTypes.INTEGER ) );
+ registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "ltrim(rtrim(?1))") );
registerFunction( "locate", new CharIndexFunction() );
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Cache71Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Cache71Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Cache71Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -29,7 +28,6 @@
import java.sql.SQLException;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.MappingException;
import org.hibernate.cfg.Environment;
@@ -50,6 +48,7 @@
import org.hibernate.persister.entity.Lockable;
import org.hibernate.sql.CacheJoinFragment;
import org.hibernate.sql.JoinFragment;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
@@ -256,132 +255,132 @@
getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", Hibernate.DOUBLE ) );
- registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", Hibernate.STRING ) );
- registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.STRING ) );
- registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", Hibernate.DOUBLE ) );
- registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "($length(?1)*8)" ) );
+ registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", StandardBasicTypes.STRING ) );
+ registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.STRING ) );
+ registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "($length(?1)*8)" ) );
// hibernate impelemnts cast in Dialect.java
- registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.INTEGER ) );
- registerFunction( "char", new StandardJDBCEscapeFunction( "char", Hibernate.CHARACTER ) );
- registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.INTEGER ) );
- registerFunction( "char_length", new StandardSQLFunction( "char_length", Hibernate.INTEGER ) );
- registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", Hibernate.DOUBLE ) );
- registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", Hibernate.DOUBLE ) );
+ registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char", new StandardJDBCEscapeFunction( "char", StandardBasicTypes.CHARACTER ) );
+ registerFunction( "character_length", new StandardSQLFunction( "character_length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char_length", new StandardSQLFunction( "char_length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", StandardBasicTypes.DOUBLE ) );
registerFunction( "coalesce", new VarArgsSQLFunction( "coalesce(", ",", ")" ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "", "||", "" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "||", "" ) );
registerFunction( "convert", new ConvertFunction() );
- registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", Hibernate.DATE ) );
- registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
- registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
+ registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", StandardBasicTypes.DATE ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
registerFunction(
- "current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", Hibernate.TIMESTAMP )
+ "current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP )
);
- registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", Hibernate.TIME ) );
- registerFunction( "database", new StandardJDBCEscapeFunction( "database", Hibernate.STRING ) );
- registerFunction( "dateadd", new VarArgsSQLFunction( Hibernate.TIMESTAMP, "dateadd(", ",", ")" ) );
- registerFunction( "datediff", new VarArgsSQLFunction( Hibernate.INTEGER, "datediff(", ",", ")" ) );
- registerFunction( "datename", new VarArgsSQLFunction( Hibernate.STRING, "datename(", ",", ")" ) );
- registerFunction( "datepart", new VarArgsSQLFunction( Hibernate.INTEGER, "datepart(", ",", ")" ) );
- registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
- registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", Hibernate.STRING ) );
- registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", Hibernate.INTEGER ) );
- registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", Hibernate.INTEGER ) );
- registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", Hibernate.INTEGER ) );
+ registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", StandardBasicTypes.TIME ) );
+ registerFunction( "database", new StandardJDBCEscapeFunction( "database", StandardBasicTypes.STRING ) );
+ registerFunction( "dateadd", new VarArgsSQLFunction( StandardBasicTypes.TIMESTAMP, "dateadd(", ",", ")" ) );
+ registerFunction( "datediff", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "datediff(", ",", ")" ) );
+ registerFunction( "datename", new VarArgsSQLFunction( StandardBasicTypes.STRING, "datename(", ",", ")" ) );
+ registerFunction( "datepart", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "datepart(", ",", ")" ) );
+ registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
// is it necessary to register %exact since it can only appear in a where clause?
- registerFunction( "%exact", new StandardSQLFunction( "%exact", Hibernate.STRING ) );
- registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "%external", new StandardSQLFunction( "%external", Hibernate.STRING ) );
- registerFunction( "$extract", new VarArgsSQLFunction( Hibernate.INTEGER, "$extract(", ",", ")" ) );
- registerFunction( "$find", new VarArgsSQLFunction( Hibernate.INTEGER, "$find(", ",", ")" ) );
- registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.INTEGER ) );
- registerFunction( "getdate", new StandardSQLFunction( "getdate", Hibernate.TIMESTAMP ) );
- registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", Hibernate.INTEGER ) );
+ registerFunction( "%exact", new StandardSQLFunction( "%exact", StandardBasicTypes.STRING ) );
+ registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "%external", new StandardSQLFunction( "%external", StandardBasicTypes.STRING ) );
+ registerFunction( "$extract", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "$extract(", ",", ")" ) );
+ registerFunction( "$find", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "$find(", ",", ")" ) );
+ registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.INTEGER ) );
+ registerFunction( "getdate", new StandardSQLFunction( "getdate", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", StandardBasicTypes.INTEGER ) );
registerFunction( "ifnull", new VarArgsSQLFunction( "ifnull(", ",", ")" ) );
registerFunction( "%internal", new StandardSQLFunction( "%internal" ) );
registerFunction( "isnull", new VarArgsSQLFunction( "isnull(", ",", ")" ) );
- registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", Hibernate.INTEGER ) );
- registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", Hibernate.STRING ) );
- registerFunction( "left", new StandardJDBCEscapeFunction( "left", Hibernate.STRING ) );
- registerFunction( "len", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
+ registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", StandardBasicTypes.INTEGER ) );
+ registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", StandardBasicTypes.STRING ) );
+ registerFunction( "left", new StandardJDBCEscapeFunction( "left", StandardBasicTypes.STRING ) );
+ registerFunction( "len", new StandardSQLFunction( "len", StandardBasicTypes.INTEGER ) );
registerFunction( "$length", new VarArgsSQLFunction( "$length(", ",", ")" ) );
// aggregate functions shouldn't be registered, right?
- //registerFunction( "list", new StandardSQLFunction("list",Hibernate.STRING) );
+ //registerFunction( "list", new StandardSQLFunction("list",StandardBasicTypes.STRING) );
// stopped on $list
registerFunction( "$list", new VarArgsSQLFunction( "$list(", ",", ")" ) );
registerFunction( "$listdata", new VarArgsSQLFunction( "$listdata(", ",", ")" ) );
registerFunction( "$listfind", new VarArgsSQLFunction( "$listfind(", ",", ")" ) );
registerFunction( "$listget", new VarArgsSQLFunction( "$listget(", ",", ")" ) );
- registerFunction( "$listlength", new StandardSQLFunction( "$listlength", Hibernate.INTEGER ) );
- registerFunction( "locate", new StandardSQLFunction( "$FIND", Hibernate.INTEGER ) );
- registerFunction( "log", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "log10", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
+ registerFunction( "$listlength", new StandardSQLFunction( "$listlength", StandardBasicTypes.INTEGER ) );
+ registerFunction( "locate", new StandardSQLFunction( "$FIND", StandardBasicTypes.INTEGER ) );
+ registerFunction( "log", new StandardJDBCEscapeFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardJDBCEscapeFunction( "log", StandardBasicTypes.DOUBLE ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
- registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", Hibernate.INTEGER ) );
- registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", Hibernate.DOUBLE ) );
- registerFunction( "month", new StandardJDBCEscapeFunction( "month", Hibernate.INTEGER ) );
- registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", Hibernate.STRING ) );
- registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", Hibernate.TIMESTAMP ) );
+ registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", StandardBasicTypes.INTEGER ) );
+ registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "month", new StandardJDBCEscapeFunction( "month", StandardBasicTypes.INTEGER ) );
+ registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", StandardBasicTypes.STRING ) );
+ registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "nullif", new VarArgsSQLFunction( "nullif(", ",", ")" ) );
registerFunction( "nvl", new NvlFunction() );
registerFunction( "%odbcin", new StandardSQLFunction( "%odbcin" ) );
registerFunction( "%odbcout", new StandardSQLFunction( "%odbcin" ) );
- registerFunction( "%pattern", new VarArgsSQLFunction( Hibernate.STRING, "", "%pattern", "" ) );
- registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", Hibernate.DOUBLE ) );
- registerFunction( "$piece", new VarArgsSQLFunction( Hibernate.STRING, "$piece(", ",", ")" ) );
- registerFunction( "position", new VarArgsSQLFunction( Hibernate.INTEGER, "position(", " in ", ")" ) );
- registerFunction( "power", new VarArgsSQLFunction( Hibernate.STRING, "power(", ",", ")" ) );
- registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", Hibernate.INTEGER ) );
- registerFunction( "repeat", new VarArgsSQLFunction( Hibernate.STRING, "repeat(", ",", ")" ) );
- registerFunction( "replicate", new VarArgsSQLFunction( Hibernate.STRING, "replicate(", ",", ")" ) );
- registerFunction( "right", new StandardJDBCEscapeFunction( "right", Hibernate.STRING ) );
- registerFunction( "round", new VarArgsSQLFunction( Hibernate.FLOAT, "round(", ",", ")" ) );
- registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
- registerFunction( "second", new StandardJDBCEscapeFunction( "second", Hibernate.INTEGER ) );
- registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
- registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", Hibernate.DOUBLE ) );
- registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
- registerFunction( "%sqlstring", new VarArgsSQLFunction( Hibernate.STRING, "%sqlstring(", ",", ")" ) );
- registerFunction( "%sqlupper", new VarArgsSQLFunction( Hibernate.STRING, "%sqlupper(", ",", ")" ) );
- registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", Hibernate.DOUBLE ) );
- registerFunction( "%startswith", new VarArgsSQLFunction( Hibernate.STRING, "", "%startswith", "" ) );
+ registerFunction( "%pattern", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "%pattern", "" ) );
+ registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "$piece", new VarArgsSQLFunction( StandardBasicTypes.STRING, "$piece(", ",", ")" ) );
+ registerFunction( "position", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "position(", " in ", ")" ) );
+ registerFunction( "power", new VarArgsSQLFunction( StandardBasicTypes.STRING, "power(", ",", ")" ) );
+ registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "repeat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "repeat(", ",", ")" ) );
+ registerFunction( "replicate", new VarArgsSQLFunction( StandardBasicTypes.STRING, "replicate(", ",", ")" ) );
+ registerFunction( "right", new StandardJDBCEscapeFunction( "right", StandardBasicTypes.STRING ) );
+ registerFunction( "round", new VarArgsSQLFunction( StandardBasicTypes.FLOAT, "round(", ",", ")" ) );
+ registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
+ registerFunction( "second", new StandardJDBCEscapeFunction( "second", StandardBasicTypes.INTEGER ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
+ registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
+ registerFunction( "%sqlstring", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%sqlstring(", ",", ")" ) );
+ registerFunction( "%sqlupper", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%sqlupper(", ",", ")" ) );
+ registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "%startswith", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "%startswith", "" ) );
// below is for Cache' that don't have str in 2007.1 there is str and we register str directly
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as char varying)" ) );
- registerFunction( "string", new VarArgsSQLFunction( Hibernate.STRING, "string(", ",", ")" ) );
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as char varying)" ) );
+ registerFunction( "string", new VarArgsSQLFunction( StandardBasicTypes.STRING, "string(", ",", ")" ) );
// note that %string is deprecated
- registerFunction( "%string", new VarArgsSQLFunction( Hibernate.STRING, "%string(", ",", ")" ) );
- registerFunction( "substr", new VarArgsSQLFunction( Hibernate.STRING, "substr(", ",", ")" ) );
- registerFunction( "substring", new VarArgsSQLFunction( Hibernate.STRING, "substring(", ",", ")" ) );
- registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.TIMESTAMP, false ) );
- registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", Hibernate.DOUBLE ) );
- registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", Hibernate.DOUBLE ) );
- registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", Hibernate.DOUBLE ) );
- registerFunction( "tochar", new VarArgsSQLFunction( Hibernate.STRING, "tochar(", ",", ")" ) );
- registerFunction( "to_char", new VarArgsSQLFunction( Hibernate.STRING, "to_char(", ",", ")" ) );
- registerFunction( "todate", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
- registerFunction( "to_date", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
+ registerFunction( "%string", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%string(", ",", ")" ) );
+ registerFunction( "substr", new VarArgsSQLFunction( StandardBasicTypes.STRING, "substr(", ",", ")" ) );
+ registerFunction( "substring", new VarArgsSQLFunction( StandardBasicTypes.STRING, "substring(", ",", ")" ) );
+ registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.TIMESTAMP, false ) );
+ registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tochar", new VarArgsSQLFunction( StandardBasicTypes.STRING, "tochar(", ",", ")" ) );
+ registerFunction( "to_char", new VarArgsSQLFunction( StandardBasicTypes.STRING, "to_char(", ",", ")" ) );
+ registerFunction( "todate", new VarArgsSQLFunction( StandardBasicTypes.STRING, "todate(", ",", ")" ) );
+ registerFunction( "to_date", new VarArgsSQLFunction( StandardBasicTypes.STRING, "todate(", ",", ")" ) );
registerFunction( "tonumber", new StandardSQLFunction( "tonumber" ) );
registerFunction( "to_number", new StandardSQLFunction( "tonumber" ) );
// TRIM(end_keyword string-expression-1 FROM string-expression-2)
// use Hibernate implementation "From" is one of the parameters they pass in position ?3
- //registerFunction( "trim", new SQLFunctionTemplate(Hibernate.STRING, "trim(?1 ?2 from ?3)") );
- registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", Hibernate.STRING ) );
- registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", Hibernate.STRING ) );
+ //registerFunction( "trim", new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1 ?2 from ?3)") );
+ registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", StandardBasicTypes.STRING ) );
+ registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", StandardBasicTypes.STRING ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
// %upper is deprecated
registerFunction( "%upper", new StandardSQLFunction( "%upper" ) );
- registerFunction( "user", new StandardJDBCEscapeFunction( "user", Hibernate.STRING ) );
- registerFunction( "week", new StandardJDBCEscapeFunction( "user", Hibernate.INTEGER ) );
- registerFunction( "xmlconcat", new VarArgsSQLFunction( Hibernate.STRING, "xmlconcat(", ",", ")" ) );
- registerFunction( "xmlelement", new VarArgsSQLFunction( Hibernate.STRING, "xmlelement(", ",", ")" ) );
+ registerFunction( "user", new StandardJDBCEscapeFunction( "user", StandardBasicTypes.STRING ) );
+ registerFunction( "week", new StandardJDBCEscapeFunction( "user", StandardBasicTypes.INTEGER ) );
+ registerFunction( "xmlconcat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "xmlconcat(", ",", ")" ) );
+ registerFunction( "xmlelement", new VarArgsSQLFunction( StandardBasicTypes.STRING, "xmlelement(", ",", ")" ) );
// xmlforest requires a new kind of function constructor
- registerFunction( "year", new StandardJDBCEscapeFunction( "year", Hibernate.INTEGER ) );
+ registerFunction( "year", new StandardJDBCEscapeFunction( "year", StandardBasicTypes.INTEGER ) );
}
protected final void register71Functions() {
- this.registerFunction( "str", new VarArgsSQLFunction( Hibernate.STRING, "str(", ",", ")" ) );
+ this.registerFunction( "str", new VarArgsSQLFunction( StandardBasicTypes.STRING, "str(", ",", ")" ) );
}
// DDL support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/DB2390Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/DB2390Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/DB2390Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/DB2400Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/DB2400Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/DB2400Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/DB2Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/DB2Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/DB2Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -29,7 +28,6 @@
import java.sql.SQLException;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
@@ -37,6 +35,7 @@
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for DB2.
@@ -69,86 +68,86 @@
registerFunction("abs", new StandardSQLFunction("abs") );
registerFunction("absval", new StandardSQLFunction("absval") );
- registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction("ceiling", new StandardSQLFunction("ceiling") );
registerFunction("ceil", new StandardSQLFunction("ceil") );
registerFunction("floor", new StandardSQLFunction("floor") );
registerFunction("round", new StandardSQLFunction("round") );
- registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
- registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
- registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction("float", new StandardSQLFunction("float", Hibernate.DOUBLE) );
- registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
- registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
- registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
- registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
- registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
- registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
- registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction("stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
- registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction("variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
+ registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction("cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE) );
+ registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
+ registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction("float", new StandardSQLFunction("float", StandardBasicTypes.DOUBLE) );
+ registerFunction("hex", new StandardSQLFunction("hex", StandardBasicTypes.STRING) );
+ registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE) );
+ registerFunction("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
+ registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
+ registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE) );
+ registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction("soundex", new StandardSQLFunction("soundex", StandardBasicTypes.STRING) );
+ registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction("stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE) );
+ registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
+ registerFunction("variance", new StandardSQLFunction("variance", StandardBasicTypes.DOUBLE) );
- registerFunction("julian_day", new StandardSQLFunction("julian_day", Hibernate.INTEGER) );
- registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
- registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", Hibernate.INTEGER) );
- registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
- registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
- registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
- registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
- registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
- registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
- registerFunction("current_date", new NoArgSQLFunction("current date", Hibernate.DATE, false) );
- registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
- registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
- registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
- registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", Hibernate.INTEGER) );
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
- registerFunction("days", new StandardSQLFunction("days", Hibernate.LONG) );
- registerFunction("current_time", new NoArgSQLFunction("current time", Hibernate.TIME, false) );
- registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
- registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", Hibernate.TIMESTAMP, false) );
- registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
- registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", Hibernate.TIMESTAMP) );
- registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
- registerFunction("week_iso", new StandardSQLFunction("week_iso", Hibernate.INTEGER) );
- registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
+ registerFunction("julian_day", new StandardSQLFunction("julian_day", StandardBasicTypes.INTEGER) );
+ registerFunction("microsecond", new StandardSQLFunction("microsecond", StandardBasicTypes.INTEGER) );
+ registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", StandardBasicTypes.INTEGER) );
+ registerFunction("minute", new StandardSQLFunction("minute", StandardBasicTypes.INTEGER) );
+ registerFunction("month", new StandardSQLFunction("month", StandardBasicTypes.INTEGER) );
+ registerFunction("monthname", new StandardSQLFunction("monthname", StandardBasicTypes.STRING) );
+ registerFunction("quarter", new StandardSQLFunction("quarter", StandardBasicTypes.INTEGER) );
+ registerFunction("hour", new StandardSQLFunction("hour", StandardBasicTypes.INTEGER) );
+ registerFunction("second", new StandardSQLFunction("second", StandardBasicTypes.INTEGER) );
+ registerFunction("current_date", new NoArgSQLFunction("current date", StandardBasicTypes.DATE, false) );
+ registerFunction("date", new StandardSQLFunction("date", StandardBasicTypes.DATE) );
+ registerFunction("day", new StandardSQLFunction("day", StandardBasicTypes.INTEGER) );
+ registerFunction("dayname", new StandardSQLFunction("dayname", StandardBasicTypes.STRING) );
+ registerFunction("dayofweek", new StandardSQLFunction("dayofweek", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofyear", new StandardSQLFunction("dayofyear", StandardBasicTypes.INTEGER) );
+ registerFunction("days", new StandardSQLFunction("days", StandardBasicTypes.LONG) );
+ registerFunction("current_time", new NoArgSQLFunction("current time", StandardBasicTypes.TIME, false) );
+ registerFunction("time", new StandardSQLFunction("time", StandardBasicTypes.TIME) );
+ registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", StandardBasicTypes.TIMESTAMP, false) );
+ registerFunction("timestamp", new StandardSQLFunction("timestamp", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("week", new StandardSQLFunction("week", StandardBasicTypes.INTEGER) );
+ registerFunction("week_iso", new StandardSQLFunction("week_iso", StandardBasicTypes.INTEGER) );
+ registerFunction("year", new StandardSQLFunction("year", StandardBasicTypes.INTEGER) );
- registerFunction("double", new StandardSQLFunction("double", Hibernate.DOUBLE) );
- registerFunction("varchar", new StandardSQLFunction("varchar", Hibernate.STRING) );
- registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
- registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
- registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
- registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
- registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );
+ registerFunction("double", new StandardSQLFunction("double", StandardBasicTypes.DOUBLE) );
+ registerFunction("varchar", new StandardSQLFunction("varchar", StandardBasicTypes.STRING) );
+ registerFunction("real", new StandardSQLFunction("real", StandardBasicTypes.FLOAT) );
+ registerFunction("bigint", new StandardSQLFunction("bigint", StandardBasicTypes.LONG) );
+ registerFunction("char", new StandardSQLFunction("char", StandardBasicTypes.CHARACTER) );
+ registerFunction("integer", new StandardSQLFunction("integer", StandardBasicTypes.INTEGER) );
+ registerFunction("smallint", new StandardSQLFunction("smallint", StandardBasicTypes.SHORT) );
- registerFunction("digits", new StandardSQLFunction("digits", Hibernate.STRING) );
- registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
+ registerFunction("digits", new StandardSQLFunction("digits", StandardBasicTypes.STRING) );
+ registerFunction("chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
registerFunction("upper", new StandardSQLFunction("upper") );
registerFunction("lower", new StandardSQLFunction("lower") );
registerFunction("ucase", new StandardSQLFunction("ucase") );
registerFunction("lcase", new StandardSQLFunction("lcase") );
registerFunction("ltrim", new StandardSQLFunction("ltrim") );
registerFunction("rtrim", new StandardSQLFunction("rtrim") );
- registerFunction( "substr", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "posstr", new StandardSQLFunction( "posstr", Hibernate.INTEGER ) );
+ registerFunction( "substr", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "posstr", new StandardSQLFunction( "posstr", StandardBasicTypes.INTEGER ) );
- registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "length(?1)*8" ) );
+ registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "length(?1)*8" ) );
registerFunction( "trim", new AnsiTrimEmulationFunction() );
- registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
+ registerFunction( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "rtrim(char(?1))" ) );
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "rtrim(char(?1))" ) );
registerKeyword("current");
registerKeyword("date");
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/DataDirectOracle9Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/DataDirectOracle9Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/DataDirectOracle9Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -36,7 +36,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
@@ -67,6 +66,7 @@
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.ForUpdateFragment;
import org.hibernate.sql.JoinFragment;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
@@ -109,53 +109,53 @@
StandardAnsiSqlAggregationFunctions.primeFunctionMap( sqlFunctions );
// standard sql92 functions (can be overridden by subclasses)
- registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1, ?2, ?3)" ) );
- registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "locate(?1, ?2, ?3)" ) );
- registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "trim(?1 ?2 ?3 ?4)" ) );
- registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
- registerFunction( "bit_length", new StandardSQLFunction( "bit_length", Hibernate.INTEGER ) );
+ registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1, ?2, ?3)" ) );
+ registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "locate(?1, ?2, ?3)" ) );
+ registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "trim(?1 ?2 ?3 ?4)" ) );
+ registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "bit_length", new StandardSQLFunction( "bit_length", StandardBasicTypes.INTEGER ) );
registerFunction( "coalesce", new StandardSQLFunction( "coalesce" ) );
registerFunction( "nullif", new StandardSQLFunction( "nullif" ) );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER) );
- registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE) );
+ registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER) );
+ registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE) );
registerFunction( "upper", new StandardSQLFunction("upper") );
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "cast", new CastFunction() );
- registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(?1 ?2 ?3)") );
+ registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.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)") );
- registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(hour from ?1)") );
- 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( "second", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(second from ?1)") );
+ registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(minute from ?1)") );
+ registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(hour from ?1)") );
+ registerFunction( "day", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(day from ?1)") );
+ registerFunction( "month", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(month from ?1)") );
+ registerFunction( "year", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(year from ?1)") );
- registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as char)") );
+ registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as char)") );
// register hibernate types for default use in scalar sqlquery type auto detection
- registerHibernateType( Types.BIGINT, Hibernate.BIG_INTEGER.getName() );
- registerHibernateType( Types.BINARY, Hibernate.BINARY.getName() );
- registerHibernateType( Types.BIT, Hibernate.BOOLEAN.getName() );
- registerHibernateType( Types.CHAR, Hibernate.CHARACTER.getName() );
- registerHibernateType( Types.DATE, Hibernate.DATE.getName() );
- registerHibernateType( Types.DOUBLE, Hibernate.DOUBLE.getName() );
- registerHibernateType( Types.FLOAT, Hibernate.FLOAT.getName() );
- registerHibernateType( Types.INTEGER, Hibernate.INTEGER.getName() );
- registerHibernateType( Types.SMALLINT, Hibernate.SHORT.getName() );
- registerHibernateType( Types.TINYINT, Hibernate.BYTE.getName() );
- registerHibernateType( Types.TIME, Hibernate.TIME.getName() );
- registerHibernateType( Types.TIMESTAMP, Hibernate.TIMESTAMP.getName() );
- registerHibernateType( Types.VARCHAR, Hibernate.STRING.getName() );
- registerHibernateType( Types.VARBINARY, Hibernate.BINARY.getName() );
- registerHibernateType( Types.LONGVARCHAR, Hibernate.TEXT.getName() );
- registerHibernateType( Types.LONGVARBINARY, Hibernate.IMAGE.getName() );
- registerHibernateType( Types.NUMERIC, Hibernate.BIG_DECIMAL.getName() );
- registerHibernateType( Types.DECIMAL, Hibernate.BIG_DECIMAL.getName() );
- registerHibernateType( Types.BLOB, Hibernate.BLOB.getName() );
- registerHibernateType( Types.CLOB, Hibernate.CLOB.getName() );
- registerHibernateType( Types.REAL, Hibernate.FLOAT.getName() );
+ registerHibernateType( Types.BIGINT, StandardBasicTypes.BIG_INTEGER.getName() );
+ registerHibernateType( Types.BINARY, StandardBasicTypes.BINARY.getName() );
+ registerHibernateType( Types.BIT, StandardBasicTypes.BOOLEAN.getName() );
+ registerHibernateType( Types.CHAR, StandardBasicTypes.CHARACTER.getName() );
+ registerHibernateType( Types.DATE, StandardBasicTypes.DATE.getName() );
+ registerHibernateType( Types.DOUBLE, StandardBasicTypes.DOUBLE.getName() );
+ registerHibernateType( Types.FLOAT, StandardBasicTypes.FLOAT.getName() );
+ registerHibernateType( Types.INTEGER, StandardBasicTypes.INTEGER.getName() );
+ registerHibernateType( Types.SMALLINT, StandardBasicTypes.SHORT.getName() );
+ registerHibernateType( Types.TINYINT, StandardBasicTypes.BYTE.getName() );
+ registerHibernateType( Types.TIME, StandardBasicTypes.TIME.getName() );
+ registerHibernateType( Types.TIMESTAMP, StandardBasicTypes.TIMESTAMP.getName() );
+ registerHibernateType( Types.VARCHAR, StandardBasicTypes.STRING.getName() );
+ registerHibernateType( Types.VARBINARY, StandardBasicTypes.BINARY.getName() );
+ registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() );
+ registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() );
+ registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() );
+ registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() );
+ registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() );
+ registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() );
+ registerHibernateType( Types.REAL, StandardBasicTypes.FLOAT.getName() );
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/FirebirdDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/FirebirdDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/FirebirdDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/FrontBaseDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/FrontBaseDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/FrontBaseDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -29,7 +29,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
@@ -37,6 +36,7 @@
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
/**
@@ -106,82 +106,82 @@
// see also -> http://www.h2database.com/html/functions.html
// Numeric Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- registerFunction( "acos", new StandardSQLFunction( "acos", Hibernate.DOUBLE ) );
- registerFunction( "asin", new StandardSQLFunction( "asin", Hibernate.DOUBLE ) );
- registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "atan2", new StandardSQLFunction( "atan2", Hibernate.DOUBLE ) );
- registerFunction( "bitand", new StandardSQLFunction( "bitand", Hibernate.INTEGER ) );
- registerFunction( "bitor", new StandardSQLFunction( "bitor", Hibernate.INTEGER ) );
- registerFunction( "bitxor", new StandardSQLFunction( "bitxor", Hibernate.INTEGER ) );
- registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.DOUBLE ) );
- registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
- registerFunction( "compress", new StandardSQLFunction( "compress", Hibernate.BINARY ) );
- registerFunction( "cot", new StandardSQLFunction( "cot", Hibernate.DOUBLE ) );
- registerFunction( "decrypt", new StandardSQLFunction( "decrypt", Hibernate.BINARY ) );
- registerFunction( "degrees", new StandardSQLFunction( "degrees", Hibernate.DOUBLE ) );
- registerFunction( "encrypt", new StandardSQLFunction( "encrypt", Hibernate.BINARY ) );
- registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "expand", new StandardSQLFunction( "compress", Hibernate.BINARY ) );
- registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.DOUBLE ) );
- registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.BINARY ) );
- registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
- registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
- registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
- registerFunction( "radians", new StandardSQLFunction( "radians", Hibernate.DOUBLE ) );
- registerFunction( "rand", new NoArgSQLFunction( "rand", Hibernate.DOUBLE ) );
- registerFunction( "round", new StandardSQLFunction( "round", Hibernate.DOUBLE ) );
- registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", Hibernate.DOUBLE ) );
- registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
- registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
- registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
- registerFunction( "truncate", new StandardSQLFunction( "truncate", Hibernate.DOUBLE ) );
+ registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "bitand", new StandardSQLFunction( "bitand", StandardBasicTypes.INTEGER ) );
+ registerFunction( "bitor", new StandardSQLFunction( "bitor", StandardBasicTypes.INTEGER ) );
+ registerFunction( "bitxor", new StandardSQLFunction( "bitxor", StandardBasicTypes.INTEGER ) );
+ registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "compress", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) );
+ registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "decrypt", new StandardSQLFunction( "decrypt", StandardBasicTypes.BINARY ) );
+ registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "encrypt", new StandardSQLFunction( "encrypt", StandardBasicTypes.BINARY ) );
+ registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "expand", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) );
+ registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.BINARY ) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "rand", new NoArgSQLFunction( "rand", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "round", new StandardSQLFunction( "round", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
+ registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "truncate", new StandardSQLFunction( "truncate", StandardBasicTypes.DOUBLE ) );
// String Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
- registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
- registerFunction( "difference", new StandardSQLFunction( "difference", Hibernate.INTEGER ) );
- registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", Hibernate.STRING ) );
- registerFunction( "insert", new StandardSQLFunction( "lower", Hibernate.STRING ) );
- registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
- registerFunction( "lcase", new StandardSQLFunction( "lcase", Hibernate.STRING ) );
- registerFunction( "ltrim", new StandardSQLFunction( "ltrim", Hibernate.STRING ) );
- registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.INTEGER ) );
- registerFunction( "position", new StandardSQLFunction( "position", Hibernate.INTEGER ) );
- registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", Hibernate.STRING ) );
- registerFunction( "repeat", new StandardSQLFunction( "repeat", Hibernate.STRING ) );
- registerFunction( "replace", new StandardSQLFunction( "replace", Hibernate.STRING ) );
- registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
- registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
- registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
- registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
- registerFunction( "stringencode", new StandardSQLFunction( "stringencode", Hibernate.STRING ) );
- registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", Hibernate.STRING ) );
- registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", Hibernate.BINARY ) );
- registerFunction( "ucase", new StandardSQLFunction( "ucase", Hibernate.STRING ) );
- registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", Hibernate.STRING ) );
+ registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
+ registerFunction( "difference", new StandardSQLFunction( "difference", StandardBasicTypes.INTEGER ) );
+ registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", StandardBasicTypes.STRING ) );
+ registerFunction( "insert", new StandardSQLFunction( "lower", StandardBasicTypes.STRING ) );
+ registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) );
+ registerFunction( "lcase", new StandardSQLFunction( "lcase", StandardBasicTypes.STRING ) );
+ registerFunction( "ltrim", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) );
+ registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.INTEGER ) );
+ registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", StandardBasicTypes.STRING ) );
+ registerFunction( "repeat", new StandardSQLFunction( "repeat", StandardBasicTypes.STRING ) );
+ registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
+ registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) );
+ registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
+ registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
+ registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
+ registerFunction( "stringencode", new StandardSQLFunction( "stringencode", StandardBasicTypes.STRING ) );
+ registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", StandardBasicTypes.STRING ) );
+ registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", StandardBasicTypes.BINARY ) );
+ registerFunction( "ucase", new StandardSQLFunction( "ucase", StandardBasicTypes.STRING ) );
+ registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", StandardBasicTypes.STRING ) );
// Time and Date Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
- registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
- registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", Hibernate.TIME ) );
- registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE ) );
- registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME ) );
- registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP ) );
- registerFunction( "datediff", new StandardSQLFunction( "datediff", Hibernate.INTEGER ) );
- registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
- registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
- registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
- registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
- registerFunction( "monthname", new StandardSQLFunction( "monthname", Hibernate.STRING ) );
- registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
- registerFunction( "quarter", new StandardSQLFunction( "quarter", Hibernate.INTEGER ) );
- registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
+ registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) );
+ registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) );
+ registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", StandardBasicTypes.TIME ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME ) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "datediff", new StandardSQLFunction( "datediff", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
+ registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
+ registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
// System Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );
- registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
+ registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
+ registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -27,7 +27,6 @@
import java.sql.Types;
import java.io.Serializable;
-import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.JDBCException;
@@ -43,6 +42,7 @@
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
import org.slf4j.Logger;
@@ -61,8 +61,6 @@
* @author Fred Toussi
*/
public class HSQLDialect extends Dialect {
-
-
private static final Logger log = LoggerFactory.getLogger( HSQLDialect.class );
/**
@@ -124,75 +122,75 @@
registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );
- registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
- registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
+ registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
registerFunction( "lcase", new StandardSQLFunction( "lcase" ) );
registerFunction( "ucase", new StandardSQLFunction( "ucase" ) );
- registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
+ registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
registerFunction( "reverse", new StandardSQLFunction( "reverse" ) );
- registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
+ registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex" ) );
registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw" ) );
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as varchar(24))" ) );
- registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
- registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as varchar(24))" ) );
+ registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) );
+ registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
- registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.DATE, false ) );
- registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
- registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
+ registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
+ registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) );
registerFunction(
- "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false )
+ "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP, false )
);
- registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
- registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
- registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
- registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
- registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
- registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
- registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
- registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
- registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
- registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
- registerFunction( "quarter", new StandardSQLFunction( "quarter", Hibernate.INTEGER ) );
- registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
- registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
- registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
- registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
- registerFunction( "monthname", new StandardSQLFunction( "monthname", Hibernate.STRING ) );
+ registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
+ registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) );
+ registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
+ registerFunction( "month", new StandardSQLFunction( "month", StandardBasicTypes.INTEGER ) );
+ registerFunction( "year", new StandardSQLFunction( "year", StandardBasicTypes.INTEGER ) );
+ registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
+ registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "hour", new StandardSQLFunction( "hour", StandardBasicTypes.INTEGER ) );
+ registerFunction( "minute", new StandardSQLFunction( "minute", StandardBasicTypes.INTEGER ) );
+ registerFunction( "second", new StandardSQLFunction( "second", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
- registerFunction( "acos", new StandardSQLFunction( "acos", Hibernate.DOUBLE ) );
- registerFunction( "asin", new StandardSQLFunction( "asin", Hibernate.DOUBLE ) );
- registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
- registerFunction( "cot", new StandardSQLFunction( "cot", Hibernate.DOUBLE ) );
- registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
- registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
- registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
- registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
- registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
- registerFunction( "rand", new StandardSQLFunction( "rand", Hibernate.FLOAT ) );
+ registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "rand", new StandardSQLFunction( "rand", StandardBasicTypes.FLOAT ) );
- registerFunction( "radians", new StandardSQLFunction( "radians", Hibernate.DOUBLE ) );
- registerFunction( "degrees", new StandardSQLFunction( "degrees", Hibernate.DOUBLE ) );
+ registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic" ) );
registerFunction( "ceiling", new StandardSQLFunction( "ceiling" ) );
registerFunction( "floor", new StandardSQLFunction( "floor" ) );
// Multi-param dialect functions...
- registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
+ registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
// function templates
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/InformixDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/InformixDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/InformixDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -28,18 +27,18 @@
import java.sql.Types;
import org.hibernate.MappingException;
-import org.hibernate.Hibernate;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
* Informix dialect.<br>
* <br>
- * Seems to work with Informix Dynamic Server Version 7.31.UD3,
- * Informix JDBC driver version 2.21JC3.
+ * Seems to work with Informix Dynamic Server Version 7.31.UD3, Informix JDBC driver version 2.21JC3.
+ *
* @author Steve Molitor
*/
public class InformixDialect extends Dialect {
@@ -73,7 +72,7 @@
registerColumnType(Types.VARCHAR, 255, "varchar($l)");
registerColumnType(Types.VARCHAR, 32739, "lvarchar($l)");
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
}
public String getAddColumnString() {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Ingres10Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Ingres10Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Ingres10Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.dialect;
import java.sql.Types;
@@ -3,7 +26,5 @@
import java.util.Properties;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.function.NoArgSQLFunction;
/**
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.dialect;
import java.sql.Types;
@@ -2,6 +25,5 @@
-import org.hibernate.Hibernate;
-import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
@@ -21,23 +43,24 @@
* <li>Modified concatination operator</li>
* </ul>
*
- * @author Enrico Schenk, Raymond Fan
+ * @author Enrico Schenk
+ * @author Raymond Fan
*/
public class Ingres9Dialect extends IngresDialect {
public Ingres9Dialect() {
super();
registerDateTimeFunctions();
registerDateTimeColumnTypes();
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
}
/**
* Register functions current_time, current_timestamp, current_date
*/
protected void registerDateTimeFunctions() {
- registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false));
- registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false));
- registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false));
+ registerFunction("current_time", new NoArgSQLFunction("current_time", StandardBasicTypes.TIME, false));
+ registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false));
+ registerFunction("current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false));
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/IngresDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/IngresDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/IngresDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,18 +20,17 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for Ingres 9.2.
@@ -44,7 +43,10 @@
* <li> Perform string casts to varchar; removes space padding.
* </ul>
*
- * @author Ian Booth, Bruce Lunsford, Max Rydahl Andersen, Raymond Fan
+ * @author Ian Booth
+ * @author Bruce Lunsford
+ * @author Max Rydahl Andersen
+ * @author Raymond Fan
*/
public class IngresDialect extends Dialect {
@@ -76,74 +78,74 @@
registerColumnType( Types.CLOB, "clob" );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
+ registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(hex(?1))*4" ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "octet_length(hex(?1))*4" ) );
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( "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( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
- 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( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
- registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
- 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 ) );
- registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
- registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
- registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
- registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
+ registerFunction( "character_length", new StandardSQLFunction( "character_length", StandardBasicTypes.LONG ) );
+ registerFunction( "charextract", new StandardSQLFunction( "charextract", StandardBasicTypes.STRING ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "+", ")" ) );
+ registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "current_user", new NoArgSQLFunction( "current_user", StandardBasicTypes.STRING, false ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "date('now')", StandardBasicTypes.TIMESTAMP, false ) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", StandardBasicTypes.TIMESTAMP, false ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "date('now')", StandardBasicTypes.TIMESTAMP, false ) );
+ registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dba", new NoArgSQLFunction( "dba", StandardBasicTypes.STRING, true ) );
+ registerFunction( "dow", new StandardSQLFunction( "dow", StandardBasicTypes.STRING ) );
+ registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "date_part('?1', ?3)" ) );
+ registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", StandardBasicTypes.STRING ) );
+ registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.INTEGER ) );
+ registerFunction( "hex", new StandardSQLFunction( "hex", StandardBasicTypes.STRING ) );
+ registerFunction( "hour", new StandardSQLFunction( "hour", StandardBasicTypes.INTEGER ) );
+ registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", StandardBasicTypes.STRING, false ) );
+ registerFunction( "intextract", new StandardSQLFunction( "intextract", StandardBasicTypes.INTEGER ) );
+ registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) );
+ registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.LONG, "locate(?1, ?2)" ) );
+ registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.LONG ) );
+ registerFunction( "ln", new StandardSQLFunction( "ln", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.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( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
- registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
- registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
- registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
- registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
- 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( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
+ registerFunction( "minute", new StandardSQLFunction( "minute", StandardBasicTypes.INTEGER ) );
+ registerFunction( "month", new StandardSQLFunction( "month", StandardBasicTypes.INTEGER ) );
+ registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.LONG ) );
+ registerFunction( "pad", new StandardSQLFunction( "pad", StandardBasicTypes.STRING ) );
+ registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.LONG ) );
+ registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "random", new NoArgSQLFunction( "random", StandardBasicTypes.LONG, true ) );
+ registerFunction( "randomf", new NoArgSQLFunction( "randomf", StandardBasicTypes.DOUBLE, true ) );
+ registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) );
+ registerFunction( "session_user", new NoArgSQLFunction( "session_user", StandardBasicTypes.STRING, false ) );
+ registerFunction( "second", new StandardSQLFunction( "second", StandardBasicTypes.INTEGER ) );
+ registerFunction( "size", new NoArgSQLFunction( "size", StandardBasicTypes.LONG, true ) );
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( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
+ registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
+ registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
+ registerFunction( "system_user", new NoArgSQLFunction( "system_user", StandardBasicTypes.STRING, false ) );
+ //registerFunction( "trim", new StandardSQLFunction( "trim", StandardBasicTypes.STRING ) );
+ registerFunction( "unhex", new StandardSQLFunction( "unhex", StandardBasicTypes.STRING ) );
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 ) );
- registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
- 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( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING, false ) );
+ registerFunction( "usercode", new NoArgSQLFunction( "usercode", StandardBasicTypes.STRING, true ) );
+ registerFunction( "username", new NoArgSQLFunction( "username", StandardBasicTypes.STRING, true ) );
+ registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", StandardBasicTypes.BYTE ) );
+ registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", StandardBasicTypes.INTEGER ) );
+ registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", StandardBasicTypes.BYTE ) );
+ registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", StandardBasicTypes.STRING ) );
+ registerFunction( "year", new StandardSQLFunction( "year", StandardBasicTypes.INTEGER ) );
// Casting to char of numeric values introduces space padding up to the
// maximum width of a value for that return type. Casting to varchar
// does not introduce space padding.
- registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as varchar)") );
+ registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as varchar)") );
// Ingres driver supports getGeneratedKeys but only in the following
// form:
// The Ingres DBMS returns only a single table key or a single object
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/InterbaseDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/InterbaseDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/InterbaseDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,18 +20,18 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for Interbase.
+ *
* @author Gavin King
*/
public class InterbaseDialect extends Dialect {
@@ -55,7 +55,7 @@
registerColumnType( Types.BLOB, "blob" );
registerColumnType( Types.CLOB, "blob sub_type 1" );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","||",")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","||",")" ) );
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/JDataStoreDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/JDataStoreDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/JDataStoreDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MckoiDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MckoiDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MckoiDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,13 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.cfg.Environment;
@@ -34,10 +32,13 @@
import org.hibernate.dialect.lock.*;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.MckoiCaseFragment;
+import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect compatible with McKoi SQL
- * @author Doug Currie, Gabe Hicks
+ *
+ * @author Doug Currie
+ * @author Gabe Hicks
*/
public class MckoiDialect extends Dialect {
public MckoiDialect() {
@@ -61,15 +62,15 @@
registerFunction( "upper", new StandardSQLFunction("upper") );
registerFunction( "lower", new StandardSQLFunction("lower") );
- registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
+ registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
- registerFunction( "round", new StandardSQLFunction( "round", Hibernate.INTEGER ) );
- registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
+ registerFunction( "round", new StandardSQLFunction( "round", StandardBasicTypes.INTEGER ) );
+ registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
registerFunction( "least", new StandardSQLFunction("least") );
registerFunction( "greatest", new StandardSQLFunction("greatest") );
- registerFunction( "user", new StandardSQLFunction( "user", Hibernate.STRING ) );
- registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );
+ registerFunction( "user", new StandardSQLFunction( "user", StandardBasicTypes.STRING ) );
+ registerFunction( "concat", new StandardSQLFunction( "concat", StandardBasicTypes.STRING ) );
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,15 +20,14 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.function.*;
+import org.hibernate.dialect.function.StandardSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* An Hibernate 3 SQL dialect for Mimer SQL. This dialect requires Mimer SQL 9.2.1 or later
@@ -73,66 +72,66 @@
registerColumnType( Types.CLOB, "NCLOB($l)" );
registerFunction("abs", new StandardSQLFunction("abs") );
- registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction("ceiling", new StandardSQLFunction("ceiling") );
registerFunction("floor", new StandardSQLFunction("floor") );
registerFunction("round", new StandardSQLFunction("round") );
- registerFunction("dacos", new StandardSQLFunction("dacos", Hibernate.DOUBLE) );
- registerFunction("acos", new StandardSQLFunction("dacos", Hibernate.DOUBLE) );
- registerFunction("dasin", new StandardSQLFunction("dasin", Hibernate.DOUBLE) );
- registerFunction("asin", new StandardSQLFunction("dasin", Hibernate.DOUBLE) );
- registerFunction("datan", new StandardSQLFunction("datan", Hibernate.DOUBLE) );
- registerFunction("atan", new StandardSQLFunction("datan", Hibernate.DOUBLE) );
- registerFunction("datan2", new StandardSQLFunction("datan2", Hibernate.DOUBLE) );
- registerFunction("atan2", new StandardSQLFunction("datan2", Hibernate.DOUBLE) );
- registerFunction("dcos", new StandardSQLFunction("dcos", Hibernate.DOUBLE) );
- registerFunction("cos", new StandardSQLFunction("dcos", Hibernate.DOUBLE) );
- registerFunction("dcot", new StandardSQLFunction("dcot", Hibernate.DOUBLE) );
- registerFunction("cot", new StandardSQLFunction("dcot", Hibernate.DOUBLE) );
- registerFunction("ddegrees", new StandardSQLFunction("ddegrees", Hibernate.DOUBLE) );
- registerFunction("degrees", new StandardSQLFunction("ddegrees", Hibernate.DOUBLE) );
- registerFunction("dexp", new StandardSQLFunction("dexp", Hibernate.DOUBLE) );
- registerFunction("exp", new StandardSQLFunction("dexp", Hibernate.DOUBLE) );
- registerFunction("dlog", new StandardSQLFunction("dlog", Hibernate.DOUBLE) );
- registerFunction("log", new StandardSQLFunction("dlog", Hibernate.DOUBLE) );
- registerFunction("dlog10", new StandardSQLFunction("dlog10", Hibernate.DOUBLE) );
- registerFunction("log10", new StandardSQLFunction("dlog10", Hibernate.DOUBLE) );
- registerFunction("dradian", new StandardSQLFunction("dradian", Hibernate.DOUBLE) );
- registerFunction("radian", new StandardSQLFunction("dradian", Hibernate.DOUBLE) );
- registerFunction("dsin", new StandardSQLFunction("dsin", Hibernate.DOUBLE) );
- registerFunction("sin", new StandardSQLFunction("dsin", Hibernate.DOUBLE) );
- registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
- registerFunction("dsqrt", new StandardSQLFunction("dsqrt", Hibernate.DOUBLE) );
- registerFunction("sqrt", new StandardSQLFunction("dsqrt", Hibernate.DOUBLE) );
- registerFunction("dtan", new StandardSQLFunction("dtan", Hibernate.DOUBLE) );
- registerFunction("tan", new StandardSQLFunction("dtan", Hibernate.DOUBLE) );
+ registerFunction("dacos", new StandardSQLFunction("dacos", StandardBasicTypes.DOUBLE) );
+ registerFunction("acos", new StandardSQLFunction("dacos", StandardBasicTypes.DOUBLE) );
+ registerFunction("dasin", new StandardSQLFunction("dasin", StandardBasicTypes.DOUBLE) );
+ registerFunction("asin", new StandardSQLFunction("dasin", StandardBasicTypes.DOUBLE) );
+ registerFunction("datan", new StandardSQLFunction("datan", StandardBasicTypes.DOUBLE) );
+ registerFunction("atan", new StandardSQLFunction("datan", StandardBasicTypes.DOUBLE) );
+ registerFunction("datan2", new StandardSQLFunction("datan2", StandardBasicTypes.DOUBLE) );
+ registerFunction("atan2", new StandardSQLFunction("datan2", StandardBasicTypes.DOUBLE) );
+ registerFunction("dcos", new StandardSQLFunction("dcos", StandardBasicTypes.DOUBLE) );
+ registerFunction("cos", new StandardSQLFunction("dcos", StandardBasicTypes.DOUBLE) );
+ registerFunction("dcot", new StandardSQLFunction("dcot", StandardBasicTypes.DOUBLE) );
+ registerFunction("cot", new StandardSQLFunction("dcot", StandardBasicTypes.DOUBLE) );
+ registerFunction("ddegrees", new StandardSQLFunction("ddegrees", StandardBasicTypes.DOUBLE) );
+ registerFunction("degrees", new StandardSQLFunction("ddegrees", StandardBasicTypes.DOUBLE) );
+ registerFunction("dexp", new StandardSQLFunction("dexp", StandardBasicTypes.DOUBLE) );
+ registerFunction("exp", new StandardSQLFunction("dexp", StandardBasicTypes.DOUBLE) );
+ registerFunction("dlog", new StandardSQLFunction("dlog", StandardBasicTypes.DOUBLE) );
+ registerFunction("log", new StandardSQLFunction("dlog", StandardBasicTypes.DOUBLE) );
+ registerFunction("dlog10", new StandardSQLFunction("dlog10", StandardBasicTypes.DOUBLE) );
+ registerFunction("log10", new StandardSQLFunction("dlog10", StandardBasicTypes.DOUBLE) );
+ registerFunction("dradian", new StandardSQLFunction("dradian", StandardBasicTypes.DOUBLE) );
+ registerFunction("radian", new StandardSQLFunction("dradian", StandardBasicTypes.DOUBLE) );
+ registerFunction("dsin", new StandardSQLFunction("dsin", StandardBasicTypes.DOUBLE) );
+ registerFunction("sin", new StandardSQLFunction("dsin", StandardBasicTypes.DOUBLE) );
+ registerFunction("soundex", new StandardSQLFunction("soundex", StandardBasicTypes.STRING) );
+ registerFunction("dsqrt", new StandardSQLFunction("dsqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction("sqrt", new StandardSQLFunction("dsqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction("dtan", new StandardSQLFunction("dtan", StandardBasicTypes.DOUBLE) );
+ registerFunction("tan", new StandardSQLFunction("dtan", StandardBasicTypes.DOUBLE) );
registerFunction("dpower", new StandardSQLFunction("dpower") );
registerFunction("power", new StandardSQLFunction("dpower") );
- registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
- registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
- registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
- registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
+ registerFunction("date", new StandardSQLFunction("date", StandardBasicTypes.DATE) );
+ registerFunction("dayofweek", new StandardSQLFunction("dayofweek", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofyear", new StandardSQLFunction("dayofyear", StandardBasicTypes.INTEGER) );
+ registerFunction("time", new StandardSQLFunction("time", StandardBasicTypes.TIME) );
+ registerFunction("timestamp", new StandardSQLFunction("timestamp", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("week", new StandardSQLFunction("week", StandardBasicTypes.INTEGER) );
- registerFunction("varchar", new StandardSQLFunction("varchar", Hibernate.STRING) );
- registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
- registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
- registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
- registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
- registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );
+ registerFunction("varchar", new StandardSQLFunction("varchar", StandardBasicTypes.STRING) );
+ registerFunction("real", new StandardSQLFunction("real", StandardBasicTypes.FLOAT) );
+ registerFunction("bigint", new StandardSQLFunction("bigint", StandardBasicTypes.LONG) );
+ registerFunction("char", new StandardSQLFunction("char", StandardBasicTypes.CHARACTER) );
+ registerFunction("integer", new StandardSQLFunction("integer", StandardBasicTypes.INTEGER) );
+ registerFunction("smallint", new StandardSQLFunction("smallint", StandardBasicTypes.SHORT) );
- registerFunction("ascii_char", new StandardSQLFunction("ascii_char", Hibernate.CHARACTER) );
- registerFunction("ascii_code", new StandardSQLFunction("ascii_code", Hibernate.STRING));
- registerFunction("unicode_char", new StandardSQLFunction("unicode_char", Hibernate.LONG));
- registerFunction("unicode_code", new StandardSQLFunction("unicode_code", Hibernate.STRING));
+ registerFunction("ascii_char", new StandardSQLFunction("ascii_char", StandardBasicTypes.CHARACTER) );
+ registerFunction("ascii_code", new StandardSQLFunction("ascii_code", StandardBasicTypes.STRING));
+ registerFunction("unicode_char", new StandardSQLFunction("unicode_char", StandardBasicTypes.LONG));
+ registerFunction("unicode_code", new StandardSQLFunction("unicode_code", StandardBasicTypes.STRING));
registerFunction("upper", new StandardSQLFunction("upper") );
registerFunction("lower", new StandardSQLFunction("lower") );
- registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
- registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.STRING));
+ registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.LONG) );
+ registerFunction("bit_length", new StandardSQLFunction("bit_length", StandardBasicTypes.STRING));
getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, "50");
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5InnoDBDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5InnoDBDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MySQL5InnoDBDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MySQLDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -29,11 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
-import org.hibernate.Hibernate;
-import org.hibernate.LockOptions;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
@@ -71,108 +69,108 @@
// registerColumnType( Types.CLOB, 65535, "text" );
registerVarcharTypes();
- registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
- registerFunction("bin", new StandardSQLFunction("bin", Hibernate.STRING) );
- registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
- registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.LONG) );
+ registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
+ registerFunction("bin", new StandardSQLFunction("bin", StandardBasicTypes.STRING) );
+ registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.LONG) );
+ registerFunction("character_length", new StandardSQLFunction("character_length", StandardBasicTypes.LONG) );
registerFunction("lcase", new StandardSQLFunction("lcase") );
registerFunction("lower", new StandardSQLFunction("lower") );
registerFunction("ltrim", new StandardSQLFunction("ltrim") );
- registerFunction("ord", new StandardSQLFunction("ord", Hibernate.INTEGER) );
+ registerFunction("ord", new StandardSQLFunction("ord", StandardBasicTypes.INTEGER) );
registerFunction("quote", new StandardSQLFunction("quote") );
registerFunction("reverse", new StandardSQLFunction("reverse") );
registerFunction("rtrim", new StandardSQLFunction("rtrim") );
registerFunction("soundex", new StandardSQLFunction("soundex") );
- registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
+ registerFunction("space", new StandardSQLFunction("space", StandardBasicTypes.STRING) );
registerFunction("ucase", new StandardSQLFunction("ucase") );
registerFunction("upper", new StandardSQLFunction("upper") );
- registerFunction("unhex", new StandardSQLFunction("unhex", Hibernate.STRING) );
+ registerFunction("unhex", new StandardSQLFunction("unhex", StandardBasicTypes.STRING) );
registerFunction("abs", new StandardSQLFunction("abs") );
- registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
- registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
- registerFunction("crc32", new StandardSQLFunction("crc32", Hibernate.LONG) );
- registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
- registerFunction("log2", new StandardSQLFunction("log2", Hibernate.DOUBLE) );
- registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
- registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
- registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
- registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
+ registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction("cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE) );
+ registerFunction("crc32", new StandardSQLFunction("crc32", StandardBasicTypes.LONG) );
+ registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE) );
+ registerFunction("log2", new StandardSQLFunction("log2", StandardBasicTypes.DOUBLE) );
+ registerFunction("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
+ registerFunction("pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE) );
+ registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE) );
+ registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
- registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
- registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
+ registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
+ registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
- registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.INTEGER) );
- registerFunction("ceil", new StandardSQLFunction("ceil", Hibernate.INTEGER) );
- registerFunction("floor", new StandardSQLFunction("floor", Hibernate.INTEGER) );
+ registerFunction("ceiling", new StandardSQLFunction("ceiling", StandardBasicTypes.INTEGER) );
+ registerFunction("ceil", new StandardSQLFunction("ceil", StandardBasicTypes.INTEGER) );
+ registerFunction("floor", new StandardSQLFunction("floor", StandardBasicTypes.INTEGER) );
registerFunction("round", new StandardSQLFunction("round") );
- registerFunction("datediff", new StandardSQLFunction("datediff", Hibernate.INTEGER) );
- registerFunction("timediff", new StandardSQLFunction("timediff", Hibernate.TIME) );
- registerFunction("date_format", new StandardSQLFunction("date_format", Hibernate.STRING) );
+ registerFunction("datediff", new StandardSQLFunction("datediff", StandardBasicTypes.INTEGER) );
+ registerFunction("timediff", new StandardSQLFunction("timediff", StandardBasicTypes.TIME) );
+ registerFunction("date_format", new StandardSQLFunction("date_format", StandardBasicTypes.STRING) );
- registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE) );
- registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME) );
- registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
- registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false) );
- registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
- registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
- registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
- registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
- registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
- registerFunction("from_days", new StandardSQLFunction("from_days", Hibernate.DATE) );
- registerFunction("from_unixtime", new StandardSQLFunction("from_unixtime", Hibernate.TIMESTAMP) );
- registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
- registerFunction("last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
- registerFunction("localtime", new NoArgSQLFunction("localtime", Hibernate.TIMESTAMP) );
- registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", Hibernate.TIMESTAMP) );
- registerFunction("microseconds", new StandardSQLFunction("microseconds", Hibernate.INTEGER) );
- registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
- registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
- registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
- registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP) );
- registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
- registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
- registerFunction("sec_to_time", new StandardSQLFunction("sec_to_time", Hibernate.TIME) );
- registerFunction("sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP) );
- registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
- registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
- registerFunction("time_to_sec", new StandardSQLFunction("time_to_sec", Hibernate.INTEGER) );
- registerFunction("to_days", new StandardSQLFunction("to_days", Hibernate.LONG) );
- registerFunction("unix_timestamp", new StandardSQLFunction("unix_timestamp", Hibernate.LONG) );
- registerFunction("utc_date", new NoArgSQLFunction("utc_date", Hibernate.STRING) );
- registerFunction("utc_time", new NoArgSQLFunction("utc_time", Hibernate.STRING) );
- registerFunction("utc_timestamp", new NoArgSQLFunction("utc_timestamp", Hibernate.STRING) );
- registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
- registerFunction("weekday", new StandardSQLFunction("weekday", Hibernate.INTEGER) );
- registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );
- registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
- registerFunction("yearweek", new StandardSQLFunction("yearweek", Hibernate.INTEGER) );
+ registerFunction("curdate", new NoArgSQLFunction("curdate", StandardBasicTypes.DATE) );
+ registerFunction("curtime", new NoArgSQLFunction("curtime", StandardBasicTypes.TIME) );
+ registerFunction("current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false) );
+ registerFunction("current_time", new NoArgSQLFunction("current_time", StandardBasicTypes.TIME, false) );
+ registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false) );
+ registerFunction("date", new StandardSQLFunction("date", StandardBasicTypes.DATE) );
+ registerFunction("day", new StandardSQLFunction("day", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", StandardBasicTypes.INTEGER) );
+ registerFunction("dayname", new StandardSQLFunction("dayname", StandardBasicTypes.STRING) );
+ registerFunction("dayofweek", new StandardSQLFunction("dayofweek", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofyear", new StandardSQLFunction("dayofyear", StandardBasicTypes.INTEGER) );
+ registerFunction("from_days", new StandardSQLFunction("from_days", StandardBasicTypes.DATE) );
+ registerFunction("from_unixtime", new StandardSQLFunction("from_unixtime", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("hour", new StandardSQLFunction("hour", StandardBasicTypes.INTEGER) );
+ registerFunction("last_day", new StandardSQLFunction("last_day", StandardBasicTypes.DATE) );
+ registerFunction("localtime", new NoArgSQLFunction("localtime", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("microseconds", new StandardSQLFunction("microseconds", StandardBasicTypes.INTEGER) );
+ registerFunction("minute", new StandardSQLFunction("minute", StandardBasicTypes.INTEGER) );
+ registerFunction("month", new StandardSQLFunction("month", StandardBasicTypes.INTEGER) );
+ registerFunction("monthname", new StandardSQLFunction("monthname", StandardBasicTypes.STRING) );
+ registerFunction("now", new NoArgSQLFunction("now", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("quarter", new StandardSQLFunction("quarter", StandardBasicTypes.INTEGER) );
+ registerFunction("second", new StandardSQLFunction("second", StandardBasicTypes.INTEGER) );
+ registerFunction("sec_to_time", new StandardSQLFunction("sec_to_time", StandardBasicTypes.TIME) );
+ registerFunction("sysdate", new NoArgSQLFunction("sysdate", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("time", new StandardSQLFunction("time", StandardBasicTypes.TIME) );
+ registerFunction("timestamp", new StandardSQLFunction("timestamp", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("time_to_sec", new StandardSQLFunction("time_to_sec", StandardBasicTypes.INTEGER) );
+ registerFunction("to_days", new StandardSQLFunction("to_days", StandardBasicTypes.LONG) );
+ registerFunction("unix_timestamp", new StandardSQLFunction("unix_timestamp", StandardBasicTypes.LONG) );
+ registerFunction("utc_date", new NoArgSQLFunction("utc_date", StandardBasicTypes.STRING) );
+ registerFunction("utc_time", new NoArgSQLFunction("utc_time", StandardBasicTypes.STRING) );
+ registerFunction("utc_timestamp", new NoArgSQLFunction("utc_timestamp", StandardBasicTypes.STRING) );
+ registerFunction("week", new StandardSQLFunction("week", StandardBasicTypes.INTEGER) );
+ registerFunction("weekday", new StandardSQLFunction("weekday", StandardBasicTypes.INTEGER) );
+ registerFunction("weekofyear", new StandardSQLFunction("weekofyear", StandardBasicTypes.INTEGER) );
+ registerFunction("year", new StandardSQLFunction("year", StandardBasicTypes.INTEGER) );
+ registerFunction("yearweek", new StandardSQLFunction("yearweek", StandardBasicTypes.INTEGER) );
- registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
- registerFunction("oct", new StandardSQLFunction("oct", Hibernate.STRING) );
+ registerFunction("hex", new StandardSQLFunction("hex", StandardBasicTypes.STRING) );
+ registerFunction("oct", new StandardSQLFunction("oct", StandardBasicTypes.STRING) );
- registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );
- registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.LONG) );
+ registerFunction("octet_length", new StandardSQLFunction("octet_length", StandardBasicTypes.LONG) );
+ registerFunction("bit_length", new StandardSQLFunction("bit_length", StandardBasicTypes.LONG) );
- registerFunction("bit_count", new StandardSQLFunction("bit_count", Hibernate.LONG) );
- registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.STRING) );
- registerFunction("md5", new StandardSQLFunction("md5", Hibernate.STRING) );
- registerFunction("sha1", new StandardSQLFunction("sha1", Hibernate.STRING) );
- registerFunction("sha", new StandardSQLFunction("sha", Hibernate.STRING) );
+ registerFunction("bit_count", new StandardSQLFunction("bit_count", StandardBasicTypes.LONG) );
+ registerFunction("encrypt", new StandardSQLFunction("encrypt", StandardBasicTypes.STRING) );
+ registerFunction("md5", new StandardSQLFunction("md5", StandardBasicTypes.STRING) );
+ registerFunction("sha1", new StandardSQLFunction("sha1", StandardBasicTypes.STRING) );
+ registerFunction("sha", new StandardSQLFunction("sha", StandardBasicTypes.STRING) );
- registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );
+ registerFunction( "concat", new StandardSQLFunction( "concat", StandardBasicTypes.STRING ) );
getDefaultProperties().setProperty(Environment.MAX_FETCH_DEPTH, "2");
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MySQLInnoDBDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MySQLInnoDBDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MySQLInnoDBDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/MySQLMyISAMDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/MySQLMyISAMDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/MySQLMyISAMDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -39,8 +38,8 @@
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.NvlFunction;
-import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
@@ -108,83 +107,83 @@
protected void registerFunctions() {
registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
- registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
- registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
- registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
- registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
- registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
+ registerFunction( "acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction( "ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "variance", new StandardSQLFunction("variance", StandardBasicTypes.DOUBLE) );
registerFunction( "round", new StandardSQLFunction("round") );
registerFunction( "trunc", new StandardSQLFunction("trunc") );
registerFunction( "ceil", new StandardSQLFunction("ceil") );
registerFunction( "floor", new StandardSQLFunction("floor") );
- registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
+ registerFunction( "chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
registerFunction( "initcap", new StandardSQLFunction("initcap") );
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
registerFunction( "soundex", new StandardSQLFunction("soundex") );
registerFunction( "upper", new StandardSQLFunction("upper") );
- registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
+ registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
- registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
- registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );
+ registerFunction( "to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
+ registerFunction( "to_date", new StandardSQLFunction("to_date", StandardBasicTypes.TIMESTAMP) );
- 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( "current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false) );
+ registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIME, false) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false) );
- registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
- registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
- registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
- registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
- registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
+ registerFunction( "last_day", new StandardSQLFunction("last_day", StandardBasicTypes.DATE) );
+ registerFunction( "sysdate", new NoArgSQLFunction("sysdate", StandardBasicTypes.DATE, false) );
+ registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", StandardBasicTypes.TIMESTAMP, false) );
+ registerFunction( "uid", new NoArgSQLFunction("uid", StandardBasicTypes.INTEGER, false) );
+ registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false) );
- registerFunction( "rowid", new NoArgSQLFunction("rowid", Hibernate.LONG, false) );
- registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, false) );
+ registerFunction( "rowid", new NoArgSQLFunction("rowid", StandardBasicTypes.LONG, false) );
+ registerFunction( "rownum", new NoArgSQLFunction("rownum", StandardBasicTypes.LONG, false) );
// Multi-param string dialect functions...
- registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
- registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
- registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
- registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
- registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
- registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
- registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
- registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
- registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
+ registerFunction( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
+ registerFunction( "instr", new StandardSQLFunction("instr", StandardBasicTypes.INTEGER) );
+ registerFunction( "instrb", new StandardSQLFunction("instrb", StandardBasicTypes.INTEGER) );
+ registerFunction( "lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING) );
+ registerFunction( "replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING) );
+ registerFunction( "rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING) );
+ registerFunction( "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING) );
+ registerFunction( "substrb", new StandardSQLFunction("substrb", StandardBasicTypes.STRING) );
+ registerFunction( "translate", new StandardSQLFunction("translate", StandardBasicTypes.STRING) );
- registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
+ registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "instr(?2,?1)" ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "vsize(?1)*8" ) );
registerFunction( "coalesce", new NvlFunction() );
// Multi-param numeric dialect functions...
- registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.FLOAT) );
- registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
- registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
+ registerFunction( "atan2", new StandardSQLFunction("atan2", StandardBasicTypes.FLOAT) );
+ registerFunction( "log", new StandardSQLFunction("log", StandardBasicTypes.INTEGER) );
+ registerFunction( "mod", new StandardSQLFunction("mod", StandardBasicTypes.INTEGER) );
registerFunction( "nvl", new StandardSQLFunction("nvl") );
registerFunction( "nvl2", new StandardSQLFunction("nvl2") );
- registerFunction( "power", new StandardSQLFunction("power", Hibernate.FLOAT) );
+ registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT) );
// Multi-param date dialect functions...
- registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
- registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
- registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );
+ registerFunction( "add_months", new StandardSQLFunction("add_months", StandardBasicTypes.DATE) );
+ registerFunction( "months_between", new StandardSQLFunction("months_between", StandardBasicTypes.FLOAT) );
+ registerFunction( "next_day", new StandardSQLFunction("next_day", StandardBasicTypes.DATE) );
- registerFunction( "str", new StandardSQLFunction("to_char", Hibernate.STRING) );
+ registerFunction( "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
}
protected void registerDefaultProperties() {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -32,7 +31,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.hibernate.Hibernate;
+
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
@@ -43,6 +42,7 @@
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
/**
@@ -87,83 +87,83 @@
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
- registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
- registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
- registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
- registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
- registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
+ registerFunction( "acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction( "ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "variance", new StandardSQLFunction("variance", StandardBasicTypes.DOUBLE) );
registerFunction( "round", new StandardSQLFunction("round") );
registerFunction( "trunc", new StandardSQLFunction("trunc") );
registerFunction( "ceil", new StandardSQLFunction("ceil") );
registerFunction( "floor", new StandardSQLFunction("floor") );
- registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
+ registerFunction( "chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
registerFunction( "initcap", new StandardSQLFunction("initcap") );
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
registerFunction( "soundex", new StandardSQLFunction("soundex") );
registerFunction( "upper", new StandardSQLFunction("upper") );
- registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
+ registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
- registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
- registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );
+ registerFunction( "to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
+ registerFunction( "to_date", new StandardSQLFunction("to_date", StandardBasicTypes.TIMESTAMP) );
- 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( "current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false) );
+ registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIME, false) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false) );
- registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
- registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
- registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
- registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
- registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
+ registerFunction( "last_day", new StandardSQLFunction("last_day", StandardBasicTypes.DATE) );
+ registerFunction( "sysdate", new NoArgSQLFunction("sysdate", StandardBasicTypes.DATE, false) );
+ registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", StandardBasicTypes.TIMESTAMP, false) );
+ registerFunction( "uid", new NoArgSQLFunction("uid", StandardBasicTypes.INTEGER, false) );
+ registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false) );
- registerFunction( "rowid", new NoArgSQLFunction("rowid", Hibernate.LONG, false) );
- registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, false) );
+ registerFunction( "rowid", new NoArgSQLFunction("rowid", StandardBasicTypes.LONG, false) );
+ registerFunction( "rownum", new NoArgSQLFunction("rownum", StandardBasicTypes.LONG, false) );
// Multi-param string dialect functions...
- registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
- registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
- registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
- registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
- registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
- registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
- registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
- registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
- registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
+ registerFunction( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
+ registerFunction( "instr", new StandardSQLFunction("instr", StandardBasicTypes.INTEGER) );
+ registerFunction( "instrb", new StandardSQLFunction("instrb", StandardBasicTypes.INTEGER) );
+ registerFunction( "lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING) );
+ registerFunction( "replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING) );
+ registerFunction( "rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING) );
+ registerFunction( "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING) );
+ registerFunction( "substrb", new StandardSQLFunction("substrb", StandardBasicTypes.STRING) );
+ registerFunction( "translate", new StandardSQLFunction("translate", StandardBasicTypes.STRING) );
- registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
+ registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "instr(?2,?1)" ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "vsize(?1)*8" ) );
registerFunction( "coalesce", new NvlFunction() );
// Multi-param numeric dialect functions...
- registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.FLOAT) );
- registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
- registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
+ registerFunction( "atan2", new StandardSQLFunction("atan2", StandardBasicTypes.FLOAT) );
+ registerFunction( "log", new StandardSQLFunction("log", StandardBasicTypes.INTEGER) );
+ registerFunction( "mod", new StandardSQLFunction("mod", StandardBasicTypes.INTEGER) );
registerFunction( "nvl", new StandardSQLFunction("nvl") );
registerFunction( "nvl2", new StandardSQLFunction("nvl2") );
- registerFunction( "power", new StandardSQLFunction("power", Hibernate.FLOAT) );
+ registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT) );
// Multi-param date dialect functions...
- registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
- registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
- registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );
+ registerFunction( "add_months", new StandardSQLFunction("add_months", StandardBasicTypes.DATE) );
+ registerFunction( "months_between", new StandardSQLFunction("months_between", StandardBasicTypes.FLOAT) );
+ registerFunction( "next_day", new StandardSQLFunction("next_day", StandardBasicTypes.DATE) );
- registerFunction( "str", new StandardSQLFunction("to_char", Hibernate.STRING) );
+ registerFunction( "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
}
public String getAddColumnString() {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -33,7 +32,7 @@
/**
* A dialect for Oracle 9i databases.
* <p/>
- * Unlike the older (deprecated) {@Link Oracl9Dialect), this version specifies
+ * Unlike the older (deprecated) {@link Oracle9Dialect), this version specifies
* to not use "ANSI join syntax" because 9i does not seem to properly
* handle it in all cases.
*
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/OracleDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/OracleDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/OracleDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/PointbaseDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/PointbaseDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/PointbaseDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/PostgresPlusDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/PostgresPlusDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/PostgresPlusDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -29,10 +28,10 @@
import java.sql.CallableStatement;
import java.sql.ResultSet;
-import org.hibernate.Hibernate;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.NvlFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for Postgres Plus
@@ -47,24 +46,24 @@
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex" ) );
- registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.DATE, false ) );
- registerFunction( "rowid", new NoArgSQLFunction( "rowid", Hibernate.LONG, false ) );
- registerFunction( "rownum", new NoArgSQLFunction( "rownum", Hibernate.LONG, false ) );
- registerFunction( "instr", new StandardSQLFunction( "instr", Hibernate.INTEGER ) );
- registerFunction( "lpad", new StandardSQLFunction( "lpad", Hibernate.STRING ) );
- registerFunction( "replace", new StandardSQLFunction( "replace", Hibernate.STRING ) );
- registerFunction( "rpad", new StandardSQLFunction( "rpad", Hibernate.STRING ) );
- registerFunction( "translate", new StandardSQLFunction( "translate", Hibernate.STRING ) );
- registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
+ registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
+ registerFunction( "rowid", new NoArgSQLFunction( "rowid", StandardBasicTypes.LONG, false ) );
+ registerFunction( "rownum", new NoArgSQLFunction( "rownum", StandardBasicTypes.LONG, false ) );
+ registerFunction( "instr", new StandardSQLFunction( "instr", StandardBasicTypes.INTEGER ) );
+ registerFunction( "lpad", new StandardSQLFunction( "lpad", StandardBasicTypes.STRING ) );
+ registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
+ registerFunction( "rpad", new StandardSQLFunction( "rpad", StandardBasicTypes.STRING ) );
+ registerFunction( "translate", new StandardSQLFunction( "translate", StandardBasicTypes.STRING ) );
+ registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
registerFunction( "coalesce", new NvlFunction() );
- registerFunction( "atan2", new StandardSQLFunction( "atan2", Hibernate.FLOAT ) );
- registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
+ registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.FLOAT ) );
+ registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
registerFunction( "nvl", new StandardSQLFunction( "nvl" ) );
registerFunction( "nvl2", new StandardSQLFunction( "nvl2" ) );
- registerFunction( "power", new StandardSQLFunction( "power", Hibernate.FLOAT ) );
- registerFunction( "add_months", new StandardSQLFunction( "add_months", Hibernate.DATE ) );
- registerFunction( "months_between", new StandardSQLFunction( "months_between", Hibernate.FLOAT ) );
- registerFunction( "next_day", new StandardSQLFunction( "next_day", Hibernate.DATE ) );
+ registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.FLOAT ) );
+ registerFunction( "add_months", new StandardSQLFunction( "add_months", StandardBasicTypes.DATE ) );
+ registerFunction( "months_between", new StandardSQLFunction( "months_between", StandardBasicTypes.FLOAT ) );
+ registerFunction( "next_day", new StandardSQLFunction( "next_day", StandardBasicTypes.DATE ) );
}
public String getCurrentTimestampSelectString() {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/ProgressDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/ProgressDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/ProgressDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -73,10 +72,3 @@
return false;
}
}
-
-
-
-
-
-
-
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -35,6 +34,8 @@
import org.hibernate.persister.entity.Lockable;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.DecodeCaseFragment;
+import org.hibernate.type.StandardBasicTypes;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,19 +69,19 @@
* string is provided, plus an optional hasParenthesesIfNoArgs flag.
*/
registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
- registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
- registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.INTEGER) );
- registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.INTEGER) );
+ registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
+ registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.INTEGER) );
+ registerFunction("character_length", new StandardSQLFunction("character_length", StandardBasicTypes.INTEGER) );
// The RDMS concat() function only supports 2 parameters
- registerFunction( "concat", new SQLFunctionTemplate(Hibernate.STRING, "concat(?1, ?2)") );
- registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.STRING) );
- registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
- registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
- registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
- registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
+ registerFunction( "concat", new SQLFunctionTemplate(StandardBasicTypes.STRING, "concat(?1, ?2)") );
+ registerFunction( "instr", new StandardSQLFunction("instr", StandardBasicTypes.STRING) );
+ registerFunction( "lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING) );
+ registerFunction( "replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING) );
+ registerFunction( "rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING) );
+ registerFunction( "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING) );
registerFunction("lcase", new StandardSQLFunction("lcase") );
registerFunction("lower", new StandardSQLFunction("lower") );
@@ -89,68 +90,68 @@
registerFunction("rtrim", new StandardSQLFunction("rtrim") );
// RDMS does not directly support the trim() function, we use rtrim() and ltrim()
- registerFunction("trim", new SQLFunctionTemplate(Hibernate.INTEGER, "ltrim(rtrim(?1))" ) );
+ registerFunction("trim", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "ltrim(rtrim(?1))" ) );
registerFunction("soundex", new StandardSQLFunction("soundex") );
- registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
+ registerFunction("space", new StandardSQLFunction("space", StandardBasicTypes.STRING) );
registerFunction("ucase", new StandardSQLFunction("ucase") );
registerFunction("upper", new StandardSQLFunction("upper") );
- registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
- registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
- registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
- registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
- registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
- registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
- registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
- registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
+ registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction("cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE) );
+ registerFunction("cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE) );
+ registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE) );
+ registerFunction("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
+ registerFunction("pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE) );
+ registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE) );
+ registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction("sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
+ registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
+ registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
+ registerFunction("tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE) );
registerFunction( "round", new StandardSQLFunction("round") );
registerFunction( "trunc", new StandardSQLFunction("trunc") );
registerFunction( "ceil", new StandardSQLFunction("ceil") );
registerFunction( "floor", new StandardSQLFunction("floor") );
- registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
+ registerFunction( "chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
registerFunction( "initcap", new StandardSQLFunction("initcap") );
- registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
+ registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false) );
- 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("curdate", new NoArgSQLFunction("curdate",Hibernate.DATE) );
- registerFunction("curtime", new NoArgSQLFunction("curtime",Hibernate.TIME) );
- registerFunction("days", new StandardSQLFunction("days",Hibernate.INTEGER) );
- registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth",Hibernate.INTEGER) );
- registerFunction("dayname", new StandardSQLFunction("dayname",Hibernate.STRING) );
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek",Hibernate.INTEGER) );
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear",Hibernate.INTEGER) );
- registerFunction("hour", new StandardSQLFunction("hour",Hibernate.INTEGER) );
- registerFunction("last_day", new StandardSQLFunction("last_day",Hibernate.DATE) );
- registerFunction("microsecond", new StandardSQLFunction("microsecond",Hibernate.INTEGER) );
- registerFunction("minute", new StandardSQLFunction("minute",Hibernate.INTEGER) );
- registerFunction("month", new StandardSQLFunction("month",Hibernate.INTEGER) );
- registerFunction("monthname", new StandardSQLFunction("monthname",Hibernate.STRING) );
- registerFunction("now", new NoArgSQLFunction("now",Hibernate.TIMESTAMP) );
- registerFunction("quarter", new StandardSQLFunction("quarter",Hibernate.INTEGER) );
- registerFunction("second", new StandardSQLFunction("second",Hibernate.INTEGER) );
- registerFunction("time", new StandardSQLFunction("time",Hibernate.TIME) );
- registerFunction("timestamp", new StandardSQLFunction("timestamp",Hibernate.TIMESTAMP) );
- registerFunction("week", new StandardSQLFunction("week",Hibernate.INTEGER) );
- registerFunction("year", new StandardSQLFunction("year",Hibernate.INTEGER) );
+ registerFunction( "current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false) );
+ registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIME, false) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false) );
+ registerFunction("curdate", new NoArgSQLFunction("curdate",StandardBasicTypes.DATE) );
+ registerFunction("curtime", new NoArgSQLFunction("curtime",StandardBasicTypes.TIME) );
+ registerFunction("days", new StandardSQLFunction("days",StandardBasicTypes.INTEGER) );
+ registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth",StandardBasicTypes.INTEGER) );
+ registerFunction("dayname", new StandardSQLFunction("dayname",StandardBasicTypes.STRING) );
+ registerFunction("dayofweek", new StandardSQLFunction("dayofweek",StandardBasicTypes.INTEGER) );
+ registerFunction("dayofyear", new StandardSQLFunction("dayofyear",StandardBasicTypes.INTEGER) );
+ registerFunction("hour", new StandardSQLFunction("hour",StandardBasicTypes.INTEGER) );
+ registerFunction("last_day", new StandardSQLFunction("last_day",StandardBasicTypes.DATE) );
+ registerFunction("microsecond", new StandardSQLFunction("microsecond",StandardBasicTypes.INTEGER) );
+ registerFunction("minute", new StandardSQLFunction("minute",StandardBasicTypes.INTEGER) );
+ registerFunction("month", new StandardSQLFunction("month",StandardBasicTypes.INTEGER) );
+ registerFunction("monthname", new StandardSQLFunction("monthname",StandardBasicTypes.STRING) );
+ registerFunction("now", new NoArgSQLFunction("now",StandardBasicTypes.TIMESTAMP) );
+ registerFunction("quarter", new StandardSQLFunction("quarter",StandardBasicTypes.INTEGER) );
+ registerFunction("second", new StandardSQLFunction("second",StandardBasicTypes.INTEGER) );
+ registerFunction("time", new StandardSQLFunction("time",StandardBasicTypes.TIME) );
+ registerFunction("timestamp", new StandardSQLFunction("timestamp",StandardBasicTypes.TIMESTAMP) );
+ registerFunction("week", new StandardSQLFunction("week",StandardBasicTypes.INTEGER) );
+ registerFunction("year", new StandardSQLFunction("year",StandardBasicTypes.INTEGER) );
- registerFunction("atan2", new StandardSQLFunction("atan2",Hibernate.DOUBLE) );
- registerFunction( "mod", new StandardSQLFunction("mod",Hibernate.INTEGER) );
+ registerFunction("atan2", new StandardSQLFunction("atan2",StandardBasicTypes.DOUBLE) );
+ registerFunction( "mod", new StandardSQLFunction("mod",StandardBasicTypes.INTEGER) );
registerFunction( "nvl", new StandardSQLFunction("nvl") );
- registerFunction( "power", new StandardSQLFunction("power", Hibernate.DOUBLE) );
+ registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.DOUBLE) );
/**
* For a list of column types to register, see section A-1
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SAPDBDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,13 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
@@ -34,8 +32,7 @@
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.DecodeCaseFragment;
-import org.hibernate.sql.OracleJoinFragment;
-import org.hibernate.sql.JoinFragment;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
@@ -64,26 +61,26 @@
registerColumnType( Types.BLOB, "long byte" );
registerFunction( "abs", new StandardSQLFunction("abs") );
- registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
- registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction( "log", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
+ registerFunction( "exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
+ registerFunction( "ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction( "log", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
+ registerFunction( "pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE) );
registerFunction( "power", new StandardSQLFunction("power") );
- registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
- registerFunction( "cot", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
- registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
- registerFunction( "radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
- registerFunction( "degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
- registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE) );
+ registerFunction( "acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "cot", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
+ registerFunction( "sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
+ registerFunction( "tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE) );
+ registerFunction( "radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
+ registerFunction( "degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
+ registerFunction( "atan2", new StandardSQLFunction("atan2", StandardBasicTypes.DOUBLE) );
registerFunction( "round", new StandardSQLFunction("round") );
registerFunction( "trunc", new StandardSQLFunction("trunc") );
@@ -92,48 +89,48 @@
registerFunction( "greatest", new StandardSQLFunction("greatest") );
registerFunction( "least", new StandardSQLFunction("least") );
- registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
- registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
- registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
- registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
+ registerFunction("time", new StandardSQLFunction("time", StandardBasicTypes.TIME) );
+ registerFunction("timestamp", new StandardSQLFunction("timestamp", StandardBasicTypes.TIMESTAMP) );
+ registerFunction("date", new StandardSQLFunction("date", StandardBasicTypes.DATE) );
+ registerFunction("microsecond", new StandardSQLFunction("microsecond", StandardBasicTypes.INTEGER) );
- registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "second(?1)") );
- registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "minute(?1)") );
- registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "hour(?1)") );
- registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "day(?1)") );
- registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "month(?1)") );
- registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "year(?1)") );
+ registerFunction( "second", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "second(?1)") );
+ registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "minute(?1)") );
+ registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "hour(?1)") );
+ registerFunction( "day", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "day(?1)") );
+ registerFunction( "month", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "month(?1)") );
+ registerFunction( "year", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "year(?1)") );
- registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "?1(?3)") );
+ registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1(?3)") );
- registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
- registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
- registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
- registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );
+ registerFunction("dayname", new StandardSQLFunction("dayname", StandardBasicTypes.STRING) );
+ registerFunction("monthname", new StandardSQLFunction("monthname", StandardBasicTypes.STRING) );
+ registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofweek", new StandardSQLFunction("dayofweek", StandardBasicTypes.INTEGER) );
+ registerFunction("dayofyear", new StandardSQLFunction("dayofyear", StandardBasicTypes.INTEGER) );
+ registerFunction("weekofyear", new StandardSQLFunction("weekofyear", StandardBasicTypes.INTEGER) );
- registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
- registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
- registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
- registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
- registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
- registerFunction( "initcap", new StandardSQLFunction("initcap", Hibernate.STRING) );
- registerFunction( "lower", new StandardSQLFunction("lower", Hibernate.STRING) );
- registerFunction( "ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING) );
- registerFunction( "rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING) );
- registerFunction( "lfill", new StandardSQLFunction("ltrim", Hibernate.STRING) );
- registerFunction( "rfill", new StandardSQLFunction("rtrim", Hibernate.STRING) );
- registerFunction( "soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
- registerFunction( "upper", new StandardSQLFunction("upper", Hibernate.STRING) );
- registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.STRING) );
- registerFunction( "index", new StandardSQLFunction("index", Hibernate.INTEGER) );
+ registerFunction( "replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING) );
+ registerFunction( "translate", new StandardSQLFunction("translate", StandardBasicTypes.STRING) );
+ registerFunction( "lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING) );
+ registerFunction( "rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING) );
+ registerFunction( "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING) );
+ registerFunction( "initcap", new StandardSQLFunction("initcap", StandardBasicTypes.STRING) );
+ registerFunction( "lower", new StandardSQLFunction("lower", StandardBasicTypes.STRING) );
+ registerFunction( "ltrim", new StandardSQLFunction("ltrim", StandardBasicTypes.STRING) );
+ registerFunction( "rtrim", new StandardSQLFunction("rtrim", StandardBasicTypes.STRING) );
+ registerFunction( "lfill", new StandardSQLFunction("ltrim", StandardBasicTypes.STRING) );
+ registerFunction( "rfill", new StandardSQLFunction("rtrim", StandardBasicTypes.STRING) );
+ registerFunction( "soundex", new StandardSQLFunction("soundex", StandardBasicTypes.STRING) );
+ registerFunction( "upper", new StandardSQLFunction("upper", StandardBasicTypes.STRING) );
+ registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.STRING) );
+ registerFunction( "index", new StandardSQLFunction("index", StandardBasicTypes.INTEGER) );
registerFunction( "value", new StandardSQLFunction( "value" ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
- registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "locate", new StandardSQLFunction("index", Hibernate.INTEGER) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
+ registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "locate", new StandardSQLFunction("index", StandardBasicTypes.INTEGER) );
registerFunction( "coalesce", new StandardSQLFunction( "value" ) );
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SQLServer2008Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SQLServer2008Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SQLServer2008Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,17 +20,16 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* A dialect for Microsoft SQL Server 2000 and 2005
@@ -45,14 +44,14 @@
registerColumnType( Types.LONGVARBINARY, "image" );
registerColumnType( Types.LONGVARCHAR, "text" );
- registerFunction( "second", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(second, ?1)" ) );
- registerFunction( "minute", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(minute, ?1)" ) );
- registerFunction( "hour", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(hour, ?1)" ) );
- registerFunction( "locate", new StandardSQLFunction( "charindex", Hibernate.INTEGER ) );
+ registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(second, ?1)" ) );
+ registerFunction( "minute", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(minute, ?1)" ) );
+ registerFunction( "hour", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(hour, ?1)" ) );
+ registerFunction( "locate", new StandardSQLFunction( "charindex", StandardBasicTypes.INTEGER ) );
- registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
- registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );
+ registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(?1, ?3)" ) );
+ registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "?1 % ?2" ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datalength(?1) * 8" ) );
registerFunction( "trim", new AnsiTrimEmulationFunction() );
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Sybase11Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -25,9 +25,9 @@
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
+import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect targetting Sybase Adaptive Server Enterprise (ASE) 15 and higher.
@@ -43,12 +43,12 @@
registerColumnType( Types.LONGVARBINARY, "image" );
registerColumnType( Types.LONGVARCHAR, "text" );
- registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(second, ?1)") );
- registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
- registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
- registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
- registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );
+ registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(second, ?1)") );
+ registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datepart(minute, ?1)") );
+ registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datepart(hour, ?1)") );
+ registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(?1, ?3)" ) );
+ registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "?1 % ?2" ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datalength(?1) * 8" ) );
registerFunction( "trim", new AnsiTrimEmulationFunction( AnsiTrimEmulationFunction.LTRIM, AnsiTrimEmulationFunction.RTRIM, "str_replace" ) );
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,11 +1,10 @@
-//$Id $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -21,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
@@ -32,10 +30,10 @@
* {@link AbstractTransactSQLDialect} should be used as the base class for
* TransactSQL-based dialects.
*
+ * @deprecated use {@link AbstractTransactSQLDialect}, {@link SybaseASE15Dialect} or {@link SQLServerDialect}
+ * instead depending on need.
+ *
* @author Gail Badner
- * @deprecated use {@link AbstractTransactSQLDialect},
- * {@link SybaseASE15Dialect} or {@link SQLServerDialect} instead depending on
- * need.
*/
public class SybaseDialect extends AbstractTransactSQLDialect {
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/TeradataDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/TeradataDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/TeradataDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,17 +20,16 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
* A dialect for the Teradata database created by MCR as part of the
@@ -67,13 +66,13 @@
registerColumnType( Types.BLOB, "BLOB" );
registerColumnType( Types.CLOB, "CLOB" );
- registerFunction( "year", new SQLFunctionTemplate( Hibernate.INTEGER, "extract(year from ?1)" ) );
- registerFunction( "length", new SQLFunctionTemplate( Hibernate.INTEGER, "character_length(?1)" ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
- registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 from ?2 for ?3)" ) );
- registerFunction( "locate", new SQLFunctionTemplate( Hibernate.STRING, "position(?1 in ?2)" ) );
- registerFunction( "mod", new SQLFunctionTemplate( Hibernate.STRING, "?1 mod ?2" ) );
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as varchar(255))" ) );
+ registerFunction( "year", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "extract(year from ?1)" ) );
+ registerFunction( "length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "character_length(?1)" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
+ registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1 from ?2 for ?3)" ) );
+ registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.STRING, "position(?1 in ?2)" ) );
+ registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.STRING, "?1 mod ?2" ) );
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as varchar(255))" ) );
// bit_length feels a bit broken to me. We have to cast to char in order to
// pass when a numeric value is supplied. But of course the answers given will
@@ -81,16 +80,16 @@
// a char string but will be 8 or 16 bytes as a true numeric.
// Jay Nance 2006-09-22
registerFunction(
- "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(cast(?1 as char))*4" )
+ "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "octet_length(cast(?1 as char))*4" )
);
// The preference here would be
- // SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_timestamp(?1)", false)
+ // SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_timestamp(?1)", false)
// but this appears not to work.
// Jay Nance 2006-09-22
- registerFunction( "current_timestamp", new SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_timestamp" ) );
- registerFunction( "current_time", new SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_time" ) );
- registerFunction( "current_date", new SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_date" ) );
+ registerFunction( "current_timestamp", new SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_timestamp" ) );
+ registerFunction( "current_time", new SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_time" ) );
+ registerFunction( "current_date", new SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_date" ) );
// IBID for current_time and current_date
registerKeyword( "password" );
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/TimesTenDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/TimesTenDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/TimesTenDialect.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/TypeNames.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/TypeNames.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/TypeNames.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/AbstractAnsiTrimEmulationFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/AbstractAnsiTrimEmulationFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/AbstractAnsiTrimEmulationFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimEmulationFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimEmulationFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimEmulationFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,11 +20,10 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
-import org.hibernate.Hibernate;
+import org.hibernate.type.StandardBasicTypes;
/**
* A {@link SQLFunction} implementation that emulates the ANSI SQL trim function
@@ -162,43 +161,43 @@
*/
public AnsiTrimEmulationFunction(String ltrimFunctionName, String rtrimFunctionName, String replaceFunctionName) {
leadingSpaceTrim = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
LEADING_SPACE_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
);
trailingSpaceTrim = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
TRAILING_SPACE_TRIM_TEMPLATE.replaceAll( RTRIM, rtrimFunctionName )
);
bothSpaceTrim = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
BOTH_SPACE_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
);
bothSpaceTrimFrom = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
BOTH_SPACE_TRIM_FROM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
);
leadingTrim = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
LEADING_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
.replaceAll( REPLACE,replaceFunctionName )
);
trailingTrim = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
TRAILING_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
.replaceAll( REPLACE,replaceFunctionName )
);
bothTrim = new SQLFunctionTemplate(
- Hibernate.STRING,
+ StandardBasicTypes.STRING,
BOTH_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
.replaceAll( REPLACE,replaceFunctionName )
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/AnsiTrimFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,7 +1,7 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Inc. or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/CharIndexFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/CharIndexFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/CharIndexFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,16 +20,15 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
import java.util.List;
-import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@@ -46,7 +45,7 @@
}
public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
- return Hibernate.INTEGER;
+ return StandardBasicTypes.INTEGER;
}
public String render(Type columnType, List args, SessionFactoryImplementor factory) throws QueryException {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicAvgFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicAvgFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicAvgFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,16 +20,15 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
import java.sql.Types;
-import org.hibernate.Hibernate;
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@@ -54,7 +53,7 @@
if ( sqlTypes.length != 1 ) throw new QueryException( "multi-column type in avg()" );
int sqlType = sqlTypes[0];
if ( sqlType == Types.INTEGER || sqlType == Types.BIGINT || sqlType == Types.TINYINT ) {
- return Hibernate.FLOAT;
+ return StandardBasicTypes.FLOAT;
}
else {
return columnType;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicCountFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicCountFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicCountFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,15 +20,13 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
-import org.hibernate.Hibernate;
import org.hibernate.engine.Mapping;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
-
/**
* Classic COUNT sqlfunction that return types as it was done in Hibernate 3.1
*
@@ -41,6 +39,6 @@
}
public Type getReturnType(Type columnType, Mapping mapping) {
- return Hibernate.INTEGER;
+ return StandardBasicTypes.INTEGER;
}
}
\ No newline at end of file
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicSumFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicSumFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/ClassicSumFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,11 +20,9 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
-
/**
* Classic SUM sqlfunction that return types as it was done in Hibernate 3.1
*
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/ConditionalParenthesisFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/ConditionalParenthesisFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/ConditionalParenthesisFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/ConvertFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/ConvertFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/ConvertFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -26,9 +26,9 @@
import java.util.List;
import org.hibernate.QueryException;
-import org.hibernate.Hibernate;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@@ -47,7 +47,7 @@
}
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException {
- return Hibernate.STRING;
+ return StandardBasicTypes.STRING;
}
public String render(Type firstArgumentType, List args, SessionFactoryImplementor factory) throws QueryException {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/DerbyConcatFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/DerbyConcatFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/DerbyConcatFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
@@ -31,6 +30,7 @@
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@@ -72,7 +72,7 @@
* Here we always return {@link Hibernate#STRING}.
*/
public Type getReturnType(Type argumentType, Mapping mapping) throws QueryException {
- return Hibernate.STRING;
+ return StandardBasicTypes.STRING;
}
/**
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/NoArgSQLFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/NoArgSQLFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/NoArgSQLFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
@@ -31,9 +30,9 @@
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.Type;
-
/**
* A function which takes no arguments
+ *
* @author Michi
*/
public class NoArgSQLFunction implements SQLFunction {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/NvlFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/NvlFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/NvlFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/PositionSubstringFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/PositionSubstringFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/PositionSubstringFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -25,10 +25,10 @@
import java.util.List;
-import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@@ -45,7 +45,7 @@
}
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException {
- return Hibernate.INTEGER;
+ return StandardBasicTypes.INTEGER;
}
public String render(Type firstArgumentType, List args, SessionFactoryImplementor factory) throws QueryException {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/SQLFunctionRegistry.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/SQLFunctionRegistry.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/SQLFunctionRegistry.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
@@ -30,28 +29,28 @@
import org.hibernate.dialect.Dialect;
public class SQLFunctionRegistry {
-
private final Dialect dialect;
- private final Map userFunctions;
+ private final Map<String, SQLFunction> userFunctions;
- public SQLFunctionRegistry(Dialect dialect, Map userFunctions) {
+ public SQLFunctionRegistry(Dialect dialect, Map<String, SQLFunction> userFunctions) {
this.dialect = dialect;
- this.userFunctions = new HashMap();
+ this.userFunctions = new HashMap<String, SQLFunction>();
this.userFunctions.putAll( userFunctions );
}
public SQLFunction findSQLFunction(String functionName) {
+ // TODO: lower casing done here. Was done "at random" before; maybe not needed at all ?
String name = functionName.toLowerCase();
- SQLFunction userFunction = (SQLFunction) userFunctions.get( name );
-
- return userFunction!=null?userFunction:(SQLFunction) dialect.getFunctions().get(name); // TODO: lowercasing done here. Was done "at random" before; maybe not needed at all ?
+ SQLFunction userFunction = userFunctions.get( name );
+ return userFunction != null
+ ? userFunction
+ : (SQLFunction) dialect.getFunctions().get( name );
}
public boolean hasFunction(String functionName) {
+ // TODO: toLowerCase was not done before. Only used in Template.
String name = functionName.toLowerCase();
- boolean hasUserFunction = userFunctions.containsKey ( name );
-
- return hasUserFunction || dialect.getFunctions().containsKey ( name ); // TODO: toLowerCase was not done before. Only used in Template.
+ return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/StandardJDBCEscapeFunction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/StandardJDBCEscapeFunction.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/StandardJDBCEscapeFunction.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.function;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/TrimFunctionTemplate.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/TrimFunctionTemplate.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/TrimFunctionTemplate.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,7 +1,7 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Inc. or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
@@ -25,10 +25,10 @@
import java.util.List;
-import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@@ -46,7 +46,7 @@
}
public Type getReturnType(Type firstArgument, Mapping mapping) throws QueryException {
- return Hibernate.STRING;
+ return StandardBasicTypes.STRING;
}
public String render(Type firstArgument, List args, SessionFactoryImplementor factory) throws QueryException {
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/function/package.html
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/function/package.html 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/function/package.html 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
- ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are
- ~ distributed under license by Red Hat Middleware LLC.
+ ~ distributed under license by Red Hat Inc.
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
- ~
-->
<html>
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/lock/OptimisticLockingStrategy.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/lock/OptimisticLockingStrategy.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/lock/OptimisticLockingStrategy.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.lock;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.lock;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.lock;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.lock;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/package.html
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/package.html 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/package.html 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
- ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are
- ~ distributed under license by Red Hat Middleware LLC.
+ ~ distributed under license by Red Hat Inc.
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
- ~
-->
<html>
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/AbstractDialectResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/AbstractDialectResolver.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/AbstractDialectResolver.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.resolver;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicDialectResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicDialectResolver.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicDialectResolver.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.resolver;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicSQLExceptionConverter.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicSQLExceptionConverter.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/BasicSQLExceptionConverter.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.resolver;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectFactory.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectFactory.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.resolver;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolver.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolver.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.resolver;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolverSet.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolverSet.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/DialectResolverSet.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect.resolver;
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java 2010-08-26 19:11:48 UTC (rev 20269)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java 2010-08-26 20:24:12 UTC (rev 20270)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
- * third-party contributors as indicated by either @author tags or express
- * copyright attribution statements applied by the authors. All
- * third-party contributions are distributed under license by Red Hat Inc.
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
13 years, 8 months
Hibernate SVN: r20269 - in core/trunk: testsuite/src/test/java/org/hibernate/test/jpa/lock and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-26 15:11:48 -0400 (Thu, 26 Aug 2010)
New Revision: 20269
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/optlock/OptimisticLockTest.java
Log:
HHH-5335 - a few typo fixes in Dialect and in tests
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-08-26 18:53:07 UTC (rev 20268)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-08-26 19:11:48 UTC (rev 20269)
@@ -1798,7 +1798,7 @@
}
/**
- * Does the dialect support propogating changes to LOB
+ * Does the dialect support propagating 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...
@@ -1820,7 +1820,7 @@
* 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
+ * @return True if the changes are propagated back to the
* database; false otherwise.
* @since 3.2
*/
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2010-08-26 18:53:07 UTC (rev 20268)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2010-08-26 19:11:48 UTC (rev 20269)
@@ -147,7 +147,7 @@
public boolean supportsCircularCascadeDeleteConstraints() {
// SQL Server (at least up through 2005) does not support defining
- // cascade delete constraints which can circel back to the mutating
+ // cascade delete constraints which can circle back to the mutating
// table
return false;
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java 2010-08-26 18:53:07 UTC (rev 20268)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java 2010-08-26 19:11:48 UTC (rev 20269)
@@ -156,7 +156,7 @@
myEntity = (MyEntity) s1.get( MyEntity.class, myEntity.getId() );
s1.lock( myEntity, LockMode.FORCE );
- assertTrue( "LockMode.FORCE on a unversioned entity should degrade nicely to UPGRADE", true );
+ assertTrue( "LockMode.FORCE on a un-versioned entity should degrade nicely to UPGRADE", true );
s1.lock( item, LockMode.FORCE );
assertEquals( "subsequent LockMode.FORCE did not no-op", initialVersion + 1, item.getVersion() );
@@ -177,7 +177,7 @@
item2.setName( "updated" );
try {
t2.commit();
- fail( "optimisitc lock should have failed" );
+ fail( "optimistic lock should have failed" );
}
catch (Throwable ignore) {
// expected behavior
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/optlock/OptimisticLockTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/optlock/OptimisticLockTest.java 2010-08-26 18:53:07 UTC (rev 20268)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/optlock/OptimisticLockTest.java 2010-08-26 19:11:48 UTC (rev 20269)
@@ -1,4 +1,26 @@
-//$Id: OptimisticLockTest.java 11303 2007-03-19 22:06:14Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.test.optlock;
import junit.framework.Test;
@@ -12,7 +34,7 @@
import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite;
/**
- * Tests relating to the optimisitc-lock mapping option.
+ * Tests relating to the optimistic-lock mapping option.
*
* @author Gavin King
* @author Steve Ebersole
@@ -76,7 +98,7 @@
otherSession.close();
try {
- doc.setSummary( "A machiavelian achievement of epic proportions" );
+ doc.setSummary( "A machiavellian achievement of epic proportions" );
mainSession.flush();
fail( "expecting opt lock failure" );
}
@@ -110,6 +132,7 @@
mainSession.close();
}
+ @SuppressWarnings({ "UnnecessaryBoxing" })
private void testDeleteOptimisticLockFailure(String entityName) {
if ( getDialect().doesRepeatableReadCauseReadersToBlockWriters() ) {
reportSkip( "deadlock", "delete optimistic locking" );
@@ -127,7 +150,7 @@
mainSession.flush();
doc.setSummary( "A modern classic" );
mainSession.flush();
- doc.getPubDate().setMonth( new Integer( 3 ) );
+ doc.getPubDate().setMonth( Integer.valueOf( 3 ) );
mainSession.flush();
mainSession.getTransaction().commit();
mainSession.close();
13 years, 8 months
Hibernate SVN: r20268 - core/trunk/core/src/main/java/org/hibernate/dialect.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-26 14:53:07 -0400 (Thu, 26 Aug 2010)
New Revision: 20268
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java
Log:
HHH-5427 - derby 10.6.1.0 native sequence support broken
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java 2010-08-26 17:53:24 UTC (rev 20267)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/DerbyDialect.java 2010-08-26 18:53:07 UTC (rev 20268)
@@ -29,9 +29,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.hibernate.MappingException;
import org.hibernate.dialect.function.AnsiTrimFunction;
import org.hibernate.dialect.function.DerbyConcatFunction;
-import org.hibernate.id.TableHiLoGenerator;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.DerbyCaseFragment;
import org.hibernate.util.ReflectHelper;
@@ -57,7 +57,8 @@
determineDriverVersion();
}
- /*package*/ void determineDriverVersion() {
+ @SuppressWarnings({ "UnnecessaryUnboxing" })
+ private void determineDriverVersion() {
try {
// locate the derby sysinfo class and query its version info
final Class sysinfoClass = ReflectHelper.classForName( "org.apache.derby.tools.sysinfo", this.getClass() );
@@ -73,7 +74,7 @@
}
}
- /*package*/ boolean isTenPointFiveReleaseOrNewer() {
+ private boolean isTenPointFiveReleaseOrNewer() {
return driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 5 );
}
@@ -81,13 +82,6 @@
return ", ";
}
-// /**
-// * This is different in Cloudscape to DB2.
-// */
-// public String getIdentityColumnString() {
-// return "not null generated always as identity"; //$NON-NLS-1
-// }
-
/**
* Return the case statement modified for Cloudscape.
*/
@@ -99,14 +93,30 @@
return true;
}
-// public Class getNativeIdentifierGeneratorClass() {
-// return TableHiLoGenerator.class;
-// }
-
public boolean supportsSequences() {
- return false;
+ // technically sequence support was added in 10.6.1.0...
+ //
+ // The problem though is that I am not exactly sure how to differentiate 10.6.1.0 from any other 10.6.x release.
+ //
+ // http://db.apache.org/derby/docs/10.0/publishedapi/org/apache/derby/tools/... seems incorrect. It
+ // states that derby's versioning scheme is major.minor.maintenance, but obviously 10.6.1.0 has 4 components
+ // to it, not 3.
+ //
+ // Let alone the fact that it states that versions with the matching major.minor are 'feature
+ // compatible' which is clearly not the case here (sequence support is a new feature...)
+ return driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 6 );
}
+ @Override
+ public String getSequenceNextValString(String sequenceName) {
+ if ( supportsSequences() ) {
+ return "values next value for " + sequenceName;
+ }
+ else {
+ throw new MappingException( "Derby does not support sequence prior to release 10.6.1.0" );
+ }
+ }
+
public boolean supportsLimit() {
return isTenPointFiveReleaseOrNewer();
}
13 years, 8 months