Hibernate SVN: r18277 - in entitymanager/branches/v3_4_0_GA_CP/src: main and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-12-19 10:34:18 -0500 (Sat, 19 Dec 2009)
New Revision: 18277
Added:
entitymanager/branches/v3_4_0_GA_CP/src/main/resources/
Removed:
entitymanager/branches/v3_4_0_GA_CP/src/resources/
Log:
JBPAPP-3153 change the build tool of Hibernate EM(eap 5 cp branch)
Copied: entitymanager/branches/v3_4_0_GA_CP/src/main/resources (from rev 18274, entitymanager/branches/v3_4_0_GA_CP/src/resources)
14 years, 12 months
Hibernate SVN: r18276 - entitymanager/branches/v3_4_0_GA_CP/src.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-12-19 10:32:34 -0500 (Sat, 19 Dec 2009)
New Revision: 18276
Added:
entitymanager/branches/v3_4_0_GA_CP/src/main/
Removed:
entitymanager/branches/v3_4_0_GA_CP/src/filters/
Log:
JBPAPP-3153 change the build tool of Hibernate EM(eap 5 cp branch)
14 years, 12 months
Hibernate SVN: r18275 - entitymanager/branches/v3_4_0_GA_CP.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-12-19 10:31:20 -0500 (Sat, 19 Dec 2009)
New Revision: 18275
Removed:
entitymanager/branches/v3_4_0_GA_CP/build.properties.dist
entitymanager/branches/v3_4_0_GA_CP/common-build.xml
entitymanager/branches/v3_4_0_GA_CP/ivy.xml
entitymanager/branches/v3_4_0_GA_CP/ivy/
entitymanager/branches/v3_4_0_GA_CP/jdbc/
entitymanager/branches/v3_4_0_GA_CP/lib/
Modified:
entitymanager/branches/v3_4_0_GA_CP/build.xml
entitymanager/branches/v3_4_0_GA_CP/pom.xml
Log:
JBPAPP-3153 change the build tool of Hibernate EM(eap 5 cp branch)
Deleted: entitymanager/branches/v3_4_0_GA_CP/build.properties.dist
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/build.properties.dist 2009-12-19 10:27:10 UTC (rev 18274)
+++ entitymanager/branches/v3_4_0_GA_CP/build.properties.dist 2009-12-19 15:31:20 UTC (rev 18275)
@@ -1,5 +0,0 @@
-common.dir=.
-src.dir=src
-test.dir=test
-resources.dir=resources
-testresources.dir=test-resources
\ No newline at end of file
Modified: entitymanager/branches/v3_4_0_GA_CP/build.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/build.xml 2009-12-19 10:27:10 UTC (rev 18274)
+++ entitymanager/branches/v3_4_0_GA_CP/build.xml 2009-12-19 15:31:20 UTC (rev 18275)
@@ -1,135 +1,36 @@
<!-- $Id$ -->
<!--
-
Hibernate Entity Manager ANT build script.
-
- You need JDK 5.0 installed to build Hibernate EntityManager.
-
-->
-<project name="HibernateEntityManager" default="dist" basedir="."
- xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
- <property file="build.properties"/>
- <property file="${user.home}/.ant.properties"/>
-
- <!-- Name of project and version, used to create filenames -->
- <property name="Name" value="Hibernate EntityManager"/>
- <property name="name" value="hibernate-entitymanager"/>
- <property name="version" value="3.4.0.GA"/>
- <property name="javadoc.packagenames" value="org.hibernate.ejb.*"/>
- <property name="jdbc.dir" value="jdbc"/>
- <property name="copy.test" value="true"/>
- <property name="javac.source" value="1.5"/>
- <property name="javac.target" value="1.5"/>
- <property name="common.dir" value="${basedir}"/>
-
- <available property="jpa-present" file="${basedir}/../jpa-api" type="dir"/>
- <property name="ivy.dep.dir" value="${basedir}/build/lib"/>
-
- <import file="${common.dir}/common-build.xml"/>
- <property name="jpa-javadoc.dir" value="${dist.doc.dir}/jpa-api"/>
-
- <property name="resources.dir" value="src/resources"/>
- <property name="testresources.dir" value="src/test-resources"/>
- <property name="build.testresources.dir" value="${build.dir}/testresources"/>
- <property name="build.temp.dir" value="${build.dir}/temp"/>
-
- <path id="lib.moduleclass.path">
- <fileset dir="${ivy.dep.dir}/core">
- <include name="*.jar"/>
- </fileset>
- </path>
- <path id="junit.moduleclasspath">
- <pathelement location="${src.dir}"/>
- <pathelement location="${test.dir}"/>
- <fileset dir="${jdbc.dir}">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
- <fileset dir="${lib.dir}/test">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
- <fileset dir="${ivy.dep.dir}/test">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${basedir}/ivy"/>
- <property name="ivy.conf.dir" value="${basedir}"/>
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
- <target name="init">
- <antcall target="common-build.init"/>
- <tstamp>
- <format property="now" pattern="yyyyMMddhhmmss"/>
- </tstamp>
- <mkdir dir="${lib.dir}/test"/>
- <mkdir dir="${ivy.dep.dir}/core"/>
- <mkdir dir="${ivy.dep.dir}/test"/>
- <ivy:configure file="${ivy.jar.dir}/ivyconf.xml"/>
- </target>
-
- <target name="get.deps.core" depends="init"
- description="retrieve the core dependencies">
- <ivy:resolve conf="default"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]"
- conf="default"/>
- </target>
-
- <target name="compile" depends="init,get.deps.core"
- description="Compile the Java source code">
- <available classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac srcdir="${src.dir}" destdir="${classes.dir}"
- classpathref="lib.class.path" debug="${javac.debug}"
- optimize="${javac.optimize}" nowarn="on" source="${javac.source}"
- target="${javac.target}">
- </javac>
- </target>
-
+<project name="HibernateEntityManager" basedir=".">
+
<target name="packjar">
<property name="extension" value="jar"/>
<property name="packagename" value="${jarname}"/>
<property name="headerdirectory" value="."/>
- <!-- property name="jarname"/ -->
- <mkdir dir="${build.testresources.dir}"/>
- <mkdir dir="${build.temp.dir}/${headerdirectory}"/>
- <copy todir="${build.temp.dir}/${headerdirectory}">
+ <mkdir dir="${package.dir}"/>
+ <mkdir dir="${package.tmp.dir}/${headerdirectory}"/>
+ <copy todir="${package.tmp.dir}/${headerdirectory}">
<fileset dir="${classes.dir}">
<include name="**/test/pack/${packagename}/**.*"/>
</fileset>
</copy>
- <jar destfile="${build.testresources.dir}/${jarname}.${extension}">
- <!-- fileset dir="${classes.dir}" >
- <include name="**/test/pack/${packagename}/**.*"/>
- </fileset -->
- <fileset dir="${build.temp.dir}">
+ <jar destfile="${package.dir}/${jarname}.${extension}">
+ <fileset dir="${package.tmp.dir}">
<include name="**/*.*"/>
</fileset>
<fileset dir="${testresources.dir}/${jarname}">
<include name="**/*.*"/>
</fileset>
</jar>
- <delete dir="${build.temp.dir}"/>
+ <delete dir="${package.tmp.dir}"/>
</target>
<target name="packexploded">
<property name="extension" value="jar"/>
- <!-- property name="jarname"/ -->
- <mkdir dir="${build.testresources.dir}/${jarname}.${extension}"/>
- <copy todir="${build.testresources.dir}/${jarname}.${extension}">
- <!-- fileset dir="${build.temp.dir}"/ -->
+ <mkdir dir="${package.dir}/${jarname}.${extension}"/>
+ <copy todir="${package.dir}/${jarname}.${extension}">
<fileset dir="${classes.dir}">
<include name="**/test/pack/${jarname}/**.*"/>
</fileset>
@@ -137,10 +38,9 @@
<include name="**/*.*"/>
</fileset>
</copy>
- <!-- delete dir="${build.temp.dir}"/ -->
</target>
- <target name="test-resources" description="Prepare all needed jars and pars">
+ <target name="package" description="Prepare all needed jars and pars">
<antcall target="packjar" inheritall="true">
<param name="extension" value="par"/>
<param name="jarname" value="defaultpar"/>
@@ -172,13 +72,13 @@
</antcall>
<!-- nested jar -->
- <jar destfile="${build.testresources.dir}/nestedjar.ear">
- <fileset dir="${build.testresources.dir}">
+ <jar destfile="${package.dir}/nestedjar.ear">
+ <fileset dir="${package.dir}">
<include name="defaultpar.par"/>
</fileset>
</jar>
- <copy todir="${build.testresources.dir}/nesteddir.ear">
- <fileset dir="${build.testresources.dir}">
+ <copy todir="${package.dir}/nesteddir.ear">
+ <fileset dir="${package.dir}">
<include name="defaultpar.par"/>
</fileset>
</copy>
@@ -193,268 +93,5 @@
<param name="extension" value="par"/>
<param name="jarname" value="explodedpar"/>
</antcall>
- </target>
-
- <target name="get.deps.test" depends="init"
- description="retrieve the test dependencies">
- <ivy:resolve conf="test"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
- </target>
-
- <target name="compiletest" depends="compile,get.deps.test"
- description="Compile the tests">
- <available classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac srcdir="${test.dir}" destdir="${classes.dir}" debug="${javac.debug}"
- optimize="${javac.optimize}" nowarn="on" source="${javac.source}"
- target="${javac.target}">
- <classpath>
- <path refid="junit.classpath"/>
- </classpath>
- </javac>
- </target>
-
- <target name="junit" depends="compiletest,test-resources">
- <for list="${targetdb}" param="db">
- <sequential>
- <antcall target="common-build.test-resources">
- <param name="db" value="@{db}"/>
- </antcall>
- <mkdir dir="${testreports.dir}/@{db}"/>
- <mkdir dir="${classes.dir}/META-INF/services"/>
- <copy todir="${classes.dir}">
- <fileset dir="${resources.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <echo>Running against db: @{db}</echo>
- <junit fork="once" printsummary="yes" haltonfailure="yes">
- <classpath>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- <dirset dir="${build.testresources.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.par"/>
- </dirset>
- <fileset dir="${build.testresources.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.par"/>
- </fileset>
- <path refid="junit.classpath"/>
- <!-- pathelement path="${classes.dir}"/ -->
- <dirset dir="${classes.dir}">
- <exclude name="**/pack/**.*"/>
- </dirset>
- <!-- pathelement path="build/test.par"/ -->
- <pathelement path="${src.dir}"/>
- <!-- pick up properties from here -->
- <pathelement path="${test.dir}"/>
- <!-- pick up mappings from here -->
- </classpath>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest fork="yes" todir="${testreports.dir}/@{db}" haltonfailure="no">
- <fileset dir="${classes.dir}">
- <include name="**/*Test.class"/>
- </fileset>
- </batchtest>
- </junit>
- </sequential>
- </for>
- </target>
-
- <!-- Run a single unit test. -->
- <target name="junitsingle" depends="compiletest"
- description="Run a single test suite (requires testname and jdbc.driver properties)">
- <for list="${targetdb}" param="db">
- <sequential>
- <antcall target="test-resources">
- <param name="db" value="@{db}"/>
- </antcall>
- <mkdir dir="${testreports.dir}/@{db}"/>
- <echo>Running against db: @{db}</echo>
- <junit printsummary="yes" fork="yes" haltonfailure="yes">
- <classpath>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- <dirset dir="${build.testresources.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.par"/>
- </dirset>
- <fileset dir="${build.testresources.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.par"/>
- </fileset>
- <path refid="junit.classpath"/>
- <!-- pathelement path="${classes.dir}"/ -->
- <dirset dir="${classes.dir}">
- <exclude name="**/pack/**.*"/>
- </dirset>
- <!-- pathelement path="build/test.par"/ -->
- <pathelement path="${src.dir}"/>
- <!-- pick up properties from here -->
- <pathelement path="${test.dir}"/>
- <!-- pick up mappings from here -->
- </classpath>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <test fork="yes" todir="${testreports.dir}/@{db}" haltonfailure="no"
- name="${testname}"/>
- </junit>
- </sequential>
- </for>
- </target>
-
- <target name="jar" depends="compile"
- description="Build the distribution .jar file">
- <mkdir dir="${classes.dir}/META-INF/services"/>
- <copy todir="${classes.dir}">
- <fileset dir="${resources.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <manifest file="${classes.dir}/META-INF/MANIFEST.MF">
- <attribute name="Implementation-Title" value="${Name}"/>
- <attribute name="Implementation-Version" value="${version}"/>
- <attribute name="Implementation-Vendor" value="hibernate.org"/>
- <attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
- <attribute name="Implementation-URL"
- value="http://entitymanager.hibernate.org"/>
- <attribute name="Specification-Title" value="Java Persistence"/>
- <attribute name="Specification-Version" value="1.0"/>
- <attribute name="Specification-Vendor" value="jcp.org"/>
- </manifest>
- <antcall target="common-build.jar"/>
- <ivy:resolve conf="default"/>
- <delete file="${dist.dir}/ivy.xml"/> <!-- delete last produced ivy file to be sure a new one will be generated -->
- <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
- resolver="local" pubrevision="latest" pubdate="${now}"
- status="integration"/>
- </target>
-
- <target name="jpa-javadoc" if="jpa-present">
- <mkdir dir="${jpa-javadoc.dir}"/>
- <ant dir="../jpa-api" target="javadoc" inheritAll="false"/>
- <copy todir="${jpa-javadoc.dir}">
- <fileset dir="${basedir}/../jpa-api/build/api">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- </target>
-
- <!-- Some of this can probably be moved to common-build... -->
- <target name="dist"
- depends="get.deps.core,get.deps.test,jar,javadoc,jpa-javadoc,copysource,copytest,copylib,extras"
- description="Build everything">
-
- <ant inheritall="false" dir="${basedir}/doc/reference"/>
- <copy todir="${dist.dir}/doc/reference" failonerror="false">
- <fileset dir="${basedir}/doc/reference/build">
- <include name="**/*.*"/>
- </fileset>
- </copy>
-
- <copy todir="${dist.dir}/resources" failonerror="false">
- <fileset dir="${resources.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <copy todir="${dist.dir}/test-resources" failonerror="false">
- <fileset dir="${testresources.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <copy todir="${dist.dir}" failonerror="false">
- <fileset dir="${common.dir}">
- <include name="common-build.xml"/>
- </fileset>
- </copy>
- <copy todir="${dist.dir}/ivy" failonerror="false">
- <fileset dir="${ivy.jar.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
-
- <!-- copy dependencies -->
- <copy todir="${dist.lib.dir}" failonerror="false">
- <!-- fileset file="${jpa-api.jar}"/>
- <fileset file="${commons-annotations.jar}"/ -->
- <fileset dir="${ivy.dep.dir}/core">
- <include name="*.jar"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.lib.dir}/test"/>
- <copy todir="${dist.lib.dir}/test" failonerror="false">
- <fileset dir="${ivy.dep.dir}/test">
- <include name="*.jar"/>
- </fileset>
- </copy>
- <copy todir="${dist.lib.dir}/test" failonerror="false">
- <fileset file="${lib.dir}/test/*.jar"/>
- </copy>
-
- <mkdir dir="${dist.lib.dir}/build"/>
- <copy todir="${dist.lib.dir}/build" failonerror="false">
- <fileset file="${lib.dir}/build/*.jar"/>
- </copy>
-
-
- <!-- ivy uses the module name without hibernate- (to mimic the directory names). Revert the situation -->
- <move file="${dist.lib.dir}/commons-annotations.jar"
- tofile="${dist.lib.dir}/hibernate-commons-annotations.jar"
- failonerror="false"/>
- <move file="${dist.lib.dir}/annotations.jar"
- tofile="${dist.lib.dir}/hibernate-annotations.jar"
- failonerror="false"/>
-
- <copy file="${basedir}/build.properties.dist"
- tofile="${dist.dir}/build.properties" failonerror="false">
- </copy>
- <antcall target="common-build.dist"/>
- </target>
-
- <target name="zip-dist" description="zip the dist">
- <zip zipfile="${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
-
- <target name="profile" depends="compiletest">
- <java classname="org.hibernate.ejb.test.Profile" fork="true">
- <jvmarg
- value="-XrunjbossInspector:c:\profiler\data,include=org.hibernate.ejb,ignore=*,wakeupOnStartup=true"/>
- <classpath>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- <dirset dir="${build.testresources.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.par"/>
- </dirset>
-
- <fileset dir="${build.testresources.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.par"/>
- </fileset>
- <path refid="lib.class.path"/>
- <pathelement path="${classes.dir}"/>
- <!-- pathelement path="build/test.par"/ -->
- <pathelement path="${src.dir}"/>
- <!-- pick up properties from here -->
- <pathelement path="${test.dir}"/>
- <!-- pick up mappings from here -->
- </classpath>
- </java>
- </target>
-
+ </target>
</project>
Deleted: entitymanager/branches/v3_4_0_GA_CP/common-build.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/common-build.xml 2009-12-19 10:27:10 UTC (rev 18274)
+++ entitymanager/branches/v3_4_0_GA_CP/common-build.xml 2009-12-19 15:31:20 UTC (rev 18275)
@@ -1,455 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="common-build" default="dist"
- xmlns:artifact="urn:maven-artifact-ant" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
- <description>Common properties and targets for the HibernateExt
- project</description>
-
-
- <!-- my.basedir property can be used to refer to files/directories relatively to the common-build.xml file -->
- <dirname property="common-build.basedir" file="${ant.file.common-build}"/>
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
- <property file="${common-build.basedir}/build.properties"/>
- <property file="${user.home}/.ant.properties"/>
-
- <property name="src.dir" location="src/java"/>
- <property name="test.dir" location="src/test"/>
- <property name="test.resources.dir" location="src/test-resources"/>
- <property name="filter.dir" location="src/filters"/>
- <property name="lib.dir" location="lib"/>
- <property name="build.dir" location="build"/>
- <property name="classes.dir" location="${build.dir}/classes"/>
- <property name="testclasses.dir" location="${build.dir}/testclasses"/>
- <property name="testreports.dir" location="${build.dir}/test-reports"/>
- <property name="dist.target.dir" location="target"/>
- <property name="dist.dir" location="${dist.target.dir}/${name}"/>
- <property name="instrumenttest.out.dir" value="${build.dir}/test-reports/instrument"/>
- <property name="doc.dir" location="doc"/>
- <property name="doc.api.dir" location="${doc.dir}/api"/>
- <property name="doc.reference.dir" location="${doc.dir}/reference"/>
-
- <property name="dist.doc.dir" location="${dist.dir}/doc"/>
- <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
-
- <property name="dist.src.dir" location="${dist.dir}/src"/>
- <property name="dist.test.dir" location="${dist.dir}/test"/>
- <property name="dist.lib.dir" location="${dist.dir}/lib"/>
- <property name="jar.name" value="${name}"/>
- <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
- <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
-
- <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/>
- <property name="javac.debug" value="on"/>
- <property name="javac.optimize" value="off"/>
- <property name="javac.source" value="1.4"/>
- <property name="javac.target" value="1.4"/>
-
- <property name="pom.file" value="${build.dir}/pom.xml"/>
- <property name="src.jar" value="${build.dir}/src.jar"/>
-
- <taskdef name="junit"
- classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
- <classpath>
- <fileset dir="${common-build.basedir}/lib/build">
- <!-- ${build.lib.dir} fails in reference doc build -->
- <include name="junit-*.jar"/>
- <include name="ant-junit-*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <taskdef name="junitreport"
- classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
- <classpath>
- <fileset dir="${common-build.basedir}/lib/build">
- <!-- ${build.lib.dir} fails in reference doc build -->
- <include name="junit-*.jar"/>
- <include name="ant-junit-*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml">
- <classpath>
- <fileset dir="${common-build.basedir}/lib/build">
- <!-- ${build.lib.dir} fails in reference doc build -->
- <include name="ant-contrib-*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${common-build.basedir}/ivy"/>
- <property name="ivy.conf.dir" value="${common-build.basedir}"/>
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
- <!-- maven task load -->
- <path id="maven-ant-tasks.path" path="${ivy.jar.dir}/maven-ant-tasks.jar"/>
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
- uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.path"/>
-
- <artifact:remoteRepository id="offline.repository.jboss.org"
- url="file://${offline.repository.jboss.org}"/>
-
- <path id="lib.class.path">
- <path refid="lib.moduleclass.path"/>
- <pathelement path="${clover.jar}"/>
- </path>
-
- <!-- overridable in modules -->
- <path id="lib.moduleclass.path"/>
-
- <patternset id="support.files">
- <include name="**/*.jpg"/>
- <include name="**/*.gif"/>
- <include name="**/*.dtd"/>
- <include name="**/*.xsd"/>
- <include name="**/*.xml"/>
- <include name="**/*.xslt"/>
-
- <!-- exclude everything we don't want in the jar -->
- <exclude name="${build.dir}/**/*"/>
- <exclude name="${doc.dir}/**/*"/>
- <exclude name="classes/**/*"/>
- <exclude name="build.xml"/>
- <exclude name="**/*.properties"/>
- <exclude name="**/*.ccf"/>
- <exclude name="**/*.cfg.xml"/>
- <exclude name="**/ehcache.xml"/>
- </patternset>
-
- <patternset id="source.files">
- <include name="**/*.java"/>
- <include name="**/*.properties"/>
- </patternset>
-
- <!-- junit paths/filesets -->
- <fileset dir="${testclasses.dir}" id="junit.batchtestset">
- <include name="**/*Test.class"/>
- </fileset>
-
- <path id="testsrc.path">
- <pathelement location="${test.dir}"/>
- </path>
-
- <path id="junit.classpath">
- <pathelement path="${classes.dir}"/>
- <pathelement path="${testclasses.dir}"/>
- <path refid="lib.class.path"/>
- <path refid="junit.moduleclasspath"/>
- <path location="${clover.jar}"/>
- </path>
-
- <!-- Determine the database against which to run tests-->
- <if>
- <equals arg1="${targetdb}" arg2="$${targetdb}"/>
- <then>
- <echo message="No target database specified using default HSQLDB"/>
- <property name="targetdb" value="hsqldb"/>
- </then>
- </if>
-
- <!-- Clover tasks -->
- <target name="with.clover">
- <clover-setup initString="clover_coverage.db"/>
- </target>
-
- <target name="cloverreport.html" depends="with.clover"
- description="Generate a clover report from the current clover database.">
- <clover-report>
- <current outfile="${clover.out.dir}">
- <format type="html"/>
- </current>
- </clover-report>
- </target>
-
- <target name="cloverreport"
- depends="with.clover,junitreport,cloverreport.html"
- description="Run the tests and generate a clover report">
- </target>
-
- <!-- Tasks -->
- <target name="clean" description="Cleans up build and dist directories">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.target.dir}"/>
- <delete dir="${clover.out.dir}"/>
- </target>
-
- <target name="init" description="Initialize the build">
- <tstamp>
- <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
- </tstamp>
- <tstamp>
- <format property="releasedate" pattern="dd-MM-yyyy"/>
- </tstamp>
- <echo message="Build ${Name}-${version} (${subversion})"/>
- <mkdir dir="${classes.dir}"/>
- <mkdir dir="${testclasses.dir}"/>
- <copy todir="${classes.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- <filter token="version" value="${version}"/>
- <filter token="releasedate" value="${releasedate}"/>
- <copy todir="${build.dir}" filtering="true">
- <fileset dir=".">
- <include name="readme.txt"/>
- <include name="lgpl.txt"/>
- <include name="pom.xml"/>
- </fileset>
- </copy>
- </target>
-
- <target name="get.deps.core" depends="init"
- description="retrieve the core dependencies" unless="disable.ivy">
- <ivy:resolve conf="default"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]"
- conf="default"/>
- </target>
-
- <target name="get.deps.test" depends="init"
- description="retrieve the test dependencies" unless="disable.ivy">
- <ivy:resolve conf="test"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
- </target>
-
- <target name="copytest" description="Copy tests to dist dir" if="copy.test">
- <mkdir dir="${dist.test.dir}"/>
- <copy todir="${dist.test.dir}">
- <fileset dir="${test.dir}"/>
- </copy>
- </target>
-
- <target name="copysource" depends="copytest"
- description="Copy sources to dist dir">
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- </target>
-
- <target name="copylib" description="Copy jars to lib dir">
- <mkdir dir="${dist.lib.dir}"/>
- <copy todir="${dist.lib.dir}" verbose="true">
- <fileset dir="${lib.dir}">
- <include name="**/*.jar"/>
- <exclude name="log4j.jar"/>
- <exclude name="checkstyle*.jar"/>
- <include name="*.txt"/>
- </fileset>
- </copy>
- </target>
-
- <target name="copydoc" description="Copy doc to dist dir" if="copy.doc">
- <mkdir dir="${dist.doc.dir}"/>
- <copy todir="${dist.doc.dir}">
- <fileset dir="${doc.dir}">
- <include name="**/*.html"/>
- </fileset>
- </copy>
- </target>
-
- <target name="jar" depends="compile"
- description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jar.file.name}"
- basedir="${classes.dir}"/>
- </target>
-
- <target name="jartest" depends="compiletest"
- description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jartest.file.name}"
- basedir="${testclasses.dir}"/>
- </target>
-
- <!-- DOCUMENTATION -->
-
- <target name="javadoc"
- description="Compile the Javadoc API documentation to dist dir">
- <mkdir dir="${dist.api.dir}"/>
- <javadoc packagenames="${javadoc.packagenames}"
- classpathref="lib.class.path" destdir="${dist.api.dir}" use="true"
- protected="true" version="true"
- windowtitle="${Name} API Documentation"
- Overview="${doc.api.dir}/package.html"
- doctitle="${Name} API Documentation"
- stylesheetfile="${doc.api.dir}/jdstyle.css" link="${javadoc}">
- <packageset dir="${src.dir}" defaultexcludes="yes">
- <include name="**/*"/>
- </packageset>
- </javadoc>
- </target>
-
- <target name="extras" description="Copies miscellaneous files to root dir">
- <copy todir="${dist.dir}/bin" failonerror="false">
- <fileset dir="bin">
- <include name="*.bat"/>
- </fileset>
- </copy>
- <copy file="${build.dir}/readme.txt" todir="${dist.dir}"/>
- <copy file="lgpl.txt" todir="${dist.dir}"/>
- <copy file="changelog.txt" todir="${dist.dir}"/>
- <copy file="build.xml" todir="${dist.dir}"/>
- <replace file="${dist.dir}/build.xml">
- <replacetoken><![CDATA[../${name}-${version}]]>
- </replacetoken>
- <replacevalue><![CDATA[../${name}]]>
- </replacevalue>
- </replace>
- </target>
-
- <target name="dist" depends="jar,javadoc,copysource,copydoc,extras"
- description="Build everything">
- <zip zipfile="${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
-
- <target name="info" description="Echoes useful system properties">
- <echo message="java.vm.info=${java.vm.info}"/>
- <echo message="java.vm.name=${java.vm.name}"/>
- <echo message="java.vm.vendor=${java.vm.vendor}"/>
- <echo message="java.vm.version=${java.vm.version}"/>
- <echo message="os.arch=${os.arch}"/>
- <echo message="os.name=${os.name}"/>
- <echo message="os.version=${os.version}"/>
- <echo message="java.home = ${java.home}"/>
- <echo message="java.class.path = ${java.class.path}"/>
- <echo message="build.compiler = ${build.compiler}"/>
- <echo message="file.encoding=${file.encoding}"/>
- <echo message="user.home = ${user.home}"/>
- <echo message="user.language=${user.language}"/>
- </target>
-
- <target name="test-resources" description="Copies and filters test resources">
- <filter filtersfile="${filter.dir}/${db}.filter"/>
- <mkdir dir="${testclasses.dir}"/>
- <copy todir="${testclasses.dir}" filtering="true" overwrite="true">
- <fileset dir="${test.resources.dir}">
- <include name="*.properties"/>
- <include name="*.xml"/>
- </fileset>
- </copy>
- </target>
-
- <target name="instrument" depends="compiletest"
- description="Instrument the persistent classes"> <!-- depends="jar" -->
-
- <taskdef name="instrument"
- classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
- <classpath refid="junit.classpath"/>
- </taskdef>
-
- <instrument verbose="true">
- <fileset dir="${testclasses.dir}/org/hibernate/test">
- <include name="**/*.class"/>
- <exclude name="**/*Test$*.class"/>
- <exclude name="**/*Test.class"/>
- <exclude name="**/*Tests.class"/>
- </fileset>
- </instrument>
- </target>
-
- <target name="junitinstrument" depends="compiletest,instrument"
- description="Run the instrument test suite">
- <for list="${targetdb}" param="db">
- <sequential>
- <antcall target="test-resources">
- <param name="db" value="@{db}"/>
- </antcall>
- <mkdir dir="${instrumenttest.out.dir}/@{db}"/>
- <echo>Running against db: @{db}</echo>
- <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
- maxmemory="256M" fork="yes" forkmode="perBatch">
- <classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest todir="${instrumenttest.out.dir}/@{db}" haltonfailure="no">
- <fileset refid="junit.batchtestset"/>
- </batchtest>
- </junit>
- </sequential>
- </for>
- </target>
-
- <target name="junitreport" depends="">
- <junitreport todir="${testreports.dir}">
- <fileset dir="${testreports.dir}">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="${testreports.dir}"/>
- </junitreport>
- </target>
-
- <target name="checkstyle" description="Check coding style">
- <taskdef resource="checkstyletask.properties">
- <classpath>
- <path refid="lib.class.path"/>
- <fileset dir="${common-build.basedir}/lib">
- <include name="checkstyle*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
- <fileset dir="${src.dir}">
- <include name="**/*.java"/>
- </fileset>
- <formatter type="plain"/>
- </checkstyle>
- </target>
-
- <target name="patch" depends="checkstyle" description="Create a patch">
- <cvs command="-q diff -u -N" output="patch.txt"/>
- </target>
-
- <!-- maven deploy: to be used by the subbuild and delcare deps on jar -->
- <target name="deploy" depends="jar">
- <fail unless="offline.repository.jboss.org"
- message="offline.repository.jboss.org must be defined"/>
- <jar jarfile="${src.jar}" basedir="${src.dir}">
- <include name="**/*.java"/>
- <exclude name="**/test/*.java"/>
- <!-- patternset refid="meta.files" / -->
- </jar>
-
- <artifact:pom id="maven.project" file="${pom.file}"/>
-
- <artifact:install file="${jar.file.name}">
- <pom refid="maven.project"/>
- </artifact:install>
-
- <artifact:deploy file="${jar.file.name}">
- <pom refid="maven.project"/>
- <remoteRepository refId="offline.repository.jboss.org">
- </remoteRepository>
- <attach file="${src.jar}" classifier="sources"/>
- <attach file="${jar.file.name}" classifier=""/>
- </artifact:deploy>
- </target>
-
-</project>
Deleted: entitymanager/branches/v3_4_0_GA_CP/ivy.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/ivy.xml 2009-12-19 10:27:10 UTC (rev 18274)
+++ entitymanager/branches/v3_4_0_GA_CP/ivy.xml 2009-12-19 15:31:20 UTC (rev 18275)
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivy-module version="1.3"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation=
- "http://www.jayasoft.org/misc/ivy/ivy.xsd">
- <info organisation="org.hibernate" module="entitymanager"/>
- <configurations>
- <conf name="default" description="Core module dependencies"/>
- <conf name="test" visibility="private" description="Dependencies needed for testing purposes"/>
- </configurations>
- <publications>
- <artifact name="hibernate-entitymanager" conf="default"/>
- </publications>
- <dependencies>
- <!-- compile time dependencies -->
- <dependency name="ejb3-persistence" rev="1.0.2.GA" conf="default->default"/>
- <dependency name="commons-annotations" rev="3.1.0.GA" conf="default->default"/>
- <dependency name="annotations" rev="3.4.0.GA" conf="default->default"/>
- <dependency org="org.hibernate" name="hibernate-core" rev="3.3.2.GA" conf="default->default"/>
- <dependency org="dom4j" name="dom4j" rev="1.6.1" conf="default->default"/>
- <dependency org="javax.transaction" name="jta" rev="1.1" conf="default->default"/>
- <dependency org="javassist" name="javassist" rev="3.4.GA" conf="default->default"/>
- <dependency org="org.slf4j" name="slf4j-api" rev="1.4.2" conf="default->default"/>
-
- <!-- transitive dependencies -->
- <dependency org="antlr" name="antlr" rev="2.7.6" conf="test->default"/>
- <dependency org="commons-collections" name="commons-collections" rev="3.1" conf="test->default"/>
-
- <!-- test deps -->
- <dependency org="cglib" name="cglib" rev="2.1_3" conf="test->default"/>
- <dependency org="asm" name="asm" rev="1.5.3" conf="test->default"/>
- <dependency org="asm" name="asm-attrs" rev="1.5.3" conf="test->default"/>
- <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.4.2" conf="test->default"/>
- <dependency org="log4j" name="log4j" rev="1.2.14" conf="test->default"/>
- <dependency org="junit" name="junit" rev="3.8.1" conf="test->default"/>
- </dependencies>
-</ivy-module>
\ No newline at end of file
Modified: entitymanager/branches/v3_4_0_GA_CP/pom.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/pom.xml 2009-12-19 10:27:10 UTC (rev 18274)
+++ entitymanager/branches/v3_4_0_GA_CP/pom.xml 2009-12-19 15:31:20 UTC (rev 18275)
@@ -1,25 +1,99 @@
-<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">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <packaging>pom</packaging>
- <version>@version@</version>
+ <packaging>jar</packaging>
+ <version>3.4.0.GA</version>
- <name>Hibernate Entitity Manager</name>
- <description>Hibernate Entitity Manager</description>
- <url>http://hibernate.org</url>
+ <name>Hibernate Entity Manager</name>
+ <description>Hibernate Entity Manager</description>
+ <url>http://entitymanager.hibernate.org</url>
- <licenses>
+ <licenses>
<license>
- <name>GNU LESSER GENERAL PUBLIC LICENSE</name>
- <url>http://www.gnu.org/licenses/lgpl.txt</url>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
+ <comments>See discussion at http://hibernate.org/356.html for more
+ details.</comments>
+ <distribution>repo</distribution>
</license>
</licenses>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/hibernate/entitymanager/branches/v...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/hibernate/entitymanager/branches/v3_4...</developerConnection>
+ <url>http://fisheye.jboss.com/browse/Hibernate/entitymanager/branches/v3_4_0_G...</url>
+ </scm>
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://opensource.atlassian.com/projects/hibernate/browse/EJB</url>
+ </issueManagement>
+
+ <mailingLists>
+ <mailingList>
+ <name>Hibernate Announcements</name>
+ <post>hibernate-announce(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-announce</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-announce</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-dev/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Hibernate Commit Notificatons</name>
+ <post>hibernate-commits(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-commits</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-commits</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-commits/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Hibernate Developers</name>
+ <post>hibernate-dev(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-dev</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-dev</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-dev/</archive>
+ <otherArchives>
+ <otherArchive>http://www.mail-archive.com/hibernate-dev%40lists.jboss.org/index.html</otherArchive>
+ </otherArchives>
+ </mailingList>
+ <mailingList>
+ <name>Hibernate Issue Notifications</name>
+ <post>hibernate-issues(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-issues</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-issues</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-issues/</archive>
+ </mailingList>
+ </mailingLists>
+
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
@@ -44,7 +118,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
@@ -61,6 +135,657 @@
<artifactId>javassist</artifactId>
<version>3.4.GA</version>
</dependency>
+ <!-- =============================== -->
+ <!-- Testing Dependencies -->
+ <!-- =============================== -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-</project>
\ No newline at end of file
+ <build>
+ <testResources>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/bundles</directory>
+ <targetPath>../bundles</targetPath>
+ </testResource>
+ </testResources>
+<plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package-tests</id>
+ <phase>process-test-classes</phase>
+ <configuration>
+ <tasks>
+ <property name="package.dir" value="${basedir}/target/test-packages" />
+ <property name="package.tmp.dir" value="${basedir}/target/tmp" />
+ <property name="classes.dir" value="${project.build.directory}/test-classes" />
+ <property name="testresources.dir" value="${basedir}/target/bundles" />
+ <ant antfile="${basedir}/build.xml">
+ <target name="package" />
+ </ant>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- require at least JDK 1.5 to run the build -->
+ <!-- ... -->
+ <!--
+ we need at least Maven 2.0.8 because of a bug fix affecting our
+ antlr usage
+ -->
+ <!--
+ 2.0.8 not released at this time, so I instead say anything greater
+ that 2.0.7
+ -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-java</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireJavaVersion>
+ <version>[1.5,)</version>
+ </requireJavaVersion>
+ <requireMavenVersion>
+ <version>(2.0.7,)</version>
+ </requireMavenVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-test-ext-plugin</artifactId>
+ <version>1.1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>extend</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ by default, compile to JDK 1.4 compatibility (individual modules
+ and/or user can override)
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <!-- add specification/implementation details to the manifests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Specification-Vendor>jcp.org</Specification-Vendor>
+ <Specification-Version>1.0</Specification-Version>
+ <Specification-Title>Java Persistence</Specification-Title>
+ <Implementation-Vendor-Id>hibernate.org</Implementation-Vendor-Id>
+ <Implementation-Vendor>hibernate.org</Implementation-Vendor>
+ <Implementation-URL>http://entitymanager.hibernate.org</Implementation-URL>
+ <Implementation-Title>Hibernate EntityManager</Implementation-Title>
+ <Implementation-Version>${version}</Implementation-Version>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <forkMode>pertest</forkMode>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
+ </additionalClasspathElements>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/dist.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.2.0</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jdocbook-style</artifactId>
+ <version>2.0.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main/docbook</sourceDirectory>
+ <masterTranslation>en</masterTranslation>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en/images</directory>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
+ <finalName>hibernate_entitymanager_reference.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ </options>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-doc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ <link>http://java.sun.com/javaee/5/docs/api/</link>
+ </links>
+ <stylesheetfile>${basedir}/src/main/javadoc/jdstyle.css</stylesheetfile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>javadoc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <releaseProfiles>release</releaseProfiles>
+ <goals>package javadoc:javadoc org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:resources org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:generate assembly:assembly
+ </goals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <linkXRef>true</linkXRef>
+ <minimumTokens>100</minimumTokens>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <tags>
+ <tag>@FIXME</tag>
+ <tag>@fixme</tag>
+ <tag>FIXME</tag>
+ <tag>fixme</tag>
+ <tag>@TODO</tag>
+ <tag>@todo</tag>
+ <tag>TODO</tag>
+ <tag>todo</tag>
+ </tags>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!--
+ Note: aggregate-able, may cause problems if we aggregate jxr and
+ not this because of the xref links
+ -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javancss-maven-plugin</artifactId>
+ <version>2.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <configuration>
+ <onlyAnalyze>org.hibernate.*</onlyAnalyze>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <!-- HSQLDB is the default (eventually move to H2) -->
+ <profile>
+ <id>hsqldb</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.HSQLDialect</db.dialect>
+ <jdbc.driver>org.hsqldb.jdbcDriver</jdbc.driver>
+ <jdbc.url>jdbc:hsqldb:target/test/db/hsqldb/hibernate</jdbc.url>
+ <jdbc.user>sa</jdbc.user>
+ <jdbc.pass />
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
+ <!-- The H2 test envionment -->
+ <profile>
+ <id>h2</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.h2database</groupId>
+ <artifactId>h2database</artifactId>
+ <version>1.0.20061217</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.H2Dialect</db.dialect>
+ <jdbc.driver>org.h2.Driver</jdbc.driver>
+ <jdbc.url>jdbc:h2:mem:target/test/db/h2/hibernate</jdbc.url>
+ <jdbc.user>sa</jdbc.user>
+ <jdbc.pass />
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
+ <!--
+ ###################################################################
+ Profiles naming db instances in the Red Hat QA/QE lab
+
+ First, those with OSS drivers
+ ###################################################################
+ -->
+
+ <!-- The MySQL5 test envionment -->
+ <profile>
+ <id>mysql5</id>
+ <dependencies>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.0.5</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
+ <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+ <!-- The MySQL 5.1 test envionment -->
+ <profile>
+ <id>mysql51</id>
+ <dependencies>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.0.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
+ <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The PostgreSQL 8.2.4 test envionment -->
+ <profile>
+ <id>postgresql824</id>
+ <dependencies>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.2-504.jdbc3</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
+ <jdbc.driver>org.postgresql.Driver</jdbc.driver>
+ <jdbc.url>jdbc:postgresql://vmg01.mw.lab.eng.bos.redhat.com:5432:hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The PostgreSQL 8.3.7 test envionment -->
+ <profile>
+ <id>postgresql837</id>
+ <dependencies>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.2-504.jdbc3</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
+ <jdbc.driver>org.postgresql.Driver</jdbc.driver>
+ <jdbc.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!--
+ ###################################################################
+ Then, those with commercial drivers
+ ###################################################################
+ -->
+
+ <!-- The DB2 9.7 test envionment (using 9x drivers)-->
+ <profile>
+ <id>db2v97</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc</artifactId>
+ <version>3.57.86</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc_license_cu</artifactId>
+ <version>3.57.86</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
+ <jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
+ <jdbc.url>jdbc:db2://vmg06.mw.lab.eng.bos.redhat.com:50000/jbossqa
+ </jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
+ <!-- The DB2 9.x test envionment (using 9x drivers)-->
+ <profile>
+ <id>db2v91</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc</artifactId>
+ <version>3.1.57</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc_license_cu</artifactId>
+ <version>3.1.57</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
+ <jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
+ <jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
+ <!-- The Oracle9i test envionment -->
+ <profile>
+ <id>oracle9i</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc14</artifactId>
+ <!-- use the 10g drivers which are surprisingly largely bug free -->
+ <version>10.0.2.0</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.Oracle9iDialect</db.dialect>
+ <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
+ <jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
+ <!-- The Oracle10g test envionment -->
+ <profile>
+ <id>oracle10g</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc14</artifactId>
+ <!-- use the 10g drivers which are surprisingly largely bug free -->
+ <version>10.0.2.0</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
+ <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
+ <jdbc.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qaora10
+ </jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+ <!-- The Oracle11g test envionment -->
+ <profile>
+ <id>oracle11g</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc5</artifactId>
+ <version>11.1.0.7.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
+ <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
+ <jdbc.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+ <!-- The Oracle11gRAC test envionment -->
+ <profile>
+ <id>oracle11gRAC</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc5</artifactId>
+ <version>11.1.0.7.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
+ <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
+ <jdbc.url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=vmg24-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vmg25-vip.mw.lab.eng.bos.redhat.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=qarac.jboss)))</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+ <!-- The Sybase 15 test envionment -->
+ <profile>
+ <id>sybase15</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sybase</groupId>
+ <artifactId>jconnect</artifactId>
+ <version>6.0.5</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SybaseASE15Dialect</db.dialect>
+ <jdbc.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.driver>
+ <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation />
+ </properties>
+ </profile>
+
+ <!-- The SQLServer2005 (MS JDBC) test envionment -->
+ <profile>
+ <id>mssql2005</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.microsoft.sqlserver</groupId>
+ <artifactId>msjdbc</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
+ <jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
+ <jdbc.url>jdbc:sqlserver://dev30.qa.atl.jboss.com:3918</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation>4096</jdbc.isolation>
+ </properties>
+ </profile>
+
+ <!-- The SQLServer2005 (MS JDBC) test envionment -->
+ <profile>
+ <id>mssql2008</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.microsoft.sqlserver</groupId>
+ <artifactId>msjdbc</artifactId>
+ <version>2.0.1008.2-4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
+ <jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
+ <jdbc.url>jdbc:sqlserver://vmg04.mw.lab.eng.bos.redhat.com:1433</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
+ <jdbc.isolation>4096</jdbc.isolation>
+ </properties>
+ </profile>
+ </profiles>
+ <properties>
+ <slf4jVersion>1.5.8</slf4jVersion>
+ </properties>
+ </project>
\ No newline at end of file
14 years, 12 months
Hibernate SVN: r18274 - core/branches/Branch_3_3_2_GA_CP/cache-ehcache/src/main/java/org/hibernate/cache.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-12-19 05:27:10 -0500 (Sat, 19 Dec 2009)
New Revision: 18274
Modified:
core/branches/Branch_3_3_2_GA_CP/cache-ehcache/src/main/java/org/hibernate/cache/EhCache.java
Log:
minor change, correct javadoc spell
Modified: core/branches/Branch_3_3_2_GA_CP/cache-ehcache/src/main/java/org/hibernate/cache/EhCache.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/cache-ehcache/src/main/java/org/hibernate/cache/EhCache.java 2009-12-19 10:26:21 UTC (rev 18273)
+++ core/branches/Branch_3_3_2_GA_CP/cache-ehcache/src/main/java/org/hibernate/cache/EhCache.java 2009-12-19 10:27:10 UTC (rev 18274)
@@ -161,7 +161,7 @@
/**
* Remove all elements in the cache, but leave the cache
- * in a useable state.
+ * in a usable state.
*
* @throws CacheException
*/
@@ -178,7 +178,7 @@
}
/**
- * Remove the cache and make it unuseable.
+ * Remove the cache and make it unusable.
*
* @throws CacheException
*/
14 years, 12 months
Hibernate SVN: r18273 - core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-12-19 05:26:21 -0500 (Sat, 19 Dec 2009)
New Revision: 18273
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/package.html
Log:
minor change, correct javadoc spell
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/package.html
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/package.html 2009-12-18 21:52:54 UTC (rev 18272)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/package.html 2009-12-19 10:26:21 UTC (rev 18273)
@@ -32,7 +32,7 @@
in three scenarios:<ol>
<li>
<b>Reflection optimization</b> - to speed up the performance of
- POJO entity and component conctruction and field/property access
+ POJO entity and component construction and field/property access
</li>
<li>
<b>Proxy generation</b> - runtime building of proxies used for
14 years, 12 months
Hibernate SVN: r18272 - core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-12-18 16:52:54 -0500 (Fri, 18 Dec 2009)
New Revision: 18272
Modified:
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java
Log:
HHH-4642 : added test cases showing unexpected results when an updated entity is changed from read-only to modifiable
Modified: core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java
===================================================================
--- core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java 2009-12-18 21:42:42 UTC (rev 18271)
+++ core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java 2009-12-18 21:52:54 UTC (rev 18272)
@@ -127,7 +127,7 @@
s.close();
}
- public void testSetUpdateReadOnlyTwice() throws Exception {
+ public void testUpdateSetReadOnlyTwice() throws Exception {
Session s = openSession();
s.beginTransaction();
VersionedNode node = new VersionedNode( "node", "node" );
@@ -192,6 +192,72 @@
s.close();
}
+ public void testUpdateSetReadOnlySetModifiableFailureExpected() throws Exception {
+ Session s = openSession();
+ s.beginTransaction();
+ VersionedNode node = new VersionedNode( "node", "node" );
+ s.persist( node );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ node.setName( "node-name" );
+ s.setReadOnly( node, true );
+ s.setReadOnly( node, false );
+ s.getTransaction().commit();
+ s.close();
+
+ assertUpdateCount( 1 );
+ assertInsertCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ assertEquals( "node-name", node.getName() );
+ assertEquals( 1, node.getVersion() );
+ s.delete( node );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testSetReadOnlyUpdateSetModifiableFailureExpected() throws Exception {
+ Session s = openSession();
+ s.beginTransaction();
+ VersionedNode node = new VersionedNode( "node", "node" );
+ s.persist( node );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ s.setReadOnly( node, true );
+ node.setName( "node-name" );
+ s.setReadOnly( node, false );
+ s.getTransaction().commit();
+ s.close();
+
+ assertUpdateCount( 1 );
+ assertInsertCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ assertEquals( "node-name", node.getName() );
+ assertEquals( 1, node.getVersion() );
+ s.delete( node );
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testAddNewChildToReadOnlyParent() throws Exception {
Session s = openSession();
s.beginTransaction();
14 years, 12 months
Hibernate SVN: r18271 - core/trunk/testsuite/src/test/java/org/hibernate/test/readonly.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-12-18 16:42:42 -0500 (Fri, 18 Dec 2009)
New Revision: 18271
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java
Log:
HHH-4642 : added test cases showing unexpected results when an updated entity is changed from read-only to modifiable
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java 2009-12-18 20:44:35 UTC (rev 18270)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java 2009-12-18 21:42:42 UTC (rev 18271)
@@ -127,7 +127,7 @@
s.close();
}
- public void testSetUpdateReadOnlyTwice() throws Exception {
+ public void testUpdateSetReadOnlyTwice() throws Exception {
Session s = openSession();
s.beginTransaction();
VersionedNode node = new VersionedNode( "node", "node" );
@@ -192,6 +192,72 @@
s.close();
}
+ public void testUpdateSetReadOnlySetModifiableFailureExpected() throws Exception {
+ Session s = openSession();
+ s.beginTransaction();
+ VersionedNode node = new VersionedNode( "node", "node" );
+ s.persist( node );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ node.setName( "node-name" );
+ s.setReadOnly( node, true );
+ s.setReadOnly( node, false );
+ s.getTransaction().commit();
+ s.close();
+
+ assertUpdateCount( 1 );
+ assertInsertCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ assertEquals( "node-name", node.getName() );
+ assertEquals( 1, node.getVersion() );
+ s.delete( node );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testSetReadOnlyUpdateSetModifiableFailureExpected() throws Exception {
+ Session s = openSession();
+ s.beginTransaction();
+ VersionedNode node = new VersionedNode( "node", "node" );
+ s.persist( node );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ s.setReadOnly( node, true );
+ node.setName( "node-name" );
+ s.setReadOnly( node, false );
+ s.getTransaction().commit();
+ s.close();
+
+ assertUpdateCount( 1 );
+ assertInsertCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ assertEquals( "node-name", node.getName() );
+ assertEquals( 1, node.getVersion() );
+ s.delete( node );
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testAddNewChildToReadOnlyParent() throws Exception {
Session s = openSession();
s.beginTransaction();
14 years, 12 months
Hibernate SVN: r18270 - in core/branches/Branch_3_3: testsuite/src/test/java/org/hibernate/test/readonly and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-12-18 15:44:35 -0500 (Fri, 18 Dec 2009)
New Revision: 18270
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/EntityEntry.java
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java
Log:
HHH-4715 : Unexpected results when an unpdated entity that is already modifiable is set to modifiable again
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/EntityEntry.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/EntityEntry.java 2009-12-18 20:04:44 UTC (rev 18269)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/EntityEntry.java 2009-12-18 20:44:35 UTC (rev 18270)
@@ -262,6 +262,11 @@
}
public void setReadOnly(boolean readOnly, Object entity) {
+ if ( ( readOnly && status == Status.READ_ONLY ) ||
+ ( ( ! readOnly ) && status == Status.MANAGED ) ) {
+ // simply return since the status is not being changed
+ return;
+ }
if (status!=Status.MANAGED && status!=Status.READ_ONLY) {
throw new HibernateException("instance was not in a valid state");
}
Modified: core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java
===================================================================
--- core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java 2009-12-18 20:04:44 UTC (rev 18269)
+++ core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/readonly/ReadOnlyVersionedNodesTest.java 2009-12-18 20:44:35 UTC (rev 18270)
@@ -127,6 +127,71 @@
s.close();
}
+ public void testSetUpdateReadOnlyTwice() throws Exception {
+ Session s = openSession();
+ s.beginTransaction();
+ VersionedNode node = new VersionedNode( "node", "node" );
+ s.persist( node );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ node.setName( "node-name" );
+ s.setReadOnly( node, true );
+ s.setReadOnly( node, true );
+ s.getTransaction().commit();
+ s.close();
+
+ assertUpdateCount( 0 );
+ assertInsertCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ assertEquals( "node", node.getName() );
+ assertEquals( 0, node.getVersion() );
+ s.delete( node );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testUpdateSetModifiable() throws Exception {
+ Session s = openSession();
+ s.beginTransaction();
+ VersionedNode node = new VersionedNode( "node", "node" );
+ s.persist( node );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ node.setName( "node-name" );
+ s.setReadOnly( node, false );
+ s.getTransaction().commit();
+ s.close();
+
+ assertUpdateCount( 1 );
+ assertInsertCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ node = ( VersionedNode ) s.get( VersionedNode.class, node.getId() );
+ assertEquals( "node-name", node.getName() );
+ assertEquals( 1, node.getVersion() );
+ s.delete( node );
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testAddNewChildToReadOnlyParent() throws Exception {
Session s = openSession();
s.beginTransaction();
14 years, 12 months
Hibernate SVN: r18269 - in core/trunk: core/src/main/java/org/hibernate/hql/ast and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-12-18 15:04:44 -0500 (Fri, 18 Dec 2009)
New Revision: 18269
Modified:
core/trunk/core/src/main/antlr/hql-sql.g
core/trunk/core/src/main/antlr/hql.g
core/trunk/core/src/main/antlr/sql-gen.g
core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java
Log:
HHH-4719 - Support modulo operator
Modified: core/trunk/core/src/main/antlr/hql-sql.g
===================================================================
--- core/trunk/core/src/main/antlr/hql-sql.g 2009-12-18 15:32:39 UTC (rev 18268)
+++ core/trunk/core/src/main/antlr/hql-sql.g 2009-12-18 20:04:44 UTC (rev 18269)
@@ -558,6 +558,7 @@
: #(PLUS expr expr) { prepareArithmeticOperator( #arithmeticExpr ); }
| #(MINUS expr expr) { prepareArithmeticOperator( #arithmeticExpr ); }
| #(DIV expr expr) { prepareArithmeticOperator( #arithmeticExpr ); }
+ | #(MOD expr expr) { prepareArithmeticOperator( #arithmeticExpr ); }
| #(STAR expr expr) { prepareArithmeticOperator( #arithmeticExpr ); }
// | #(CONCAT expr (expr)+ ) { prepareArithmeticOperator( #arithmeticExpr ); }
| #(UNARY_MINUS expr) { prepareArithmeticOperator( #arithmeticExpr ); }
Modified: core/trunk/core/src/main/antlr/hql.g
===================================================================
--- core/trunk/core/src/main/antlr/hql.g 2009-12-18 15:32:39 UTC (rev 18268)
+++ core/trunk/core/src/main/antlr/hql.g 2009-12-18 20:04:44 UTC (rev 18269)
@@ -559,7 +559,7 @@
// level 2 - binary multiply and divide
multiplyExpression
- : unaryExpression ( ( STAR^ | DIV^ ) unaryExpression )*
+ : unaryExpression ( ( STAR^ | DIV^ | MOD^ ) unaryExpression )*
;
// level 1 - unary minus, unary plus, not
@@ -769,6 +769,7 @@
MINUS: '-';
STAR: '*';
DIV: '/';
+MOD: '%';
COLON: ':';
PARAM: '?';
Modified: core/trunk/core/src/main/antlr/sql-gen.g
===================================================================
--- core/trunk/core/src/main/antlr/sql-gen.g 2009-12-18 15:32:39 UTC (rev 18268)
+++ core/trunk/core/src/main/antlr/sql-gen.g 2009-12-18 20:04:44 UTC (rev 18269)
@@ -377,6 +377,7 @@
multiplicativeExpr
: #(STAR nestedExpr { out("*"); } nestedExpr)
| #(DIV nestedExpr { out("/"); } nestedExprAfterMinusDiv)
+ | #(MOD nestedExpr { out(" % "); } nestedExprAfterMinusDiv)
;
nestedExpr
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java 2009-12-18 15:32:39 UTC (rev 18268)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java 2009-12-18 20:04:44 UTC (rev 18269)
@@ -158,6 +158,7 @@
case MINUS:
case STAR:
case DIV:
+ case MOD:
return BinaryArithmeticOperatorNode.class;
case UNARY_MINUS:
case UNARY_PLUS:
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java 2009-12-18 15:32:39 UTC (rev 18268)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java 2009-12-18 20:04:44 UTC (rev 18269)
@@ -85,6 +85,10 @@
super.cleanupTest();
}
+ public void testModulo() {
+ assertTranslation( "from Animal a where a.bodyWeight % 2 = 0" );
+ }
+
public void testInvalidCollectionDereferencesFail() {
// should fail with the same exceptions (because of the DotNode.ILLEGAL_COLL_DEREF_EXCP_BUILDER injection)
assertTranslation( "from Animal a where a.offspring.description = 'xyz'" );
14 years, 12 months
Hibernate SVN: r18268 - in core/trunk: entitymanager/src/main/java/org/hibernate/ejb and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-12-18 10:32:39 -0500 (Fri, 18 Dec 2009)
New Revision: 18268
Added:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ExpressionImplementor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/SelectionImplementor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/TupleElementImplementor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ValueConverter.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/QueryBuilderTest.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Address.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Alias.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Country.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/CreditCard.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Customer.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Info.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/LineItem.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Order.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Phone.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Spouse.java
Removed:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImplementor.java
Modified:
core/trunk/core/src/main/java/org/hibernate/engine/query/NamedParameterDescriptor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernateEntityManagerImplementor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/QueryImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaBuilderImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryCompiler.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/AbstractTupleElement.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/CompoundSelectionImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/LiteralExpression.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SelectionImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/ComparisonPredicate.java
Log:
HHH-4698 - Better handling of JPA criteria expressions
Modified: core/trunk/core/src/main/java/org/hibernate/engine/query/NamedParameterDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/query/NamedParameterDescriptor.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/core/src/main/java/org/hibernate/engine/query/NamedParameterDescriptor.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -35,7 +35,7 @@
*/
public class NamedParameterDescriptor implements Serializable {
private final String name;
- private final Type expectedType;
+ private Type expectedType;
private final int[] sourceLocations;
private final boolean jpaStyle;
@@ -61,4 +61,8 @@
public boolean isJpaStyle() {
return jpaStyle;
}
+
+ public void resetExpectedType(Type type) {
+ this.expectedType = type;
+ }
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -27,8 +27,8 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.persistence.EntityNotFoundException;
import javax.persistence.EntityTransaction;
import javax.persistence.FlushModeType;
@@ -59,6 +59,7 @@
import org.hibernate.*;
import org.hibernate.cfg.Environment;
+import org.hibernate.ejb.criteria.ValueConverter;
import org.hibernate.ejb.transaction.JoinableCMTTransaction;
import org.hibernate.ejb.util.ConfigurationHelper;
import org.hibernate.ejb.criteria.CriteriaQueryCompiler;
@@ -66,6 +67,7 @@
import org.hibernate.engine.SessionImplementor;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.transaction.TransactionFactory;
+import org.hibernate.transform.BasicTransformerAdapter;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.JTAHelper;
@@ -140,6 +142,45 @@
}
}
+ public <T> TypedQuery<T> createQuery(
+ String jpaqlString,
+ Class<T> resultClass,
+ Options options) {
+ try {
+ org.hibernate.Query hqlQuery = getSession().createQuery( jpaqlString );
+ if ( options.getConversions() != null ) {
+ hqlQuery.setResultTransformer( new ValueConversionResultTransformer( options.getConversions() ) );
+ }
+ else {
+ options.getResultMetadataValidator().validate( hqlQuery.getReturnTypes() );
+ }
+ return new QueryImpl<T>( hqlQuery, this, options.getNamedParameterExplicitTypes() );
+ }
+ catch ( HibernateException he ) {
+ throw convert( he );
+ }
+ }
+
+ private static class ValueConversionResultTransformer extends BasicTransformerAdapter {
+ private List<ValueConverter.Conversion> conversions;
+
+ private ValueConversionResultTransformer(List<ValueConverter.Conversion> conversions) {
+ this.conversions = conversions;
+ }
+
+ @Override
+ public Object transformTuple(Object[] tuple, String[] aliases) {
+ Object[] result = new Object[ tuple.length ];
+ for ( int i = 0; i < tuple.length; i++ ) {
+ ValueConverter.Conversion conversion = conversions.get( i );
+ result[i] = conversion == null
+ ? tuple[i]
+ : conversion.apply( tuple[i] );
+ }
+ return result.length == 1 ? result[0] : result;
+ }
+ }
+
private CriteriaQueryCompiler criteriaQueryCompiler;
public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernateEntityManagerImplementor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernateEntityManagerImplementor.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernateEntityManagerImplementor.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -25,11 +25,16 @@
import javax.persistence.PersistenceException;
import javax.persistence.LockModeType;
+import javax.persistence.TypedQuery;
import org.hibernate.HibernateException;
import org.hibernate.StaleStateException;
import org.hibernate.LockOptions;
+import org.hibernate.ejb.criteria.ValueConverter;
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.type.Type;
+import java.util.List;
import java.util.Map;
/**
@@ -108,4 +113,38 @@
* @return the LockOptions
*/
public LockOptions getLockRequest(LockModeType lockModeType, Map<String, Object> properties);
+
+ public static interface Options {
+ public static interface ResultMetadataValidator {
+ public void validate(Type[] returnTypes);
+ }
+
+ /**
+ * Get the conversions for the individual tuples in the query results.
+ *
+ * @return Value conversions to be applied to the JPA QL results
+ */
+ public List<ValueConverter.Conversion> getConversions();
+
+ /**
+ * Get the explicit parameter types. Generally speaking these would apply to implicit named
+ * parameters.
+ *
+ * @return The
+ */
+ public Map<String,Class> getNamedParameterExplicitTypes();
+
+ public ResultMetadataValidator getResultMetadataValidator();
+ }
+
+ /**
+ * Used during "compiling" a JPA criteria query.
+ *
+ * @param jpaqlString The criteria query rendered as a JPA QL string
+ * @param resultClass The result type (the type expected in the result list)
+ * @param options The options to use to build the query.
+ * @param <T> The query type
+ * @return The typed query
+ */
+ public <T> TypedQuery<T> createQuery(String jpaqlString, Class<T> resultClass, Options options);
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/QueryImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/QueryImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/QueryImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -25,9 +25,11 @@
import java.util.Calendar;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.persistence.NoResultException;
@@ -56,6 +58,7 @@
import org.hibernate.engine.query.OrdinalParameterDescriptor;
import org.hibernate.hql.QueryExecutionRequestException;
import org.hibernate.impl.AbstractQueryImpl;
+import org.hibernate.type.TypeFactory;
/**
* Hibernate implementation of both the {@link Query} and {@link TypedQuery} contracts.
@@ -72,13 +75,20 @@
private Set<Parameter<?>> parameters;
public QueryImpl(org.hibernate.Query query, AbstractEntityManagerImpl em) {
+ this( query, em, Collections.<String, Class>emptyMap() );
+ }
+
+ public QueryImpl(
+ org.hibernate.Query query,
+ AbstractEntityManagerImpl em,
+ Map<String,Class> namedParameterTypeRedefinitions) {
super( em );
this.query = query;
- extractParameterInfo();
+ extractParameterInfo( namedParameterTypeRedefinitions );
}
@SuppressWarnings({ "unchecked", "RedundantCast" })
- private void extractParameterInfo() {
+ private void extractParameterInfo(Map<String,Class> namedParameterTypeRedefinition) {
if ( ! AbstractQueryImpl.class.isInstance( query ) ) {
throw new IllegalStateException( "Unknown query type for parameter extraction" );
}
@@ -90,12 +100,16 @@
for ( String name : (Set<String>) queryImpl.getParameterMetadata().getNamedParameterNames() ) {
final NamedParameterDescriptor descriptor =
queryImpl.getParameterMetadata().getNamedParameterDescriptor( name );
- final ParameterImpl parameter = new ParameterImpl(
- name,
- descriptor.getExpectedType() == null
- ? null
- : descriptor.getExpectedType().getReturnedClass()
- );
+ Class javaType = namedParameterTypeRedefinition.get( name );
+ if ( javaType != null ) {
+ descriptor.resetExpectedType(
+ TypeFactory.heuristicType( javaType.getName() )
+ );
+ }
+ else if ( descriptor.getExpectedType() != null ) {
+ javaType = descriptor.getExpectedType().getReturnedClass();
+ }
+ final ParameterImpl parameter = new ParameterImpl( name, javaType );
parameters.add( parameter );
if ( descriptor.isJpaStyle() ) {
if ( jpaPositionalIndices == null ) {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaBuilderImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaBuilderImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaBuilderImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -48,6 +48,7 @@
import org.hibernate.ejb.criteria.expression.CollectionExpression;
import org.hibernate.ejb.criteria.expression.CompoundSelectionImpl;
import org.hibernate.ejb.criteria.expression.ConcatExpression;
+import org.hibernate.ejb.criteria.ExpressionImplementor;
import org.hibernate.ejb.criteria.expression.ParameterExpressionImpl;
import org.hibernate.ejb.criteria.expression.LiteralExpression;
import org.hibernate.ejb.criteria.expression.NullifExpression;
@@ -1062,50 +1063,50 @@
/**
* {@inheritDoc}
*/
- public Expression<Long> toLong(Expression<? extends Number> expression) {
- return expression.as( Long.class );
+ public ExpressionImplementor<Long> toLong(Expression<? extends Number> expression) {
+ return ( (ExpressionImplementor<? extends Number>) expression ).asLong();
}
/**
* {@inheritDoc}
*/
- public Expression<Integer> toInteger(Expression<? extends Number> expression) {
- return expression.as( Integer.class );
+ public ExpressionImplementor<Integer> toInteger(Expression<? extends Number> expression) {
+ return ( (ExpressionImplementor<? extends Number>) expression ).asInteger();
}
/**
* {@inheritDoc}
*/
- public Expression<Float> toFloat(Expression<? extends Number> expression) {
- return expression.as( Float.class );
+ public ExpressionImplementor<Float> toFloat(Expression<? extends Number> expression) {
+ return ( (ExpressionImplementor<? extends Number>) expression ).asFloat();
}
/**
* {@inheritDoc}
*/
- public Expression<Double> toDouble(Expression<? extends Number> expression) {
- return expression.as( Double.class );
+ public ExpressionImplementor<Double> toDouble(Expression<? extends Number> expression) {
+ return ( (ExpressionImplementor<? extends Number>) expression ).asDouble();
}
/**
* {@inheritDoc}
*/
- public Expression<BigDecimal> toBigDecimal(Expression<? extends Number> expression) {
- return expression.as( BigDecimal.class );
+ public ExpressionImplementor<BigDecimal> toBigDecimal(Expression<? extends Number> expression) {
+ return ( (ExpressionImplementor<? extends Number>) expression ).asBigDecimal();
}
/**
* {@inheritDoc}
*/
- public Expression<BigInteger> toBigInteger(Expression<? extends Number> expression) {
- return expression.as( BigInteger.class );
+ public ExpressionImplementor<BigInteger> toBigInteger(Expression<? extends Number> expression) {
+ return ( (ExpressionImplementor<? extends Number>) expression ).asBigInteger();
}
/**
* {@inheritDoc}
*/
- public Expression<String> toString(Expression<Character> characterExpression) {
- return characterExpression.as( String.class );
+ public ExpressionImplementor<String> toString(Expression<Character> characterExpression) {
+ return ( (ExpressionImplementor<Character>) characterExpression ).asString();
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryCompiler.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryCompiler.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryCompiler.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -55,6 +55,8 @@
*/
public class CriteriaQueryCompiler {
public static interface ImplicitParameterBinding {
+ public String getParameterName();
+ public Class getJavaType();
public void bind(TypedQuery typedQuery);
}
@@ -70,6 +72,8 @@
public static interface RenderedCriteriaQuery {
public String getQueryString();
+ public List<ValueConverter.Conversion> getValueConversions();
+ public HibernateEntityManagerImplementor.Options.ResultMetadataValidator getResultMetadataValidator();
}
private final HibernateEntityManagerImplementor entityManager;
@@ -85,6 +89,7 @@
final Map<ParameterExpression<?>,String> explicitParameterMapping = new HashMap<ParameterExpression<?>,String>();
final Map<String,ParameterExpression<?>> explicitParameterNameMapping = new HashMap<String,ParameterExpression<?>>();
final List<ImplicitParameterBinding> implicitParameterBindings = new ArrayList<ImplicitParameterBinding>();
+ final Map<String,Class> implicitParameterTypes = new HashMap<String, Class>();
RenderingContext renderingContext = new RenderingContext() {
private int aliasCount = 0;
@@ -110,6 +115,10 @@
public void registerImplicitParameterBinding(ImplicitParameterBinding binding) {
implicitParameterBindings.add( binding );
+ implicitParameterTypes.put(
+ binding.getParameterName(),
+ binding.getJavaType()
+ );
}
public String getCastType(Class javaType) {
@@ -132,12 +141,26 @@
}
};
- RenderedCriteriaQuery renderedCriteriaQuery = criteriaQueryImpl.render( renderingContext );
+ final RenderedCriteriaQuery renderedCriteriaQuery = criteriaQueryImpl.render( renderingContext );
TypedQuery<T> jpaqlQuery = entityManager.createQuery(
renderedCriteriaQuery.getQueryString(),
- criteriaQuery.getResultType()
+ criteriaQuery.getResultType(),
+ new HibernateEntityManagerImplementor.Options() {
+ public List<ValueConverter.Conversion> getConversions() {
+ return renderedCriteriaQuery.getValueConversions();
+ }
+
+ public Map<String, Class> getNamedParameterExplicitTypes() {
+ return implicitParameterTypes;
+ }
+
+ public ResultMetadataValidator getResultMetadataValidator() {
+ return renderedCriteriaQuery.getResultMetadataValidator();
+ }
+ }
);
+
for ( ImplicitParameterBinding implicitParameterBinding : implicitParameterBindings ) {
implicitParameterBinding.bind( jpaqlQuery );
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/CriteriaQueryImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -38,6 +38,9 @@
import javax.persistence.criteria.Subquery;
import javax.persistence.metamodel.EntityType;
+import org.hibernate.ejb.HibernateEntityManagerImplementor;
+import org.hibernate.type.Type;
+
/**
* The Hibernate implementation of the JPA {@link CriteriaQuery} contract. Mostly a set of delegation to its
* internal {@link QueryStructure}.
@@ -350,6 +353,41 @@
public String getQueryString() {
return jpaqlQuery.toString();
}
+
+ @SuppressWarnings({ "unchecked" })
+ public List<ValueConverter.Conversion> getValueConversions() {
+ SelectionImplementor selection = (SelectionImplementor) queryStructure.getSelection();
+ return selection == null
+ ? null
+ : selection.getConversions();
+ }
+
+ public HibernateEntityManagerImplementor.Options.ResultMetadataValidator getResultMetadataValidator() {
+ return new HibernateEntityManagerImplementor.Options.ResultMetadataValidator() {
+ public void validate(Type[] returnTypes) {
+ SelectionImplementor selection = (SelectionImplementor) queryStructure.getSelection();
+ if ( selection != null ) {
+ if ( selection.isCompoundSelection() ) {
+ if ( returnTypes.length != selection.getCompoundSelectionItems().size() ) {
+ throw new IllegalStateException(
+ "Number of return values [" + returnTypes.length +
+ "] did not match expected [" +
+ selection.getCompoundSelectionItems().size() + "]"
+ );
+ }
+ }
+ else {
+ if ( returnTypes.length > 1 ) {
+ throw new IllegalStateException(
+ "Number of return values [" + returnTypes.length +
+ "] did not match expected [1]"
+ );
+ }
+ }
+ }
+ }
+ };
+ }
};
}
}
Copied: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ExpressionImplementor.java (from rev 18253, core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImplementor.java)
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ExpressionImplementor.java (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ExpressionImplementor.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ *
+ * 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.ejb.criteria;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import javax.persistence.criteria.Expression;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface ExpressionImplementor<T> extends SelectionImplementor<T>, Expression<T>, Renderable {
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toLong}
+ *
+ * @return <tt>this</tt> but as a long
+ */
+ public ExpressionImplementor<Long> asLong();
+
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toInteger}
+ *
+ * @return <tt>this</tt> but as an integer
+ */
+ public ExpressionImplementor<Integer> asInteger();
+
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toFloat}
+ *
+ * @return <tt>this</tt> but as a float
+ */
+ public ExpressionImplementor<Float> asFloat();
+
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toDouble}
+ *
+ * @return <tt>this</tt> but as a double
+ */
+ public ExpressionImplementor<Double> asDouble();
+
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toBigDecimal}
+ *
+ * @return <tt>this</tt> but as a {@link BigDecimal}
+ */
+ public ExpressionImplementor<BigDecimal> asBigDecimal();
+
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toBigInteger}
+ *
+ * @return <tt>this</tt> but as a {@link BigInteger}
+ */
+ public ExpressionImplementor<BigInteger> asBigInteger();
+
+ /**
+ * See {@link javax.persistence.criteria.CriteriaBuilder#toString}
+ *
+ * @return <tt>this</tt> but as a string
+ */
+ public ExpressionImplementor<String> asString();
+}
Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/SelectionImplementor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/SelectionImplementor.java (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/SelectionImplementor.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,36 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.criteria;
+
+import java.util.List;
+import javax.persistence.criteria.Selection;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface SelectionImplementor<X> extends TupleElementImplementor<X>, Selection<X> {
+ public List<ValueConverter.Conversion> getConversions();
+}
Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/TupleElementImplementor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/TupleElementImplementor.java (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/TupleElementImplementor.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,35 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.criteria;
+
+import javax.persistence.TupleElement;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface TupleElementImplementor<X> extends TupleElement<X> {
+ public ValueConverter.Conversion<X> getConversion();
+}
Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ValueConverter.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ValueConverter.java (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/ValueConverter.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,255 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.criteria;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+/**
+ * Helper for generically converting a values into another type.
+ *
+ * @author Steve Ebersole
+ */
+public class ValueConverter {
+ private ValueConverter() {
+ }
+
+ public static interface Conversion<T> {
+ public T apply(Object value);
+ }
+
+ public static class ByteConversion implements Conversion<Byte> {
+ public static final ByteConversion INSTANCE = new ByteConversion();
+ @SuppressWarnings({ "UnnecessaryBoxing" })
+ public Byte apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return Byte.valueOf( ( (Number) value ).byteValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return Byte.valueOf( ( (String) value ) );
+ }
+ throw unknownConversion( value, Byte.class );
+ }
+ }
+
+ public static class ShortConversion implements Conversion<Short> {
+ public static final ShortConversion INSTANCE = new ShortConversion();
+ @SuppressWarnings({ "UnnecessaryBoxing" })
+ public Short apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return Short.valueOf( ( (Number) value ).shortValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return Short.valueOf( ( (String) value ) );
+ }
+ throw unknownConversion( value, Short.class );
+ }
+ }
+
+ public static class IntegerConversion implements Conversion<Integer> {
+ public static final IntegerConversion INSTANCE = new IntegerConversion();
+ @SuppressWarnings({ "UnnecessaryBoxing" })
+ public Integer apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return Integer.valueOf( ( (Number) value ).intValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return Integer.valueOf( ( (String) value ) );
+ }
+ throw unknownConversion( value, Integer.class );
+ }
+ }
+
+ public static class LongConversion implements Conversion<Long> {
+ public static final LongConversion INSTANCE = new LongConversion();
+ @SuppressWarnings({ "UnnecessaryBoxing" })
+ public Long apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return Long.valueOf( ( (Number) value ).longValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return Long.valueOf( ( (String) value ) );
+ }
+ throw unknownConversion( value, Long.class );
+ }
+ }
+
+ public static class FloatConversion implements Conversion<Float> {
+ public static final FloatConversion INSTANCE = new FloatConversion();
+ @SuppressWarnings({ "UnnecessaryBoxing" })
+ public Float apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return Float.valueOf( ( (Number) value ).floatValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return Float.valueOf( ( (String) value ) );
+ }
+ throw unknownConversion( value, Float.class );
+ }
+ }
+
+ public static class DoubleConversion implements Conversion<Double> {
+ public static final DoubleConversion INSTANCE = new DoubleConversion();
+ @SuppressWarnings({ "UnnecessaryBoxing" })
+ public Double apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return Double.valueOf( ( (Number) value ).doubleValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return Double.valueOf( ( (String) value ) );
+ }
+ throw unknownConversion( value, Double.class );
+ }
+ }
+
+ public static class BigIntegerConversion implements Conversion<BigInteger> {
+ public static final BigIntegerConversion INSTANCE = new BigIntegerConversion();
+ public BigInteger apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( Number.class.isInstance( value ) ) {
+ return BigInteger.valueOf( ( (Number) value ).longValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return new BigInteger( (String) value );
+ }
+ throw unknownConversion( value, BigInteger.class );
+ }
+ }
+
+ public static class BigDecimalConversion implements Conversion<BigDecimal> {
+ public static final BigDecimalConversion INSTANCE = new BigDecimalConversion();
+ public BigDecimal apply(Object value) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( BigInteger.class.isInstance( value ) ) {
+ return new BigDecimal( (BigInteger) value );
+ }
+ else if ( Number.class.isInstance( value ) ) {
+ return BigDecimal.valueOf( ( (Number) value ).doubleValue() );
+ }
+ else if ( String.class.isInstance( value ) ) {
+ return new BigDecimal( (String) value );
+ }
+ throw unknownConversion( value, BigDecimal.class );
+ }
+ }
+
+ public static class StringConversion implements Conversion<String> {
+ public static final StringConversion INSTANCE = new StringConversion();
+ public String apply(Object value) {
+ return value == null ? null : value.toString();
+ }
+ }
+
+ private static IllegalArgumentException unknownConversion(Object value, Class type) {
+ return new IllegalArgumentException(
+ "Unaware how to convert value [" + value + "] to requested type [" + type.getName() + "]"
+ );
+ }
+
+ /**
+ * Convert the given value into the specified target type.
+ *
+ * @param value The value to convert
+ * @param targetType The type to which it should be converted
+ *
+ * @return The converted value.
+ */
+ @SuppressWarnings({ "unchecked" })
+ public static <T> T convert(Object value, Class<T> targetType) {
+ if ( value == null ) {
+ return null;
+ }
+ if ( targetType.equals( value.getClass() ) ) {
+ return (T) value;
+ }
+
+ Conversion<T> conversion = determineAppropriateConversion( targetType );
+ if ( conversion == null ) {
+ throw unknownConversion( value, targetType );
+ }
+ return conversion.apply( value );
+ }
+
+ /**
+ * Determine the appropriate {@link Conversion} strategy for converting a value
+ * to the given target type
+ *
+ * @param targetType The target type (to which we want to convert values).
+ * @param <T> parameterized type for the target type.
+ * @return The conversion
+ */
+ @SuppressWarnings({ "unchecked" })
+ public static <T> Conversion<T> determineAppropriateConversion(Class<T> targetType) {
+ if ( String.class.equals( targetType ) ) {
+ return (Conversion<T>) StringConversion.INSTANCE;
+ }
+ if ( Byte.class.equals( targetType ) ) {
+ return (Conversion<T>) ByteConversion.INSTANCE;
+ }
+ if ( Short.class.equals( targetType ) ) {
+ return (Conversion<T>) ShortConversion.INSTANCE;
+ }
+ if ( Integer.class.equals( targetType ) ) {
+ return (Conversion<T>) IntegerConversion.INSTANCE;
+ }
+ if ( Long.class.equals( targetType ) ) {
+ return (Conversion<T>) LongConversion.INSTANCE;
+ }
+ if ( Float.class.equals( targetType ) ) {
+ return (Conversion<T>) FloatConversion.INSTANCE;
+ }
+ if ( Double.class.equals( targetType ) ) {
+ return (Conversion<T>) DoubleConversion.INSTANCE;
+ }
+ if ( BigInteger.class.equals( targetType ) ) {
+ return (Conversion<T>) BigIntegerConversion.INSTANCE;
+ }
+ if ( BigDecimal.class.equals( targetType ) ) {
+ return (Conversion<T>) BigDecimalConversion.INSTANCE;
+ }
+ return null;
+ }
+}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/AbstractTupleElement.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/AbstractTupleElement.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/AbstractTupleElement.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -23,22 +23,27 @@
*/
package org.hibernate.ejb.criteria.expression;
-import javax.persistence.TupleElement;
-
import org.hibernate.ejb.criteria.AbstractNode;
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
+import org.hibernate.ejb.criteria.TupleElementImplementor;
+import org.hibernate.ejb.criteria.ValueConverter;
/**
* TODO : javadoc
*
* @author Steve Ebersole
*/
-public abstract class AbstractTupleElement<X> extends AbstractNode implements TupleElement<X> {
- private final Class<X> javaType;
+public abstract class AbstractTupleElement<X>
+ extends AbstractNode
+ implements TupleElementImplementor<X> {
+ private final Class originalJavaType;
+ private Class<X> javaType;
private String alias;
+ private ValueConverter.Conversion<X> conversion;
protected AbstractTupleElement(CriteriaBuilderImpl criteriaBuilder, Class<X> javaType) {
super( criteriaBuilder );
+ this.originalJavaType = javaType;
this.javaType = javaType;
}
@@ -49,9 +54,29 @@
return javaType;
}
+ @SuppressWarnings({ "unchecked" })
+ protected void resetJavaType(Class targetType) {
+ this.javaType = targetType;
+// this.conversion = javaType.equals( originalJavaType )
+// ? null
+// : ValueConverter.determineAppropriateConversion( javaType );
+ this.conversion = ValueConverter.determineAppropriateConversion( javaType );
+ }
+
+ protected void forceConversion(ValueConverter.Conversion<X> conversion) {
+ this.conversion = conversion;
+ }
+
/**
* {@inheritDoc}
*/
+ public ValueConverter.Conversion<X> getConversion() {
+ return conversion;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getAlias() {
return alias;
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/CompoundSelectionImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/CompoundSelectionImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/CompoundSelectionImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -23,6 +23,7 @@
*/
package org.hibernate.ejb.criteria.expression;
+import java.util.ArrayList;
import java.util.List;
import javax.persistence.Tuple;
import javax.persistence.criteria.CompoundSelection;
@@ -32,6 +33,8 @@
import org.hibernate.ejb.criteria.ParameterRegistry;
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
import org.hibernate.ejb.criteria.Renderable;
+import org.hibernate.ejb.criteria.TupleElementImplementor;
+import org.hibernate.ejb.criteria.ValueConverter;
/**
* The Hibernate implementation of the JPA {@link CompoundSelection}
@@ -62,6 +65,21 @@
return selectionItems;
}
+ @Override
+ public List<ValueConverter.Conversion> getConversions() {
+ if ( isConstructor ) {
+ return null;
+ }
+ boolean foundConversions = false;
+ ArrayList<ValueConverter.Conversion> conversions = new ArrayList<ValueConverter.Conversion>();
+ for ( Selection selection : getCompoundSelectionItems() ) {
+ ValueConverter.Conversion conversion = ( (TupleElementImplementor) selection ).getConversion();
+ conversions.add( conversion );
+ foundConversions = foundConversions || conversion != null;
+ }
+ return foundConversions ? null : conversions;
+ }
+
public void registerParameters(ParameterRegistry registry) {
for ( Selection selectionItem : getCompoundSelectionItems() ) {
Helper.possibleParameter(selectionItem, registry);
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -23,11 +23,14 @@
*/
package org.hibernate.ejb.criteria.expression;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
+import org.hibernate.ejb.criteria.ExpressionImplementor;
import org.hibernate.ejb.criteria.expression.function.CastFunction;
/**
@@ -93,4 +96,67 @@
public Predicate in(Expression<Collection<?>> values) {
return queryBuilder().in( this, values );
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<Long> asLong() {
+ resetJavaType( Long.class );
+ return (ExpressionImplementor<Long>) this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<Integer> asInteger() {
+ resetJavaType( Integer.class );
+ return (ExpressionImplementor<Integer>) this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<Float> asFloat() {
+ resetJavaType( Float.class );
+ return (ExpressionImplementor<Float>) this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<Double> asDouble() {
+ resetJavaType( Double.class );
+ return (ExpressionImplementor<Double>) this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<BigDecimal> asBigDecimal() {
+ resetJavaType( BigDecimal.class );
+ return (ExpressionImplementor<BigDecimal>) this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<BigInteger> asBigInteger() {
+ resetJavaType( BigInteger.class );
+ return (ExpressionImplementor<BigInteger>) this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked" })
+ public ExpressionImplementor<String> asString() {
+ resetJavaType( String.class );
+ return (ExpressionImplementor<String>) this;
+ }
}
Deleted: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImplementor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImplementor.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImplementor.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -1,36 +0,0 @@
-/*
- * 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.
- *
- * 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.ejb.criteria.expression;
-
-import javax.persistence.criteria.Expression;
-
-import org.hibernate.ejb.criteria.Renderable;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public interface ExpressionImplementor<T> extends Expression<T>, Renderable {
-}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/LiteralExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/LiteralExpression.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/LiteralExpression.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -25,6 +25,7 @@
import javax.persistence.TypedQuery;
+import org.hibernate.ejb.criteria.ValueConverter;
import org.hibernate.ejb.criteria.ParameterRegistry;
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
import org.hibernate.ejb.criteria.CriteriaQueryCompiler;
@@ -35,7 +36,7 @@
* @author Steve Ebersole
*/
public class LiteralExpression<T> extends ExpressionImpl<T> {
- private final T literal;
+ private Object literal;
@SuppressWarnings({ "unchecked" })
public LiteralExpression(CriteriaBuilderImpl criteriaBuilder, T literal) {
@@ -51,18 +52,27 @@
this.literal = literal;
}
+ @SuppressWarnings({ "unchecked" })
public T getLiteral() {
- return literal;
+ return (T) literal;
}
public void registerParameters(ParameterRegistry registry) {
- // nothign to do
+ // nothing to do
}
public String render(CriteriaQueryCompiler.RenderingContext renderingContext) {
final String parameterName = renderingContext.generateParameterName();
renderingContext.registerImplicitParameterBinding(
new CriteriaQueryCompiler.ImplicitParameterBinding() {
+ public String getParameterName() {
+ return parameterName;
+ }
+
+ public Class getJavaType() {
+ return LiteralExpression.this.getJavaType();
+ }
+
public void bind(TypedQuery typedQuery) {
typedQuery.setParameter( parameterName, getLiteral() );
}
@@ -74,4 +84,19 @@
public String renderProjection(CriteriaQueryCompiler.RenderingContext renderingContext) {
return render( renderingContext );
}
+
+ @Override
+ @SuppressWarnings({ "unchecked" })
+ protected void resetJavaType(Class targetType) {
+ super.resetJavaType( targetType );
+ ValueConverter.Conversion conversion = getConversion();
+ if ( conversion == null ) {
+ conversion = ValueConverter.determineAppropriateConversion( targetType );
+ forceConversion( conversion );
+ }
+
+ if ( conversion != null ) {
+ literal = conversion.apply( literal );
+ }
+ }
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SelectionImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SelectionImpl.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SelectionImpl.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -23,11 +23,14 @@
*/
package org.hibernate.ejb.criteria.expression;
+import java.util.Collections;
import java.util.List;
import javax.persistence.criteria.Selection;
import org.hibernate.ejb.criteria.ParameterContainer;
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
+import org.hibernate.ejb.criteria.SelectionImplementor;
+import org.hibernate.ejb.criteria.ValueConverter;
/**
* The Hibernate implementation of the JPA {@link Selection}
@@ -37,7 +40,7 @@
*/
public abstract class SelectionImpl<X>
extends AbstractTupleElement<X>
- implements Selection<X>, ParameterContainer {
+ implements SelectionImplementor<X>, ParameterContainer {
public SelectionImpl(CriteriaBuilderImpl criteriaBuilder, Class<X> javaType) {
super( criteriaBuilder, javaType );
}
@@ -51,6 +54,12 @@
return false;
}
+ public List<ValueConverter.Conversion> getConversions() {
+ return getConversion() == null
+ ? null
+ : Collections.singletonList( (ValueConverter.Conversion) getConversion() );
+ }
+
public List<Selection<?>> getCompoundSelectionItems() {
throw new IllegalStateException( "Not a compund selection" );
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/ComparisonPredicate.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/ComparisonPredicate.java 2009-12-18 12:01:33 UTC (rev 18267)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/ComparisonPredicate.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -25,6 +25,7 @@
import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.ValueConverter;
import org.hibernate.ejb.criteria.ParameterRegistry;
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
import org.hibernate.ejb.criteria.CriteriaQueryCompiler;
@@ -62,9 +63,31 @@
super( criteriaBuilder );
this.comparisonOperator = comparisonOperator;
this.leftHandSide = leftHandSide;
- this.rightHandSide = new LiteralExpression( criteriaBuilder, rightHandSide );
+ if ( Number.class.isAssignableFrom( leftHandSide.getJavaType() ) ) {
+ this.rightHandSide = new LiteralExpression(
+ criteriaBuilder,
+ ValueConverter.convert( rightHandSide, (Class<Number>) leftHandSide.getJavaType() )
+ );
+ }
+ else {
+ this.rightHandSide = new LiteralExpression( criteriaBuilder, rightHandSide );
+ }
}
+ public <N extends Number> ComparisonPredicate(
+ CriteriaBuilderImpl criteriaBuilder,
+ ComparisonOperator comparisonOperator,
+ Expression<N> leftHandSide,
+ Number rightHandSide) {
+ super( criteriaBuilder );
+ this.comparisonOperator = comparisonOperator;
+ this.leftHandSide = leftHandSide;
+ this.rightHandSide = new LiteralExpression<N>(
+ criteriaBuilder,
+ ValueConverter.convert( rightHandSide, leftHandSide.getJavaType() )
+ );
+ }
+
public ComparisonOperator getComparisonOperator() {
return isNegated()
? comparisonOperator.negated()
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/QueryBuilderTest.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/QueryBuilderTest.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/QueryBuilderTest.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,190 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.criteria;
+
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Root;
+import javax.persistence.metamodel.EntityType;
+
+import org.hibernate.ejb.criteria.predicate.ComparisonPredicate;
+import org.hibernate.ejb.metamodel.Address;
+import org.hibernate.ejb.metamodel.Alias;
+import org.hibernate.ejb.metamodel.Country;
+import org.hibernate.ejb.metamodel.CreditCard;
+import org.hibernate.ejb.metamodel.Customer;
+import org.hibernate.ejb.metamodel.Info;
+import org.hibernate.ejb.metamodel.LineItem;
+import org.hibernate.ejb.metamodel.Order;
+import org.hibernate.ejb.metamodel.MetamodelImpl;
+import org.hibernate.ejb.metamodel.Phone;
+import org.hibernate.ejb.metamodel.Product;
+import org.hibernate.ejb.metamodel.ShelfLife;
+import org.hibernate.ejb.metamodel.Spouse;
+import org.hibernate.ejb.test.TestCase;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class QueryBuilderTest extends TestCase {
+ @Override
+ public Class[] getAnnotatedClasses() {
+ return new Class[] {
+ Address.class,
+ Alias.class,
+ Country.class,
+ CreditCard.class,
+ Customer.class,
+ Info.class,
+ LineItem.class,
+ Order.class,
+ Phone.class,
+ Product.class,
+ ShelfLife.class,
+ Spouse.class
+ };
+ }
+
+ public void testEqualityComparisonLiteralConversion() {
+ EntityManager em = getOrCreateEntityManager();
+ em.getTransaction().begin();
+
+ CriteriaBuilderImpl cb = (CriteriaBuilderImpl) em.getCriteriaBuilder();
+ MetamodelImpl mm = (MetamodelImpl) em.getMetamodel();
+
+ CriteriaQuery<Integer> cquery = cb.createQuery( Integer.class );
+ Root<Product> product = cquery.from( Product.class );
+ EntityType<Product> Product_ = mm.entity( Product.class );
+
+ cquery.select(
+ cb.toInteger(
+ product.get(
+ Product_.getSingularAttribute("quantity", Integer.class))
+ )
+ );
+
+ ComparisonPredicate predicate = (ComparisonPredicate) cb.equal(
+ product.get( Product_.getSingularAttribute( "partNumber", Long.class ) ),
+ 373767373
+ );
+ assertEquals( Long.class, predicate.getRightHandOperand().getJavaType() );
+ cquery.where( predicate );
+ em.createQuery( cquery ).getResultList();
+
+ predicate = (ComparisonPredicate) cb.ge(
+ cb.length( product.get( Product_.getSingularAttribute( "name", String.class ) ) ),
+ 4L
+ );
+ assertEquals( Integer.class, predicate.getRightHandOperand().getJavaType() );
+ cquery.where( predicate );
+ em.createQuery( cquery ).getResultList();
+
+ em.getTransaction().commit();
+ em.close();
+ }
+
+ public void testTypeConversion() {
+ EntityManager em = getOrCreateEntityManager();
+ em.getTransaction().begin();
+ CriteriaBuilderImpl cb = (CriteriaBuilderImpl) em.getCriteriaBuilder();
+ MetamodelImpl mm = (MetamodelImpl) em.getMetamodel();
+ EntityType<Product> Product_ = mm.entity( Product.class );
+
+ // toFloat
+ CriteriaQuery<Float> floatQuery = cb.createQuery( Float.class );
+ Root<Product> product = floatQuery.from( Product.class );
+ floatQuery.select(
+ cb.toFloat(
+ product.get(Product_.getSingularAttribute("quantity", Integer.class))
+ )
+ );
+ em.createQuery( floatQuery ).getResultList();
+
+ // toDouble
+ CriteriaQuery<Double> doubleQuery = cb.createQuery(Double.class);
+ product = doubleQuery.from( Product.class );
+ doubleQuery.select(
+ cb.toDouble(
+ product.get(Product_.getSingularAttribute("quantity", Integer.class))
+ )
+ );
+ em.createQuery( doubleQuery ).getResultList();
+
+ em.getTransaction().commit();
+ em.close();
+ }
+
+ public void testConstructor() {
+ EntityManager em = getOrCreateEntityManager();
+ em.getTransaction().begin();
+ CriteriaBuilderImpl cb = (CriteriaBuilderImpl) em.getCriteriaBuilder();
+ MetamodelImpl mm = (MetamodelImpl) em.getMetamodel();
+
+ CriteriaQuery<Customer> cquery = cb.createQuery(Customer.class);
+ Root<Customer> customer = cquery.from(Customer.class);
+ EntityType<Customer> Customer_ = customer.getModel();
+
+ cquery.select(
+ cb.construct(
+ Customer.class,
+ customer.get(Customer_.getSingularAttribute("id", String.class)),
+ customer.get(Customer_.getSingularAttribute("name", String.class))
+ )
+ );
+ TypedQuery<Customer> tq = em.createQuery(cquery);
+ tq.getResultList();
+
+ em.getTransaction().commit();
+ em.close();
+ }
+
+ public void testDateTimeFunctions() {
+ EntityManager em = getOrCreateEntityManager();
+ em.getTransaction().begin();
+ CriteriaBuilderImpl cb = (CriteriaBuilderImpl) em.getCriteriaBuilder();
+ MetamodelImpl mm = (MetamodelImpl) em.getMetamodel();
+
+ CriteriaQuery<java.sql.Date> dateQuery = cb.createQuery(java.sql.Date.class);
+ dateQuery.from( Customer.class );
+ dateQuery.select( cb.currentDate() );
+ em.createQuery( dateQuery ).getResultList();
+
+ CriteriaQuery<java.sql.Time> timeQuery = cb.createQuery(java.sql.Time.class);
+ timeQuery.from( Customer.class );
+ timeQuery.select( cb.currentTime() );
+ em.createQuery( timeQuery ).getResultList();
+
+ CriteriaQuery<java.sql.Timestamp> tsQuery = cb.createQuery(java.sql.Timestamp.class);
+ tsQuery.from( Customer.class );
+ tsQuery.select( cb.currentTimestamp() );
+ em.createQuery( tsQuery ).getResultList();
+
+ em.getTransaction().commit();
+ em.close();
+ }
+}
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Address.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Address.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Address.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,124 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import java.util.Collection;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "ADDRESS")
+public class Address implements java.io.Serializable {
+ private String id;
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+ private Collection<Phone> phones = new java.util.ArrayList<Phone>();
+
+ public Address() {
+ }
+
+ public Address(String id, String street, String city, String state, String zip) {
+ this.id = id;
+ this.street = street;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ }
+
+ public Address(String id, String street, String city, String state, String zip,
+ Collection<Phone> phones) {
+ this.id = id;
+ this.street = street;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ this.phones = phones;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Column(name = "STREET")
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ @Column(name = "CITY")
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ @Column(name = "STATE")
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ @Column(name = "ZIP")
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "address")
+ public Collection<Phone> getPhones() {
+ return phones;
+ }
+
+ public void setPhones(Collection<Phone> phones) {
+ this.phones = phones;
+ }
+}
\ No newline at end of file
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Alias.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Alias.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Alias.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,123 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import java.util.Collection;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "ALIAS_TABLE")
+public class Alias implements java.io.Serializable {
+ private String id;
+ private String alias;
+ private Customer customerNoop;
+ private Collection<Customer> customersNoop = new java.util.ArrayList<Customer>();
+ private Collection<Customer> customers = new java.util.ArrayList<Customer>();
+
+ public Alias() {
+ }
+
+ public Alias(String id, String alias) {
+ this.id = id;
+ this.alias = alias;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Column(name = "ALIAS")
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK1_FOR_CUSTOMER_TABLE", insertable = false, updatable = false)
+ public Customer getCustomerNoop() {
+ return customerNoop;
+ }
+
+ public void setCustomerNoop(Customer customerNoop) {
+ this.customerNoop = customerNoop;
+ }
+
+ @ManyToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "FKS_ANOOP_CNOOP",
+ joinColumns =
+ @JoinColumn(
+ name = "FK2_FOR_ALIAS_TABLE", referencedColumnName = "ID"),
+ inverseJoinColumns =
+ @JoinColumn(
+ name = "FK8_FOR_CUSTOMER_TABLE", referencedColumnName = "ID")
+ )
+ public Collection<Customer> getCustomersNoop() {
+ return customersNoop;
+ }
+
+ public void setCustomersNoop(Collection<Customer> customersNoop) {
+ this.customersNoop = customersNoop;
+
+ }
+
+ @ManyToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "FKS_ALIAS_CUSTOMER",
+ joinColumns =
+ @JoinColumn(
+ name = "FK_FOR_ALIAS_TABLE", referencedColumnName = "ID"),
+ inverseJoinColumns =
+ @JoinColumn(
+ name = "FK_FOR_CUSTOMER_TABLE", referencedColumnName = "ID")
+ )
+ public Collection<Customer> getCustomers() {
+ return customers;
+ }
+
+ public void setCustomers(Collection<Customer> customers) {
+ this.customers = customers;
+ }
+
+}
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Country.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Country.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Country.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,65 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import javax.persistence.Basic;
+import javax.persistence.Embeddable;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Embeddable
+public class Country implements java.io.Serializable {
+ private String country;
+ private String code;
+
+ public Country() {
+ }
+
+ public Country(String v1, String v2) {
+ country = v1;
+ code = v2;
+ }
+
+ @Basic
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String v) {
+ country = v;
+ }
+
+ @Basic
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String v) {
+ code = v;
+ }
+}
+
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/CreditCard.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/CreditCard.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/CreditCard.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,153 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "CREDITCARD_TABLE")
+public class CreditCard implements java.io.Serializable {
+ private String id;
+ private String number;
+ private String type;
+ private String expires;
+ private boolean approved;
+ private double balance;
+ private Order order;
+ private Customer customer;
+
+ public CreditCard() {
+ }
+
+ public CreditCard(
+ String v1, String v2, String v3, String v4,
+ boolean v5, double v6, Order v7, Customer v8) {
+ id = v1;
+ number = v2;
+ type = v3;
+ expires = v4;
+ approved = v5;
+ balance = v6;
+ order = v7;
+ customer = v8;
+ }
+
+ public CreditCard(
+ String v1, String v2, String v3, String v4,
+ boolean v5, double v6) {
+ id = v1;
+ number = v2;
+ type = v3;
+ expires = v4;
+ approved = v5;
+ balance = v6;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String v) {
+ id = v;
+ }
+
+ @Column(name = "CREDITCARD_NUMBER")
+ public String getNumber() {
+ return number;
+ }
+
+ public void setNumber(String v) {
+ number = v;
+ }
+
+ @Column(name = "TYPE")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String v) {
+ type = v;
+ }
+
+ @Column(name = "EXPIRES")
+ public String getExpires() {
+ return expires;
+ }
+
+ public void setExpires(String v) {
+ expires = v;
+ }
+
+ @Column(name = "APPROVED")
+ public boolean getApproved() {
+ return approved;
+ }
+
+ public void setApproved(boolean v) {
+ approved = v;
+ }
+
+ @Column(name = "BALANCE")
+ public double getBalance() {
+ return balance;
+ }
+
+ public void setBalance(double v) {
+ balance = v;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK_FOR_ORDER_TABLE")
+ public Order getOrder() {
+ return order;
+ }
+
+ public void setOrder(Order v) {
+ order = v;
+ }
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK3_FOR_CUSTOMER_TABLE")
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(Customer v) {
+ customer = v;
+ }
+}
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Customer.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Customer.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Customer.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,172 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import java.util.Collection;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToMany;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "CUSTOMER_TABLE")
+public class Customer implements java.io.Serializable {
+ private String id;
+ private String name;
+ private Address home;
+ private Address work;
+ private Country country;
+ private Spouse spouse;
+ private Collection<CreditCard> creditCards = new java.util.ArrayList<CreditCard>();
+ private Collection<Order> orders = new java.util.ArrayList<Order>();
+ private Collection<Alias> aliases = new java.util.ArrayList<Alias>();
+ private Collection<Alias> aliasesNoop = new java.util.ArrayList<Alias>();
+
+ public Customer() {
+ }
+
+ public Customer(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public Customer(String id, String name, Country country) {
+ this.id = id;
+ this.name = name;
+ this.country = country;
+ }
+
+ public Customer(String id, String name, Address home,
+ Address work, Country country) {
+ this.id = id;
+ this.name = name;
+ this.home = home;
+ this.work = work;
+ this.country = country;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String v) {
+ this.id = v;
+ }
+
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String v) {
+ this.name = v;
+ }
+
+ @Embedded
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country v) {
+ this.country = v;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK6_FOR_CUSTOMER_TABLE")
+ public Address getHome() {
+ return home;
+ }
+
+ public void setHome(Address v) {
+ this.home = v;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK5_FOR_CUSTOMER_TABLE")
+ public Address getWork() {
+ return work;
+ }
+
+ public void setWork(Address v) {
+ this.work = v;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL, mappedBy = "customer")
+ public Spouse getSpouse() {
+ return spouse;
+ }
+
+ public void setSpouse(Spouse v) {
+ this.spouse = v;
+ }
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
+ public Collection<CreditCard> getCreditCards() {
+ return creditCards;
+ }
+
+ public void setCreditCards(Collection<CreditCard> v) {
+ this.creditCards = v;
+ }
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
+ public Collection<Order> getOrders() {
+ return orders;
+ }
+
+ public void setOrders(Collection<Order> v) {
+ this.orders = v;
+ }
+
+ @ManyToMany(cascade = CascadeType.ALL, mappedBy = "customers")
+ public Collection<Alias> getAliases() {
+ return aliases;
+ }
+
+ public void setAliases(Collection<Alias> v) {
+ this.aliases = v;
+ }
+
+ @ManyToMany(cascade = CascadeType.ALL, mappedBy = "customersNoop")
+ public Collection<Alias> getAliasesNoop() {
+ return aliasesNoop;
+ }
+
+ public void setAliasesNoop(Collection<Alias> v) {
+ this.aliasesNoop = v;
+ }
+}
\ No newline at end of file
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Info.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Info.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Info.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,124 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "INFO_TABLE")
+public class Info implements java.io.Serializable {
+ private String id;
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+ private Spouse spouse;
+
+ public Info() {
+ }
+
+ public Info(String v1, String v2, String v3, String v4, String v5) {
+ id = v1;
+ street = v2;
+ city = v3;
+ state = v4;
+ zip = v5;
+ }
+
+ public Info(
+ String v1, String v2, String v3, String v4,
+ String v5, Spouse v6) {
+ id = v1;
+ street = v2;
+ city = v3;
+ state = v4;
+ zip = v5;
+ spouse = v6;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String v) {
+ id = v;
+ }
+
+ @Column(name = "INFOSTREET")
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String v) {
+ street = v;
+ }
+
+ @Column(name = "INFOSTATE")
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String v) {
+ state = v;
+ }
+
+ @Column(name = "INFOCITY")
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String v) {
+ city = v;
+ }
+
+ @Column(name = "INFOZIP")
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String v) {
+ zip = v;
+ }
+
+ @OneToOne(mappedBy = "info")
+ public Spouse getSpouse() {
+ return spouse;
+ }
+
+ public void setSpouse(Spouse v) {
+ this.spouse = v;
+ }
+
+}
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/LineItem.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/LineItem.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/LineItem.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,99 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "LINEITEM_TABLE")
+public class LineItem implements java.io.Serializable {
+ private String id;
+ private int quantity;
+ private Order order;
+ private Product product;
+
+ public LineItem() {
+ }
+
+ public LineItem(String v1, int v2, Order v3, Product v4) {
+ id = v1;
+ quantity = v2;
+ order = v3;
+ product = v4;
+ }
+
+ public LineItem(String v1, int v2) {
+ id = v1;
+ quantity = v2;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String v) {
+ id = v;
+ }
+
+ @Column(name = "QUANTITY")
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int v) {
+ quantity = v;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "FK1_FOR_ORDER_TABLE")
+ public Order getOrder() {
+ return order;
+ }
+
+ public void setOrder(Order v) {
+ order = v;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "FK_FOR_PRODUCT_TABLE")
+ public Product getProduct() {
+ return product;
+ }
+
+ public void setProduct(Product v) {
+ product = v;
+ }
+}
\ No newline at end of file
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Order.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Order.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Order.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,141 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import java.util.Collection;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "ORDER_TABLE")
+public class Order implements java.io.Serializable {
+ private String id;
+ private double totalPrice;
+ private Customer customer;
+ private CreditCard creditCard;
+ private LineItem sampleLineItem;
+ private Collection<LineItem> lineItems = new java.util.ArrayList<LineItem>();
+
+ public Order() {
+ }
+
+ public Order(String id, double totalPrice) {
+ this.id = id;
+ this.totalPrice = totalPrice;
+ }
+
+ public Order(String id, Customer customer) {
+ this.id = id;
+ this.customer = customer;
+ }
+
+ public Order(String id) {
+ this.id = id;
+ }
+
+ //====================================================================
+ // getters and setters for State fields
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Column(name = "TOTALPRICE")
+ public double getTotalPrice() {
+ return totalPrice;
+ }
+
+ public void setTotalPrice(double price) {
+ this.totalPrice = price;
+ }
+
+ //====================================================================
+ // getters and setters for Association fields
+
+ // MANYx1
+
+ @ManyToOne
+ @JoinColumn(
+ name = "FK4_FOR_CUSTOMER_TABLE")
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ //1x1
+
+ @OneToOne(mappedBy = "order")
+ public CreditCard getCreditCard() {
+ return creditCard;
+ }
+
+ public void setCreditCard(CreditCard cc) {
+ this.creditCard = cc;
+ }
+
+ // 1x1
+
+ @OneToOne(cascade = CascadeType.REMOVE)
+ @JoinColumn(
+ name = "FK0_FOR_LINEITEM_TABLE")
+ public LineItem getSampleLineItem() {
+ return sampleLineItem;
+ }
+
+ public void setSampleLineItem(LineItem l) {
+ this.sampleLineItem = l;
+ }
+
+ //1xMANY
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "order")
+ public Collection<LineItem> getLineItems() {
+ return lineItems;
+ }
+
+ public void setLineItems(Collection<LineItem> c) {
+ this.lineItems = c;
+ }
+}
\ No newline at end of file
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Phone.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Phone.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Phone.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,99 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "PHONE_TABLE")
+public class Phone implements java.io.Serializable {
+ private String id;
+ private String area;
+ private String number;
+ private Address address;
+
+ public Phone() {
+ }
+
+ public Phone(String v1, String v2, String v3) {
+ id = v1;
+ area = v2;
+ number = v3;
+ }
+
+ public Phone(String v1, String v2, String v3, Address v4) {
+ id = v1;
+ area = v2;
+ number = v3;
+ address = v4;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String v) {
+ id = v;
+ }
+
+ @Column(name = "AREA")
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String v) {
+ area = v;
+ }
+
+ @Column(name = "PHONE_NUMBER")
+ public String getNumber() {
+ return number;
+ }
+
+ public void setNumber(String v) {
+ number = v;
+ }
+
+ @ManyToOne
+ @JoinColumn(name = "FK_FOR_ADDRESS")
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address a) {
+ address = a;
+ }
+}
\ No newline at end of file
Added: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Spouse.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Spouse.java (rev 0)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/metamodel/Spouse.java 2009-12-18 15:32:39 UTC (rev 18268)
@@ -0,0 +1,143 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, 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.ejb.metamodel;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "SPOUSE_TABLE")
+public class Spouse implements java.io.Serializable {
+ private String id;
+ private String first;
+ private String maiden;
+ private String last;
+ private String sNumber;
+ private Info info;
+ private Customer customer;
+
+ public Spouse() {
+ }
+
+ public Spouse(
+ String v1, String v2, String v3, String v4,
+ String v5, Info v6) {
+ id = v1;
+ first = v2;
+ maiden = v3;
+ last = v4;
+ sNumber = v5;
+ info = v6;
+ }
+
+
+ public Spouse(
+ String v1, String v2, String v3, String v4,
+ String v5, Info v6, Customer v7) {
+ id = v1;
+ first = v2;
+ maiden = v3;
+ last = v4;
+ sNumber = v5;
+ info = v6;
+ customer = v7;
+ }
+
+ @Id
+ @Column(name = "ID")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String v) {
+ id = v;
+ }
+
+ @Column(name = "FIRSTNAME")
+ public String getFirstName() {
+ return first;
+ }
+
+ public void setFirstName(String v) {
+ first = v;
+ }
+
+ @Column(name = "MAIDENNAME")
+ public String getMaidenName() {
+ return maiden;
+ }
+
+ public void setMaidenName(String v) {
+ maiden = v;
+ }
+
+ @Column(name = "LASTNAME")
+ public String getLastName() {
+ return last;
+ }
+
+ public void setLastName(String v) {
+ last = v;
+ }
+
+ @Column(name = "SOCSECNUM")
+ public String getSocialSecurityNumber() {
+ return sNumber;
+ }
+
+ public void setSocialSecurityNumber(String v) {
+ sNumber = v;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK_FOR_INFO_TABLE")
+ public Info getInfo() {
+ return info;
+ }
+
+ public void setInfo(Info v) {
+ info = v;
+ }
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "FK7_FOR_CUSTOMER_TABLE")
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(Customer v) {
+ customer = v;
+ }
+
+}
14 years, 12 months