From: <one...@us...> - 2002-12-26 03:35:11
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv22091/hibernate/test Modified Files: Foo.java FooBar.hbm.xml FooBarTest.java Log Message: support for multi-column unique constraints via unique-key attribute Index: Foo.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Foo.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Foo.java 5 Nov 2002 03:44:02 -0000 1.37 --- Foo.java 26 Dec 2002 03:35:08 -0000 1.38 *************** *** 12,15 **** --- 12,17 ---- public class Foo implements Lifecycle, FooProxy, Serializable { + private static int count=0; + public static class Struct implements java.io.Serializable { String name; *************** *** 65,69 **** _timestamp = new Date( System.currentTimeMillis() ); _integer = new Integer( -666 ); ! _long = new Long( 696969696969696969l ); _short = new Short("42"); _float = new Float( 6666.66f ); --- 67,71 ---- _timestamp = new Date( System.currentTimeMillis() ); _integer = new Integer( -666 ); ! _long = new Long( 696969696969696969l - count++ ); _short = new Short("42"); _float = new Float( 6666.66f ); Index: FooBar.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/FooBar.hbm.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** FooBar.hbm.xml 20 Nov 2002 10:30:45 -0000 1.17 --- FooBar.hbm.xml 26 Dec 2002 03:35:08 -0000 1.18 *************** *** 44,51 **** </many-to-one> <property name="long"> ! <column name="long_" index="fbmtoidx"/> </property> - <property name="integer" column="integer_"/> - <property name="float" column="float_"/> <property name="double" column="double_"/> <collection name="bytes" role="foo_bytes"/> --- 44,55 ---- </many-to-one> <property name="long"> ! <column name="long_" index="fbmtoidx" unique-key="abc"/> ! </property> ! <property name="integer"> ! <column name="integer_" unique-key="abc"/> ! </property> ! <property name="float"> ! <column name="float_" unique-key="abc"/> </property> <property name="double" column="double_"/> <collection name="bytes" role="foo_bytes"/> Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/FooBarTest.java,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** FooBarTest.java 25 Dec 2002 04:36:31 -0000 1.234 --- FooBarTest.java 26 Dec 2002 03:35:08 -0000 1.235 *************** *** 840,844 **** assertTrue( ( (Integer) rs.next() ).intValue()==2, "count" ); assertTrue( !rs.hasNext() ); ! rs = s.iterate("select count(*), foo.long from foo in class cirrus.hibernate.test.Foo group by foo.long"); assertTrue( ( (Object[]) rs.next() )[0].equals( new Integer(3) ), "count(*) group by" ); assertTrue( !rs.hasNext() ); --- 840,844 ---- assertTrue( ( (Integer) rs.next() ).intValue()==2, "count" ); assertTrue( !rs.hasNext() ); ! rs = s.iterate("select count(*), foo.int from foo in class cirrus.hibernate.test.Foo group by foo.int"); assertTrue( ( (Object[]) rs.next() )[0].equals( new Integer(3) ), "count(*) group by" ); assertTrue( !rs.hasNext() ); *************** *** 1692,1696 **** assertTrue( row[0].equals( foo.getFoo().getKey() ), "multi-column id" ); assertTrue( row[1].equals( foo.getKey() ), "multi-column id" ); ! assertTrue( row[2].equals( new Long(696969696969696969l) ), "multi-column property" ); assertTrue( !rs.hasNext() ); --- 1692,1696 ---- assertTrue( row[0].equals( foo.getFoo().getKey() ), "multi-column id" ); assertTrue( row[1].equals( foo.getKey() ), "multi-column id" ); ! assertTrue( row[2].equals( foo.getFoo().getLong() ), "multi-column property" ); assertTrue( !rs.hasNext() ); *************** *** 1700,1704 **** foo.getFoo().getKey().equals( row[0] ) && foo.getKey().equals( row[1] ) && ! new Long(696969696969696969l).equals( row[2] ) && row[3] == foo.getFoo() && row[3]==row[4] --- 1700,1704 ---- foo.getFoo().getKey().equals( row[0] ) && foo.getKey().equals( row[1] ) && ! foo.getFoo().getLong().equals( row[2] ) && row[3] == foo.getFoo() && row[3]==row[4] |