Author: epbernard
Date: 2006-10-27 15:56:30 -0400 (Fri, 27 Oct 2006)
New Revision: 10655
Removed:
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Shoe.java
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/SingleTableTest.java
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Sneaker.java
Log:
ANN-466 ANN-465 Remove an incorrect test on most databases
Deleted:
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Shoe.java
===================================================================
---
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Shoe.java 2006-10-26
13:39:23 UTC (rev 10654)
+++
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Shoe.java 2006-10-27
19:56:30 UTC (rev 10655)
@@ -1,17 +0,0 @@
-//$Id: $
-package org.hibernate.test.annotations.inheritance.singletable;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-public class Shoe {
- public Integer size;
- @Id
- @GeneratedValue
- public Integer id;
-}
Deleted:
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/SingleTableTest.java
===================================================================
---
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/SingleTableTest.java 2006-10-26
13:39:23 UTC (rev 10654)
+++
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/SingleTableTest.java 2006-10-27
19:56:30 UTC (rev 10655)
@@ -1,156 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.inheritance.singletable;
-
-import java.util.List;
-import java.sql.Statement;
-
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.hibernate.WrongClassException;
-import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.inheritance.Apple;
-import org.hibernate.test.annotations.inheritance.Fruit;
-
-/**
- * @author Emmanuel Bernard
- */
-public class SingleTableTest extends TestCase {
- //TODO move the singletable tests here
-
- public void testLongCommonPrefix() throws Exception {
- Session s = openSession();
- Transaction tx = s.beginTransaction();
- Building b = new Building();
- s.persist( b );
- s.flush();
- s.clear();
- s.get( Building.class, b.getId() );
- tx.rollback();
- s.close();
- }
-
- public void testForceDiscriminator() throws Exception {
- Session s = openSession();
- Transaction tx = s.beginTransaction();
- Building b = new Building();
- s.persist( b );
- s.flush();
- Statement statement = s.connection().createStatement();
- statement.executeUpdate( "update Building set discriminator_disc =
'N'");
- statement.close();
- s.clear();
- try {
- assertEquals( 0, s.createQuery( "select b from Building b" ).list().size()
);
- }
- catch (WrongClassException e) {
- fail("the wrong discriminator is not filtered");
- }
- tx.rollback();
- s.close();
- }
-
- public void testDefault() throws Exception {
- Session s;
- Transaction tx;
- s = openSession();
- tx = s.beginTransaction();
- Fruit f = new Fruit();
- Apple a = new Apple();
- s.persist( f );
- s.persist( a );
- tx.commit();
- s.close();
-
- s = openSession();
- tx = s.beginTransaction();
- assertEquals( 1l, s.createQuery( "select count(*) from Fruit f where f.class =
'Apple'" ).uniqueResult() );
- List result = s.createCriteria( Fruit.class ).list();
- assertNotNull( result );
- assertEquals( 2, result.size() );
- Fruit f2 = (Fruit) result.get( 0 );
- checkClassType( f2, f, a );
- f2 = (Fruit) result.get( 1 );
- checkClassType( f2, f, a );
- s.delete( result.get( 0 ) );
- s.delete( result.get( 1 ) );
- tx.commit();
- s.close();
- }
-
- public void testDefaultIntegerDiscriminator() throws Exception {
- Session s;
- Transaction tx;
- s = openSession();
- tx = s.beginTransaction();
- Trash t = new Trash();
- PaperTrash pt = new PaperTrash();
- s.persist( t );
- s.persist( pt );
- tx.commit();
- s.close();
-
- s = openSession();
- tx = s.beginTransaction();
- assertEquals(
- 1l, s.createQuery( "select count(*) from Trash f where f.class = :disc" )
- .setString( "disc", String.valueOf( "PaperTrash".hashCode() )
).uniqueResult()
- );
- List result = s.createCriteria( Trash.class ).list();
- assertNotNull( result );
- s.delete( result.get( 0 ) );
- s.delete( result.get( 1 ) );
- tx.commit();
- s.close();
- }
-
- public void testDefaultDiscriminatorColumn() {
- Session s;
- Transaction tx;
- s = openSession();
- tx = s.beginTransaction();
- Shoe t = new Shoe();
- Sneaker pt = new Sneaker();
- s.persist( t );
- s.persist( pt );
- tx.commit();
- s.close();
-
- s = openSession();
- tx = s.beginTransaction();
- //correct behavior but the test fails on HSQLDB
- //assertEquals( 0, s.createQuery( "select count(*) from Shoe f where f.class =
:disc")
- // .setString( "disc", "1234567890123456789012345678901"
).uniqueResult() );
- List result = s.createCriteria( Shoe.class ).list();
- assertNotNull( result );
- s.delete( result.get( 0 ) );
- s.delete( result.get( 1 ) );
- tx.commit();
- s.close();
- }
-
- private void checkClassType(Fruit fruitToTest, Fruit f, Apple a) {
- if ( fruitToTest.getId().equals( f.getId() ) ) {
- assertFalse( fruitToTest instanceof Apple );
- }
- else if ( fruitToTest.getId().equals( a.getId() ) ) {
- assertTrue( fruitToTest instanceof Apple );
- }
- else {
- fail( "Result does not contains the previously inserted elements" );
- }
- }
-
-
- protected Class[] getMappings() {
- return new Class[]{
- Building.class,
- House.class,
- Fruit.class,
- Apple.class,
- Trash.class,
- PaperTrash.class,
- Sneaker.class,
- Shoe.class
- };
- }
-}
Deleted:
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Sneaker.java
===================================================================
---
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Sneaker.java 2006-10-26
13:39:23 UTC (rev 10654)
+++
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/singletable/Sneaker.java 2006-10-27
19:56:30 UTC (rev 10655)
@@ -1,13 +0,0 @@
-//$Id: $
-package org.hibernate.test.annotations.inheritance.singletable;
-
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-@DiscriminatorValue("123456789012345678901234567890123")
-public class Sneaker extends Shoe {
-}
Show replies by date