[hibernate-commits] Hibernate SVN: r17629 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Oct 6 05:21:52 EDT 2009
Author: epbernard
Date: 2009-10-06 05:21:51 -0400 (Tue, 06 Oct 2009)
New Revision: 17629
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Twilight.java
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Darkness.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java
Log:
HHH-4364 add tests for superclasses
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Darkness.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Darkness.java 2009-10-06 08:18:12 UTC (rev 17628)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Darkness.java 2009-10-06 09:21:51 UTC (rev 17629)
@@ -1,3 +1,27 @@
+//$Id: BasicHibernateAnnotationsTest.java 17531 2009-09-22 17:43:48Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat, Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.test.annotations.query;
import javax.persistence.MappedSuperclass;
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java 2009-10-06 08:18:12 UTC (rev 17628)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java 2009-10-06 09:21:51 UTC (rev 17629)
@@ -1,4 +1,27 @@
//$Id$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat, Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.test.annotations.query;
import java.util.Calendar;
@@ -111,13 +134,23 @@
s.close();
}
+
+ /**
+ * We are testing 2 things here:
+ * 1. The query 'night.olderThan' is defined in a MappedSuperClass - Darkness.
+ * We are verifying that queries defined in a MappedSuperClass are processed.
+ * 2. There are 2 Entity classes that extend from Darkness - Night and Twilight.
+ * We are verifying that this does not cause any issues.eg. Double processing of the
+ * MappedSuperClass
+ */
+
public void testImportQueryFromMappedSuperclass() {
Session s = openSession();
try {
s.getNamedQuery( "night.olderThan" );
}
catch(MappingException ex) {
- assertTrue("Query imported from MappedSuperclass", false);
+ fail("Query imported from MappedSuperclass");
}
s.close();
}
@@ -364,10 +397,12 @@
protected Class[] getMappings() {
return new Class[] {
+ Darkness.class,
Plane.class,
A320.class,
A320b.class,
Night.class,
+ Twilight.class,
Area.class,
SpaceShip.class,
Dictionary.class,
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Twilight.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Twilight.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/Twilight.java 2009-10-06 09:21:51 UTC (rev 17629)
@@ -0,0 +1,49 @@
+//$Id: BasicHibernateAnnotationsTest.java 17531 2009-09-22 17:43:48Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat, Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.query;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Sharath Reddy
+ */
+ at Entity
+public class Twilight extends Darkness {
+
+ private int id;
+
+ @Id
+ @GeneratedValue
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
More information about the hibernate-commits
mailing list