Author: steve.ebersole(a)jboss.com
Date: 2006-11-06 12:59:29 -0500 (Mon, 06 Nov 2006)
New Revision: 10733
Added:
trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.java
trunk/Hibernate3/test/org/hibernate/test/jpa/MySubclassEntity.java
Modified:
trunk/Hibernate3/test/org/hibernate/test/jpa/AbstractJPATest.java
trunk/Hibernate3/test/org/hibernate/test/jpa/ql/JPAQLComplianceTest.java
Log:
testing user assertion that JPA case insensitivity support breaks class-name ->
discriminator value resolution
Modified: trunk/Hibernate3/test/org/hibernate/test/jpa/AbstractJPATest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/jpa/AbstractJPATest.java 2006-11-06 17:58:49
UTC (rev 10732)
+++ trunk/Hibernate3/test/org/hibernate/test/jpa/AbstractJPATest.java 2006-11-06 17:59:29
UTC (rev 10733)
@@ -18,7 +18,7 @@
import java.io.Serializable;
/**
- * todo: describe AbstractJPATest
+ * An abstract test for all JPA spec related tests.
*
* @author Steve Ebersole
*/
@@ -28,7 +28,7 @@
}
protected String[] getMappings() {
- return new String[] { "jpa/Part.hbm.xml", "jpa/Item.hbm.xml" };
+ return new String[] { "jpa/Part.hbm.xml", "jpa/Item.hbm.xml",
"jpa/MyEntity.hbm.xml" };
}
protected void configure(Configuration cfg) {
Added: trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.hbm.xml 2006-11-06 17:58:49 UTC
(rev 10732)
+++ trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.hbm.xml 2006-11-06 17:59:29 UTC
(rev 10733)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="org.hibernate.test.jpa">
+
+ <class name="MyEntity" table="JPA_MYENTITY"
discriminator-value="E">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <discriminator column="TYPE" />
+ <property name="name" type="string"/>
+ <many-to-one name="other" class="MyEntity" />
+ <subclass name="MySubclassEntity"
discriminator-value="S">
+ <property name="someSubProperty"/>
+ </subclass>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.java 2006-11-06 17:58:49 UTC
(rev 10732)
+++ trunk/Hibernate3/test/org/hibernate/test/jpa/MyEntity.java 2006-11-06 17:59:29 UTC
(rev 10733)
@@ -0,0 +1,36 @@
+package org.hibernate.test.jpa;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class MyEntity {
+ private Long id;
+ private String name;
+ private MyEntity other;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public MyEntity getOther() {
+ return other;
+ }
+
+ public void setOther(MyEntity other) {
+ this.other = other;
+ }
+}
Added: trunk/Hibernate3/test/org/hibernate/test/jpa/MySubclassEntity.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/jpa/MySubclassEntity.java 2006-11-06 17:58:49
UTC (rev 10732)
+++ trunk/Hibernate3/test/org/hibernate/test/jpa/MySubclassEntity.java 2006-11-06 17:59:29
UTC (rev 10733)
@@ -0,0 +1,18 @@
+package org.hibernate.test.jpa;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class MySubclassEntity extends MyEntity {
+ private String someSubProperty;
+
+ public String getSomeSubProperty() {
+ return someSubProperty;
+ }
+
+ public void setSomeSubProperty(String someSubProperty) {
+ this.someSubProperty = someSubProperty;
+ }
+}
Modified: trunk/Hibernate3/test/org/hibernate/test/jpa/ql/JPAQLComplianceTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/jpa/ql/JPAQLComplianceTest.java 2006-11-06
17:58:49 UTC (rev 10732)
+++ trunk/Hibernate3/test/org/hibernate/test/jpa/ql/JPAQLComplianceTest.java 2006-11-06
17:59:29 UTC (rev 10733)
@@ -31,6 +31,11 @@
public void testIdentifierCaseSensitive() throws Exception {
Session s = openSession( );
+ // a control test (a user reported that the JPA 'case insensitivity' support
+ // caused problems with the "discriminator resolution" code; unable to
reproduce)...
+ s.createQuery( "from MyEntity e where e.class = MySubclassEntity" );
+ s.createQuery( "from MyEntity e where e.other.class = MySubclassEntity" );
+
s.createQuery( "select object(I) from Item i").list();
s.close();
}
Show replies by date