Hibernate SVN: r20286 - core/trunk/documentation/quickstart/src/main/docbook/en-US/content.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-31 08:43:29 -0400 (Tue, 31 Aug 2010)
New Revision: 20286
Modified:
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
Log:
HHH-5442 - Write native tutorial chapter
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-31 11:09:44 UTC (rev 20285)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-31 12:43:29 UTC (rev 20286)
@@ -120,10 +120,15 @@
file is one choice for providing Hibernate with this metadata.
</para>
- <programlisting role="XML"><![CDATA[<class name="Event" table="EVENTS">...</class>]]></programlisting>
+ <example id="hibernate-gsg-tutorial-basic-mapping-class">
+ <title>The <literal>class</literal> mapping element</title>
+ <programlisting role="XML"><![CDATA[<class name="Event" table="EVENTS">
+ ...
+</class>]]></programlisting>
+ </example>
<orderedlist>
- <title>Functions of the <literal>class</literal> element</title>
+ <title>Functions of the <literal>class</literal> mapping element</title>
<listitem>
<para>
The <literal>name</literal> attribute (combined here with the <literal>package</literal>
@@ -144,7 +149,12 @@
<database class="table">EVENTS</database> table.
</para>
- <programlisting role="XML"><![CDATA[<id name="id" column="EVENT_ID">...</id>]]></programlisting>
+ <example id="hibernate-gsg-tutorial-basic-mapping-id">
+ <title>The <literal>id</literal> mapping element</title>
+ <programlisting role="XML"><![CDATA[<id name="id" column="EVENT_ID">
+ ...
+</id>]]></programlisting>
+ </example>
<para>
Hibernate uses the property named by the <literal>id</literal> element to uniquely identify rows
@@ -172,8 +182,11 @@
example a simple incrementing count is used.
</para>
- <programlisting role="XML"><![CDATA[<property name="date" type="timestamp" column="EVENT_DATE"/>
+ <example id="hibernate-gsg-tutorial-basic-mapping-property">
+ <title>The <literal>property</literal> mapping element</title>
+ <programlisting role="XML"><![CDATA[<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>]]></programlisting>
+ </example>
<para>
The two <literal>property</literal> elements declare the remaining two properties of the
@@ -228,12 +241,15 @@
</para>
</note>
- <programlisting role="JAVA">protected void setUp() throws Exception {
+ <example id="hibernate-gsg-tutorial-basic-test-setUp">
+ <title>Obtaining the <interfacename>org.hibernate.SessionFactory</interfacename></title>
+ <programlisting role="JAVA">protected void setUp() throws Exception {
// A SessionFactory is set up once for an application
sessionFactory = new Configuration()
.configure() // configures settings from hibernate.cfg.xml
.buildSessionFactory();
}</programlisting>
+ </example>
<para>
The <classname>org.hibernate.cfg.Configuration</classname> class is the first thing to notice. In this
@@ -255,12 +271,15 @@
<!-- todo : reference to a discussion in dev guide -->
</para>
- <programlisting role="JAVA">Session session = sessionFactory.openSession();
+ <example id="hibernate-gsg-tutorial-basic-test-saving">
+ <title>Saving entities</title>
+ <programlisting role="JAVA">Session session = sessionFactory.openSession();
session.beginTransaction();
session.save( new Event( "Our very first event!", new Date() ) );
session.save( new Event( "A follow up event", new Date() ) );
session.getTransaction().commit();
session.close();</programlisting>
+ </example>
<para>
<methodname>testBasicUsage</methodname> first creates some new <classname>Event</classname> objects
@@ -268,7 +287,9 @@
point, Hibernate takes responsibility to perform an <literal>INSERT</literal> on the database.
</para>
- <programlisting role="JAVA"><![CDATA[session = sessionFactory.openSession();
+ <example id="hibernate-gsg-tutorial-basic-test-list">
+ <title>Obtaining a list of entities</title>
+ <programlisting role="JAVA"><![CDATA[session = sessionFactory.openSession();
session.beginTransaction();
List result = session.createQuery( "from Event" ).list();
for ( Event event : (List<Event>) result ) {
@@ -276,6 +297,7 @@
}
session.getTransaction().commit();
session.close();]]></programlisting>
+ </example>
<para>
<methodname>testBasicUsage</methodname> then illustrates use of the Hibernate Query Language (HQL) to
14 years, 2 months
Hibernate SVN: r20285 - core/trunk/documentation/quickstart/src/main/docbook/en-US/content.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-31 07:09:44 -0400 (Tue, 31 Aug 2010)
New Revision: 20285
Modified:
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
Log:
HHH-5442 - Write native tutorial chapter
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-31 09:08:33 UTC (rev 20284)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-31 11:09:44 UTC (rev 20285)
@@ -29,11 +29,12 @@
</para>
<para>
- The first few <literal>property</literal> elements define JDBC connection information. These tutorials
+ The <literal>connection.driver_class</literal>, <literal>connection.url</literal>,
+ <literal>connection.username</literal> and <literal>connection.password</literal>
+ <literal>property</literal> elements define JDBC connection information. These tutorials
utilize the H2 in-memory database. So these are all specific to running H2 in its in-memory mode.
- The 'connection.pool_size' is used to configure Hibernate's built-in connection pool how many
- connections
- to pool.
+ <literal>connection.pool_size</literal> is used to configure Hibernate's built-in connection pool
+ how many connections to pool.
</para>
<important>
@@ -47,7 +48,8 @@
</important>
<para>
- The <literal>dialect</literal> option specifies the particular SQL variant Hibernate should generate.
+ The <literal>dialect</literal> property specifies the particular SQL variant Hibernate with which
+ Hibernate will converse.
</para>
<tip>
@@ -61,7 +63,7 @@
</tip>
<para>
- The <literal>hbm2ddl.auto</literal> option turns on automatic generation of database schemas directly
+ The <literal>hbm2ddl.auto</literal> property turns on automatic generation of database schemas directly
into the database.
</para>
@@ -118,6 +120,8 @@
file is one choice for providing Hibernate with this metadata.
</para>
+ <programlisting role="XML"><![CDATA[<class name="Event" table="EVENTS">...</class>]]></programlisting>
+
<orderedlist>
<title>Functions of the <literal>class</literal> element</title>
<listitem>
@@ -137,9 +141,16 @@
<para>
Instances of the <classname>Event</classname> class are now mapped to rows in the
- <database class="table">EVENTS</database> table. Hibernate uses the <literal>id</literal> element to
- uniquely identify rows in the table.
+ <database class="table">EVENTS</database> table.
</para>
+
+ <programlisting role="XML"><![CDATA[<id name="id" column="EVENT_ID">...</id>]]></programlisting>
+
+ <para>
+ Hibernate uses the property named by the <literal>id</literal> element to uniquely identify rows
+ in the table.
+ </para>
+
<important>
<para>
It is not strictly necessary for the <literal>id</literal> element to map to the table's actual
@@ -158,8 +169,12 @@
<para>
The <literal>generator</literal> element nested inside the <literal>id</literal> element informs
Hibernate about which strategy is used to generated primary key values for this entity. In this
- example, a simple incrementing count is used.
+ example a simple incrementing count is used.
</para>
+
+ <programlisting role="XML"><![CDATA[<property name="date" type="timestamp" column="EVENT_DATE"/>
+<property name="title"/>]]></programlisting>
+
<para>
The two <literal>property</literal> elements declare the remaining two properties of the
<classname>Event</classname> class: <literal>date</literal> and<literal>title</literal>. The
@@ -213,6 +228,13 @@
</para>
</note>
+ <programlisting role="JAVA">protected void setUp() throws Exception {
+ // A SessionFactory is set up once for an application
+ sessionFactory = new Configuration()
+ .configure() // configures settings from hibernate.cfg.xml
+ .buildSessionFactory();
+}</programlisting>
+
<para>
The <classname>org.hibernate.cfg.Configuration</classname> class is the first thing to notice. In this
tutorial everything is simply configured via the <filename>hibernate.cfg.xml</filename> file
@@ -233,12 +255,28 @@
<!-- todo : reference to a discussion in dev guide -->
</para>
+ <programlisting role="JAVA">Session session = sessionFactory.openSession();
+session.beginTransaction();
+session.save( new Event( "Our very first event!", new Date() ) );
+session.save( new Event( "A follow up event", new Date() ) );
+session.getTransaction().commit();
+session.close();</programlisting>
+
<para>
<methodname>testBasicUsage</methodname> first creates some new <classname>Event</classname> objects
and hands them over to Hibernate for "management" via the <methodname>save</methodname> method. At that
point, Hibernate takes responsibility to perform an <literal>INSERT</literal> on the database.
</para>
+ <programlisting role="JAVA"><![CDATA[session = sessionFactory.openSession();
+session.beginTransaction();
+List result = session.createQuery( "from Event" ).list();
+for ( Event event : (List<Event>) result ) {
+ System.out.println( "Event (" + event.getDate() + ") : " + event.getTitle() );
+}
+session.getTransaction().commit();
+session.close();]]></programlisting>
+
<para>
<methodname>testBasicUsage</methodname> then illustrates use of the Hibernate Query Language (HQL) to
load all existing <classname>Event</classname> objects from the database. Hibernate will generate the
14 years, 2 months
Hibernate SVN: r20284 - core/trunk/cache-infinispan.
by hibernate-commits@lists.jboss.org
Author: galder.zamarreno(a)jboss.com
Date: 2010-08-31 05:08:33 -0400 (Tue, 31 Aug 2010)
New Revision: 20284
Modified:
core/trunk/cache-infinispan/pom.xml
Log:
[HHH-5515] (Upgrade to Infinispan 4.1.0.CR3) Done.
Modified: core/trunk/cache-infinispan/pom.xml
===================================================================
--- core/trunk/cache-infinispan/pom.xml 2010-08-31 08:29:12 UTC (rev 20283)
+++ core/trunk/cache-infinispan/pom.xml 2010-08-31 09:08:33 UTC (rev 20284)
@@ -18,7 +18,7 @@
<description>Integration of Hibernate with Infinispan</description>
<properties>
- <version.infinispan>4.1.0.CR1</version.infinispan>
+ <version.infinispan>4.1.0.CR3</version.infinispan>
<version.hsqldb>1.8.0.2</version.hsqldb>
<version.cglib>2.2</version.cglib>
<version.javassist>3.4.GA</version.javassist>
14 years, 2 months
Hibernate SVN: r20283 - core/trunk/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm.
by hibernate-commits@lists.jboss.org
Author: galder.zamarreno(a)jboss.com
Date: 2010-08-31 04:29:12 -0400 (Tue, 31 Aug 2010)
New Revision: 20283
Modified:
core/trunk/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java
Log:
Fix unit test by adding necessary Configuration.buildMappings() call, otherwise cache strategy is not set correctly in entity.
Modified: core/trunk/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java
===================================================================
--- core/trunk/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java 2010-08-31 00:18:55 UTC (rev 20282)
+++ core/trunk/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java 2010-08-31 08:29:12 UTC (rev 20283)
@@ -279,6 +279,7 @@
for (String mapping : mappings) {
cfg.addResource(mapping, Thread.currentThread().getContextClassLoader());
}
+ cfg.buildMappings();
Iterator iter = cfg.getClassMappings();
while (iter.hasNext()) {
PersistentClass clazz = (PersistentClass) iter.next();
14 years, 2 months
Hibernate SVN: r20282 - in core/trunk: core/src/main/java/org/hibernate/loader/criteria and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2010-08-30 20:18:55 -0400 (Mon, 30 Aug 2010)
New Revision: 20282
Modified:
core/trunk/core/src/main/java/org/hibernate/criterion/BetweenExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java
core/trunk/core/src/main/java/org/hibernate/criterion/IlikeExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/InExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/LikeExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/NotNullExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/NullExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/PropertyExpression.java
core/trunk/core/src/main/java/org/hibernate/criterion/SimpleExpression.java
core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java
core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
Log:
HHH-817 : Projection aliases should not be applied to where-clause (Milosz Tylenda)
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/BetweenExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/BetweenExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/BetweenExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -50,7 +50,7 @@
throws HibernateException {
return StringHelper.join(
" and ",
- StringHelper.suffix( criteriaQuery.getColumnsUsingProjection(criteria, propertyName), " between ? and ?" )
+ StringHelper.suffix( criteriaQuery.findColumns(propertyName, criteria), " between ? and ?" )
);
//TODO: get SQL rendering out of this package!
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaQuery.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -57,6 +57,14 @@
throws HibernateException;
/**
+ * Get the names of the columns mapped by a property path; if the
+ * property path is not found in criteria, try the "outer" query.
+ * Projection aliases are ignored.
+ */
+ public String[] findColumns(String propertyPath, Criteria criteria)
+ throws HibernateException;
+
+ /**
* Get the type of a property path, ignoring projection aliases
*/
public Type getType(Criteria criteria, String propertyPath)
@@ -67,7 +75,7 @@
*/
public String[] getColumnsUsingProjection(Criteria criteria, String propertyPath)
throws HibernateException;
-
+
/**
* Get the type of a property path
*/
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/IlikeExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/IlikeExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/IlikeExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -52,7 +52,7 @@
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
Dialect dialect = criteriaQuery.getFactory().getDialect();
- String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
+ String[] columns = criteriaQuery.findColumns(propertyName, criteria);
if (columns.length!=1) throw new HibernateException("ilike may only be used with single-column properties");
if ( dialect instanceof PostgreSQLDialect ) {
return columns[0] + " ilike ?";
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/InExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/InExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/InExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -49,8 +49,7 @@
public String toSqlString( Criteria criteria, CriteriaQuery criteriaQuery )
throws HibernateException {
- String[] columns = criteriaQuery.getColumnsUsingProjection(
- criteria, propertyName );
+ String[] columns = criteriaQuery.findColumns(propertyName, criteria);
if ( criteriaQuery.getFactory().getDialect()
.supportsRowValueConstructorSyntaxInInList() || columns.length<=1) {
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/LikeExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/LikeExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/LikeExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -78,7 +78,7 @@
Criteria criteria,
CriteriaQuery criteriaQuery) throws HibernateException {
Dialect dialect = criteriaQuery.getFactory().getDialect();
- String[] columns = criteriaQuery.getColumnsUsingProjection( criteria, propertyName );
+ String[] columns = criteriaQuery.findColumns(propertyName, criteria);
if ( columns.length != 1 ) {
throw new HibernateException( "Like may only be used with single-column properties" );
}
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/NotNullExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/NotNullExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/NotNullExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -46,7 +46,7 @@
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
- String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
+ String[] columns = criteriaQuery.findColumns(propertyName, criteria);
String result = StringHelper.join(
" or ",
StringHelper.suffix( columns, " is not null" )
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/NullExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/NullExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/NullExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -46,7 +46,7 @@
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
- String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
+ String[] columns = criteriaQuery.findColumns(propertyName, criteria);
String result = StringHelper.join(
" and ",
StringHelper.suffix( columns, " is null" )
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/PropertyExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/PropertyExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/PropertyExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -49,8 +49,8 @@
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
- String[] xcols = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
- String[] ycols = criteriaQuery.getColumnsUsingProjection(criteria, otherPropertyName);
+ String[] xcols = criteriaQuery.findColumns(propertyName, criteria);
+ String[] ycols = criteriaQuery.findColumns(otherPropertyName, criteria);
String result = StringHelper.join(
" and ",
StringHelper.add(xcols, getOp(), ycols)
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/SimpleExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/SimpleExpression.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/SimpleExpression.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -65,7 +65,7 @@
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
- String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
+ String[] columns = criteriaQuery.findColumns(propertyName, criteria);
Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName);
StringBuffer fragment = new StringBuffer();
if (columns.length>1) fragment.append('(');
Modified: core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -487,6 +487,27 @@
);
}
+ /**
+ * Get the names of the columns mapped by a property path; if the
+ * property path is not found in subcriteria, try the "outer" query.
+ * Projection aliases are ignored.
+ */
+ public String[] findColumns(String propertyName, Criteria subcriteria )
+ throws HibernateException {
+ try {
+ return getColumns( propertyName, subcriteria );
+ }
+ catch ( HibernateException he ) {
+ //not found in inner query, try the outer query
+ if ( outerQueryTranslator != null ) {
+ return outerQueryTranslator.findColumns( propertyName, subcriteria );
+ }
+ else {
+ throw he;
+ }
+ }
+ }
+
public Type getTypeUsingProjection(Criteria subcriteria, String propertyName)
throws HibernateException {
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java 2010-08-30 03:21:12 UTC (rev 20281)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java 2010-08-31 00:18:55 UTC (rev 20282)
@@ -182,6 +182,17 @@
.add( Subqueries.eq("Gavin King", dc3) )
.list();
+ DetachedCriteria dc4 = DetachedCriteria.forClass(Student.class, "st")
+ .setProjection( Property.forName("name").as( "stname" ) );
+
+ dc4.getExecutableCriteria( session ).list();
+
+ dc4.getExecutableCriteria( session ).addOrder( Order.asc( "stname" ) ).list();
+
+ session.createCriteria(Enrolment.class, "e")
+ .add( Subqueries.eq("Gavin King", dc4) )
+ .list();
+
session.delete(enrolment2);
session.delete(gavin);
session.delete(course);
@@ -539,8 +550,8 @@
assertEquals(new Long(667),result[1]);
assertEquals(new Long(101),result[2]);
assertEquals( 384.0, ( (Double) result[3] ).doubleValue(), 0.01 );
+
-
List resultWithMaps = s.createCriteria(Enrolment.class)
.setProjection( Projections.distinct( Projections.projectionList()
.add( Projections.property("studentNumber"), "stNumber" )
@@ -740,6 +751,17 @@
}
}
+ resultList = s.createCriteria(Student.class)
+ .add(Restrictions.eq("name", "Gavin King"))
+ .setProjection( Projections.projectionList()
+ .add( Projections.id().as( "studentNumber" ))
+ .add( Property.forName( "name" ), "name" )
+ .add( Property.forName( "cityState" ), "cityState" )
+ .add( Property.forName("preferredCourse"), "preferredCourse" )
+ )
+ .list();
+ assertEquals( 1, resultList.size() );
+
Object[] aResult = ( Object[] ) s.createCriteria(Student.class)
.add( Restrictions.idEq( new Long( 667 ) ) )
.setProjection( Projections.projectionList()
@@ -895,9 +917,37 @@
.add( Property.forName("year").group() )
)
.list();
+
+ assertEquals( list.size(), 2 );
+
+ list = s.createCriteria(Enrolment.class)
+ .createAlias("student", "st")
+ .createAlias("course", "co")
+ .setProjection( Projections.projectionList()
+ .add( Property.forName("co.courseCode").group().as( "courseCode" ))
+ .add( Property.forName("st.studentNumber").count().setDistinct().as( "studentNumber" ))
+ .add( Property.forName("year").group())
+ )
+ .addOrder( Order.asc( "courseCode" ) )
+ .addOrder( Order.asc( "studentNumber" ) )
+ .list();
+
+ assertEquals( list.size(), 2 );
+ list = s.createCriteria(Enrolment.class)
+ .createAlias("student", "st")
+ .createAlias("course", "co")
+ .setProjection( Projections.projectionList()
+ .add( Property.forName("co.courseCode").group().as( "cCode" ))
+ .add( Property.forName("st.studentNumber").count().setDistinct().as( "stNumber" ))
+ .add( Property.forName("year").group())
+ )
+ .addOrder( Order.asc( "cCode" ) )
+ .addOrder( Order.asc( "stNumber" ) )
+ .list();
+
assertEquals( list.size(), 2 );
-
+
s.delete(gavin);
s.delete(xam);
s.delete(course);
14 years, 2 months
Hibernate SVN: r20281 - core/branches/Branch_3_3_2_GA_CP.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-08-29 23:21:12 -0400 (Sun, 29 Aug 2010)
New Revision: 20281
Removed:
core/branches/Branch_3_3_2_GA_CP/cache-jbosscache/
core/branches/Branch_3_3_2_GA_CP/hibernate-maven-plugin/
Log:
JBPAPP-4962 remove unused sub-modules from Hibernate Core project
14 years, 3 months
Hibernate SVN: r20280 - annotations/branches/v3_3_1_GA_CP.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-08-28 12:49:02 -0400 (Sat, 28 Aug 2010)
New Revision: 20280
Added:
annotations/branches/v3_3_1_GA_CP/build.properties
Modified:
annotations/branches/v3_3_1_GA_CP/
annotations/branches/v3_3_1_GA_CP/build.xml
Log:
JBPAPP-4959 update build script to avoid ant version conflict
Property changes on: annotations/branches/v3_3_1_GA_CP
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
build
target
+ .classpath
.project
build
target
.settings
bin
Added: annotations/branches/v3_3_1_GA_CP/build.properties
===================================================================
--- annotations/branches/v3_3_1_GA_CP/build.properties (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/build.properties 2010-08-28 16:49:02 UTC (rev 20280)
@@ -0,0 +1,3 @@
+version=3.3.1.GA.CP03
+hibernate-core.home=../core
+hibernate-core.jar=../core/build/hibernate3.jar
Modified: annotations/branches/v3_3_1_GA_CP/build.xml
===================================================================
--- annotations/branches/v3_3_1_GA_CP/build.xml 2010-08-28 16:07:31 UTC (rev 20279)
+++ annotations/branches/v3_3_1_GA_CP/build.xml 2010-08-28 16:49:02 UTC (rev 20280)
@@ -55,6 +55,7 @@
<path location="${hibernate-core.jar}" />
<fileset dir="${hibernate-core.lib.dir}">
<include name="*.jar"/>
+ <exclude name="ant-*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
@@ -188,7 +189,7 @@
</fileset>
</classpath>
</taskdef>
- <junit printsummary="yes" haltonfailure="yes" forkmode="once">
+ <junit printsummary="on" haltonfailure="on" forkmode="once">
<classpath refid="junit.classpath"/>
<formatter type="plain"/>
<formatter type="xml"/>
@@ -209,7 +210,7 @@
</fileset>
</classpath>
</taskdef>
- <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <junit printsummary="on" fork="yes" haltonfailure="on">
<classpath refid="junit.classpath"/>
<formatter type="plain"/>
<formatter type="xml"/>
14 years, 3 months
Hibernate SVN: r20279 - core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-08-28 12:07:31 -0400 (Sat, 28 Aug 2010)
New Revision: 20279
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/Nullability.java
Log:
typo in javadoc
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/Nullability.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/Nullability.java 2010-08-27 21:44:31 UTC (rev 20278)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/engine/Nullability.java 2010-08-28 16:07:31 UTC (rev 20279)
@@ -51,7 +51,7 @@
*
* @param values entity properties
* @param persister class persister
- * @param isUpdate wether it is intended to be updated or saved
+ * @param isUpdate whether it is intended to be updated or saved
* @throws org.hibernate.PropertyValueException Break the nullability of one property
* @throws HibernateException error while getting Component values
*/
@@ -192,7 +192,7 @@
/**
* Return a well formed property path.
- * Basicaly, it will return parent.child
+ * Basically, it will return parent.child
*
* @param parent parent in path
* @param child child in path
14 years, 3 months