You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jo...@No...> - 2002-11-07 07:50:40
|
confirm 991647 |
From: <one...@us...> - 2002-11-06 00:58:06
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl In directory usw-pr-cvs1:/tmp/cvs-serv20968/hibernate/impl Modified Files: SessionFactoryImpl.java Log Message: another fix to make queries work properly with table-per-concrete-class Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** SessionFactoryImpl.java 5 Nov 2002 15:24:35 -0000 1.57 --- SessionFactoryImpl.java 6 Nov 2002 00:58:02 -0000 1.58 *************** *** 594,606 **** while ( iter.hasNext() ) { ClassPersister p = (ClassPersister) iter.next(); ! if ( ! (p instanceof Queryable) && ( ! clazz.equals( p.getMappedClass() ) || ( ! ( ! ( (Queryable) p ).isInherited() ) && ! clazz.isAssignableFrom( p.getMappedClass() ) ! ) ! ) ! ) { ! results.add( p.getClassName() ); } } --- 594,607 ---- while ( iter.hasNext() ) { ClassPersister p = (ClassPersister) iter.next(); ! if ( p instanceof Queryable ) { ! Queryable q = (Queryable) p; ! if ( clazz.equals( q.getMappedClass() ) ) { ! results.add( q.getClassName() ); ! } ! else if ( clazz.isAssignableFrom( q.getMappedClass() ) ) { ! if ( !q.isInherited() || !clazz.isAssignableFrom( q.getMappedSuperclass() ) ) { ! results.add( q.getClassName() ); ! } ! } } } |
From: <one...@us...> - 2002-11-06 00:58:06
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/map In directory usw-pr-cvs1:/tmp/cvs-serv20968/hibernate/map Modified Files: PersistentClass.java RootClass.java Log Message: another fix to make queries work properly with table-per-concrete-class Index: PersistentClass.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/PersistentClass.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** PersistentClass.java 3 Nov 2002 06:19:59 -0000 1.39 --- PersistentClass.java 6 Nov 2002 00:58:02 -0000 1.40 *************** *** 165,169 **** public abstract Table getTable(); public abstract CacheConcurrencyStrategy getCache(); ! public abstract Iterator getPropertyClosureIterator(); public abstract Iterator getTableClosureIterator(); --- 165,170 ---- public abstract Table getTable(); public abstract CacheConcurrencyStrategy getCache(); ! public abstract PersistentClass getSuperclass(); ! public abstract Iterator getPropertyClosureIterator(); public abstract Iterator getTableClosureIterator(); Index: RootClass.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/RootClass.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** RootClass.java 3 Nov 2002 06:19:59 -0000 1.49 --- RootClass.java 6 Nov 2002 00:58:02 -0000 1.50 *************** *** 265,267 **** --- 265,271 ---- } + public PersistentClass getSuperclass() { + return null; + } + } |
From: <one...@us...> - 2002-11-06 00:58:06
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister In directory usw-pr-cvs1:/tmp/cvs-serv20968/hibernate/persister Modified Files: AbstractEntityPersister.java Queryable.java Log Message: another fix to make queries work properly with table-per-concrete-class Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/AbstractEntityPersister.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AbstractEntityPersister.java 5 Nov 2002 11:48:08 -0000 1.11 --- AbstractEntityPersister.java 6 Nov 2002 00:58:02 -0000 1.12 *************** *** 66,69 **** --- 66,70 ---- private transient final boolean hasCascades; private transient final boolean mutable; + private transient final Class superclass; private transient final Class[] proxyInterfaces; *************** *** 412,415 **** --- 413,417 ---- polymorphic = model.isPolymorphic(); inherited = model.isInherited(); + superclass = inherited ? model.getSuperclass().getPersistentClass() : null; hasSubclasses = model.hasSubclasses(); *************** *** 583,585 **** --- 585,591 ---- } + public Class getMappedSuperclass() { + return superclass; + } + } Index: Queryable.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/Queryable.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Queryable.java 5 Nov 2002 15:24:36 -0000 1.7 --- Queryable.java 6 Nov 2002 00:58:02 -0000 1.8 *************** *** 17,20 **** --- 17,25 ---- public boolean isInherited(); /** + * Get the class that this class is mapped as a subclass of - + * not necessarily the direct superclass + */ + public Class getMappedSuperclass(); + /** * Get the discriminator value for this particular concrete subclass, * as a string that may be embedded in a select statement |
From: <one...@us...> - 2002-11-05 16:58:18
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory usw-pr-cvs1:/tmp/cvs-serv12927/cirrus/hibernate/test Modified Files: FooBarTest.java Fum.java MasterDetailTest.java Qux.java Log Message: removed deprecated methods in preparation for version 1.2 Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/FooBarTest.java,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** FooBarTest.java 28 Oct 2002 19:27:49 -0000 1.216 --- FooBarTest.java 5 Nov 2002 16:58:14 -0000 1.217 *************** *** 161,165 **** public void testPersistCollections() throws Exception { Session s = sessions.openSession(); ! Baz baz = (Baz) s.create(Baz.class); baz.setDefaults(); //System.out.println( s.print(baz) ); --- 161,166 ---- public void testPersistCollections() throws Exception { Session s = sessions.openSession(); ! Baz baz = new Baz(); ! s.save(baz); baz.setDefaults(); //System.out.println( s.print(baz) ); *************** *** 171,176 **** baz = (Baz) ( (Object[]) s.find("select baz, baz from baz in class cirrus.hibernate.test.Baz").get(0) )[1]; //System.out.println( s.print(baz) ); ! Foo foo = (Foo) s.create(Foo.class); ! baz.setFooArray( new Foo[] { foo, foo, null, (Foo) s.create(Foo.class) } ); baz.getFooSet().add(foo); baz.getCustoms().add( new String[] { "new", "custom" } ); --- 172,180 ---- baz = (Baz) ( (Object[]) s.find("select baz, baz from baz in class cirrus.hibernate.test.Baz").get(0) )[1]; //System.out.println( s.print(baz) ); ! Foo foo = new Foo(); ! s.save(foo); ! Foo foo2 = new Foo() ; ! s.save(foo2); ! baz.setFooArray( new Foo[] { foo, foo, null, foo2 } ); baz.getFooSet().add(foo); baz.getCustoms().add( new String[] { "new", "custom" } ); *************** *** 332,336 **** public void testCreateUpdate() throws Exception { Session s = sessions.openSession(); ! Foo foo = (Foo) s.create(Foo.class); foo.setString("dirty"); s.flush(); --- 336,341 ---- public void testCreateUpdate() throws Exception { Session s = sessions.openSession(); ! Foo foo = new Foo(); ! s.save(foo); foo.setString("dirty"); s.flush(); *************** *** 349,353 **** s = sessions.openSession(); ! foo = (Foo) s.create( Foo.class, "assignedid"); foo.setString("dirty"); s.flush(); --- 354,359 ---- s = sessions.openSession(); ! foo = new Foo(); ! s.save(foo, "assignedid"); foo.setString("dirty"); s.flush(); *************** *** 366,370 **** public void testUpdate() throws Exception { Session s = sessions.openSession(); ! Foo foo = (Foo) s.create(Foo.class); s.flush(); s.connection().commit(); --- 372,377 ---- public void testUpdate() throws Exception { Session s = sessions.openSession(); ! Foo foo = new Foo(); ! s.save(foo); s.flush(); s.connection().commit(); *************** *** 454,459 **** public void testLoad() throws Exception { Session s = sessions.openSession(); ! Qux q = (Qux) s.create(Qux.class); ! BarProxy b = (Bar) s.create(Bar.class); s.flush(); s.connection().commit(); --- 461,468 ---- public void testLoad() throws Exception { Session s = sessions.openSession(); ! Qux q = new Qux(); ! s.save(q); ! BarProxy b = new Bar(); ! s.save(b); s.flush(); s.connection().commit(); *************** *** 475,479 **** public void testCreate() throws Exception { Session s = sessions.openSession(); ! Foo foo = (Foo) s.create(Foo.class); s.flush(); s.connection().commit(); --- 484,489 ---- public void testCreate() throws Exception { Session s = sessions.openSession(); ! Foo foo = new Foo(); ! s.save(foo); s.flush(); s.connection().commit(); *************** *** 523,527 **** public void testPolymorphism() throws Exception { Session s = sessions.openSession(); ! Bar bar = (Bar) s.create(Bar.class); bar.setBarString("bar bar"); s.flush(); --- 533,538 ---- public void testPolymorphism() throws Exception { Session s = sessions.openSession(); ! Bar bar = new Bar(); ! s.save(bar); bar.setBarString("bar bar"); s.flush(); *************** *** 541,545 **** public void testCollectionOfSelf() throws Exception { Session s = sessions.openSession(); ! Bar bar = (Bar) s.create(Bar.class); bar.setAbstracts( new HashSet() ); bar.getAbstracts().add(bar); --- 552,557 ---- public void testCollectionOfSelf() throws Exception { Session s = sessions.openSession(); ! Bar bar = new Bar(); ! s.save(bar); bar.setAbstracts( new HashSet() ); bar.getAbstracts().add(bar); *************** *** 567,577 **** public void testFind() throws Exception { Session s = sessions.openSession(); ! Bar bar = (Bar) s.create(Bar.class); bar.setBarString("bar bar"); bar.setString("xxx"); ! Foo foo = (Foo) s.create(Foo.class); foo.setString("foo bar"); ! s.create(Foo.class); ! s.create(Bar.class); List list1 = s.find("select foo from foo in class cirrus.hibernate.test.Foo where foo.string='foo bar'"); assertTrue( list1.size()==1, "find size" ); --- 579,591 ---- public void testFind() throws Exception { Session s = sessions.openSession(); ! Bar bar = new Bar(); ! s.save(bar); bar.setBarString("bar bar"); bar.setString("xxx"); ! Foo foo = new Foo(); ! s.save(foo); foo.setString("foo bar"); ! s.save( new Foo() ); ! s.save( new Bar() ); List list1 = s.find("select foo from foo in class cirrus.hibernate.test.Foo where foo.string='foo bar'"); assertTrue( list1.size()==1, "find size" ); *************** *** 622,627 **** public void testQuery() throws Exception { Session s = sessions.openSession(); ! Foo foo = (Foo) s.create(Foo.class); ! foo.setFoo( (Foo) s.create(Foo.class) ); List list = s.find("from foo in class cirrus.hibernate.test.Foo where foo.string='osama bin laden' and foo.boolean = true order by foo.string asc, foo.component.count desc"); assertTrue( list.size()==0, "empty query" ); --- 636,644 ---- public void testQuery() throws Exception { Session s = sessions.openSession(); ! Foo foo = new Foo(); ! s.save(foo); ! Foo foo2 = new Foo(); ! s.save(foo2); ! foo.setFoo(foo2); List list = s.find("from foo in class cirrus.hibernate.test.Foo where foo.string='osama bin laden' and foo.boolean = true order by foo.string asc, foo.component.count desc"); assertTrue( list.size()==0, "empty query" ); *************** *** 753,757 **** public void testSubcollections() throws Exception { Session s = sessions.openSession(); ! Baz baz = (Baz) s.create(Baz.class); baz.setDefaults(); s.flush(); --- 770,775 ---- public void testSubcollections() throws Exception { Session s = sessions.openSession(); ! Baz baz = new Baz(); ! s.save(baz); baz.setDefaults(); s.flush(); *************** *** 785,793 **** //first for unkeyed collections Session s = sessions.openSession(); ! Baz baz1 = (Baz) s.create(Baz.class); ! Baz baz2 = (Baz) s.create(Baz.class); baz1.setIntArray( new int[] {1 ,2, 3, 4} ); baz1.setFooSet( new HashSet() ); ! baz1.getFooSet().add( s.create(Foo.class) ); s.flush(); s.connection().commit(); --- 803,815 ---- //first for unkeyed collections Session s = sessions.openSession(); ! Baz baz1 = new Baz(); ! s.save(baz1); ! Baz baz2 = new Baz(); ! s.save(baz2); baz1.setIntArray( new int[] {1 ,2, 3, 4} ); baz1.setFooSet( new HashSet() ); ! Foo foo = new Foo(); ! s.save(foo); ! baz1.getFooSet().add(foo); s.flush(); s.connection().commit(); *************** *** 818,823 **** //now for collections of collections s = sessions.openSession(); ! baz1 = (Baz) s.create(Baz.class); ! baz2 = (Baz) s.create(Baz.class); Set set1 = new TreeSet(); Set set2 = new TreeSet(); --- 840,847 ---- //now for collections of collections s = sessions.openSession(); ! baz1 = new Baz(); ! s.save(baz1); ! baz2 = new Baz(); ! s.save(baz2); Set set1 = new TreeSet(); Set set2 = new TreeSet(); *************** *** 863,869 **** //now for keyed collections s = sessions.openSession(); ! baz1 = (Baz) s.create(Baz.class); ! baz2 = (Baz) s.create(Baz.class); ! baz1.setFooArray( new Foo[] { (Foo) s.create(Foo.class), null, (Foo) s.create(Foo.class) } ); baz1.setStringDateMap( new TreeMap() ); baz1.getStringDateMap().put("today", new Date( System.currentTimeMillis() ) ); --- 887,898 ---- //now for keyed collections s = sessions.openSession(); ! baz1 = new Baz(); ! s.save(baz1); ! baz2 = new Baz(); ! s.save(baz2); ! Foo foo1 = new Foo(); ! Foo foo2 = new Foo(); ! s.save(foo1); s.save(foo2); ! baz1.setFooArray( new Foo[] { foo1, null, foo2 } ); baz1.setStringDateMap( new TreeMap() ); baz1.getStringDateMap().put("today", new Date( System.currentTimeMillis() ) ); *************** *** 903,907 **** public void testPersistentLifecycle() throws Exception { Session s = sessions.openSession(); ! Qux q = (Qux) s.create(Qux.class); q.setStuff("foo bar baz qux"); s.flush(); --- 932,937 ---- public void testPersistentLifecycle() throws Exception { Session s = sessions.openSession(); ! Qux q = new Qux(); ! s.save(q); q.setStuff("foo bar baz qux"); s.flush(); *************** *** 928,933 **** Session s = sessions.openSession(); for ( int i=0; i<10; i++ ) { ! Qux q = (Qux) s.create(Qux.class); ! assertTrue(q!=null, "not null"); } s.flush(); --- 958,964 ---- Session s = sessions.openSession(); for ( int i=0; i<10; i++ ) { ! Qux q = new Qux(); ! Object qid = s.save(q); ! assertTrue(q!=null && qid!=null, "not null"); } s.flush(); *************** *** 965,970 **** public void testVersioning() throws Exception { Session s = sessions.openSession(); ! GlarchProxy g = (GlarchProxy) s.create(Glarch.class); ! GlarchProxy g2 = (GlarchProxy) s.create(Glarch.class); Serializable gid = s.getIdentifier(g); Serializable g2id = s.getIdentifier(g2); --- 996,1003 ---- public void testVersioning() throws Exception { Session s = sessions.openSession(); ! GlarchProxy g = new Glarch(); ! s.save(g); ! GlarchProxy g2 = new Glarch(); ! s.save(g2); Serializable gid = s.getIdentifier(g); Serializable g2id = s.getIdentifier(g2); *************** *** 975,979 **** s = sessions.openSession(); g = (GlarchProxy) s.load( Glarch.class, gid ); ! s.lock(g); g2 = (GlarchProxy) s.load( Glarch.class, g2id ); assertTrue( g.getVersion()==1, "version" ); --- 1008,1012 ---- s = sessions.openSession(); g = (GlarchProxy) s.load( Glarch.class, gid ); ! s.lock(g, LockMode.UPGRADE); g2 = (GlarchProxy) s.load( Glarch.class, g2id ); assertTrue( g.getVersion()==1, "version" ); *************** *** 1004,1008 **** public void testVersionedCollections() throws Exception { Session s = sessions.openSession(); ! GlarchProxy g = (GlarchProxy) s.create(Glarch.class); g.setProxyArray( new GlarchProxy[] { g } ); String gid = (String) s.getIdentifier(g); --- 1037,1042 ---- public void testVersionedCollections() throws Exception { Session s = sessions.openSession(); ! GlarchProxy g = new Glarch(); ! s.save(g); g.setProxyArray( new GlarchProxy[] { g } ); String gid = (String) s.getIdentifier(g); *************** *** 1059,1063 **** assertTrue( !s.iterate("from fee in class Fee").hasNext() ); ! GlarchProxy g = (GlarchProxy) s.create(Glarch.class); String gid = (String) s.getIdentifier(g); HashMap map = new HashMap(); --- 1093,1098 ---- assertTrue( !s.iterate("from fee in class Fee").hasNext() ); ! GlarchProxy g = new Glarch(); ! s.save(g); String gid = (String) s.getIdentifier(g); HashMap map = new HashMap(); *************** *** 1136,1143 **** //being tested here) Session s = sessions.openSession(); ! Glarch last = (Glarch) s.create(Glarch.class); last.setOrder( (short) 0 ); for (int i=0; i<5; i++) { ! Glarch next = (Glarch) s.create(Glarch.class); last.setNext(next); last = next; --- 1171,1180 ---- //being tested here) Session s = sessions.openSession(); ! GlarchProxy last = new Glarch(); ! s.save(last); last.setOrder( (short) 0 ); for (int i=0; i<5; i++) { ! GlarchProxy next = new Glarch(); ! s.save(next); last.setNext(next); last = next; *************** *** 1176,1183 **** //Same thing but using polymorphic class (no optimisation possible): s = sessions.openSession(); ! FooProxy flast = (FooProxy) s.create(Bar.class); flast.setString( "foo0" ); for (int i=0; i<5; i++) { ! flast.setFoo( (FooProxy) s.create(Bar.class) ); flast = flast.getFoo(); flast.setString( "foo" + (i+1) ); --- 1213,1223 ---- //Same thing but using polymorphic class (no optimisation possible): s = sessions.openSession(); ! FooProxy flast = new Bar(); ! s.save(flast); flast.setString( "foo0" ); for (int i=0; i<5; i++) { ! FooProxy foo = new Bar(); ! s.save(foo); ! flast.setFoo(foo); flast = flast.getFoo(); flast.setString( "foo" + (i+1) ); *************** *** 1255,1259 **** s = sessions.openSession(); ! fum = (Fum) s.loadWithLock( Fum.class, fumKey("fum") ); assertTrue( fum!=null, "load by composite key" ); --- 1295,1299 ---- s = sessions.openSession(); ! fum = (Fum) s.load( Fum.class, fumKey("fum"), LockMode.UPGRADE ); assertTrue( fum!=null, "load by composite key" ); *************** *** 1431,1437 **** fum1.setFum("fee fo fi"); fum2.setFum("fee fo fi"); ! s.insert(fum1); ! s.insert(fum2); ! Qux q = (Qux) s.create(Qux.class); Set set = new HashSet(); List list = new ArrayList(); --- 1471,1478 ---- fum1.setFum("fee fo fi"); fum2.setFum("fee fo fi"); ! s.save(fum1); ! s.save(fum2); ! Qux q = new Qux(); ! s.save(q); Set set = new HashSet(); List list = new ArrayList(); *************** *** 1462,1467 **** public void testMultiColumnQueries() throws Exception { Session s = sessions.openSession(); ! Foo foo = (Foo) s.create(Foo.class); ! foo.setFoo( (Foo) s.create(Foo.class) ); List l = s.find("select parent, child from parent in class cirrus.hibernate.test.Foo, child in class cirrus.hibernate.test.Foo where parent.foo = child"); assertTrue( l.size()==1, "multi-column find" ); --- 1503,1511 ---- public void testMultiColumnQueries() throws Exception { Session s = sessions.openSession(); ! Foo foo = new Foo(); ! s.save(foo); ! Foo foo1 = new Foo(); ! s.save(foo1); ! foo.setFoo(foo1); List l = s.find("select parent, child from parent in class cirrus.hibernate.test.Foo, child in class cirrus.hibernate.test.Foo where parent.foo = child"); assertTrue( l.size()==1, "multi-column find" ); *************** *** 1533,1537 **** public void testUpdateFromTransient() throws Exception { Session s = sessions.openSession(); ! Fee fee1 = (Fee) s.create(Fee.class); Fee fee2 = new Fee(); fee1.setFee(fee2); --- 1577,1582 ---- public void testUpdateFromTransient() throws Exception { Session s = sessions.openSession(); ! Fee fee1 = new Fee(); ! s.save(fee1); Fee fee2 = new Fee(); fee1.setFee(fee2); *************** *** 1648,1656 **** public void testDatabinder() throws Exception { Session s = sessions.openSession(); ! BarProxy bar = (Bar) s.create(Bar.class); ! FooProxy foo = (Foo) s.create(Foo.class); ! FooProxy foo2 = (Foo) s.create(Foo.class); foo2.setFoo(foo); ! Baz baz = (Baz) s.create(Baz.class); baz.setDefaults(); baz.setFooArray( new FooProxy[] { foo, foo2, bar, null } ); --- 1693,1705 ---- public void testDatabinder() throws Exception { Session s = sessions.openSession(); ! BarProxy bar = new Bar(); ! s.save(bar); ! FooProxy foo = new Foo(); ! s.save(foo); ! FooProxy foo2 = new Foo(); ! s.save(foo2); foo2.setFoo(foo); ! Baz baz = new Baz(); ! s.save(baz); baz.setDefaults(); baz.setFooArray( new FooProxy[] { foo, foo2, bar, null } ); *************** *** 1685,1689 **** public void testArraysOfTimes() throws Exception { Session s = sessions.openSession(); ! Baz baz = (Baz) s.create(Baz.class); baz.setDefaults(); s.flush(); --- 1734,1739 ---- public void testArraysOfTimes() throws Exception { Session s = sessions.openSession(); ! Baz baz = new Baz() ; ! s.save(baz); baz.setDefaults(); s.flush(); *************** *** 1788,1792 **** public void testLazyCollections() throws Exception { Session s = sessions.openSession(); ! Qux q = (Qux) s.create(Qux.class); s.flush(); s.connection().commit(); --- 1838,1843 ---- public void testLazyCollections() throws Exception { Session s = sessions.openSession(); ! Qux q = new Qux(); ! s.save(q); s.flush(); s.connection().commit(); *************** *** 1828,1832 **** public void testDeleteOwner() throws Exception { Session s = sessions.openSession(); ! Qux q = (Qux) s.create(Qux.class); Fum f1 = new Fum( fumKey("f1") ); Fum f2 = new Fum( fumKey("f2") ); --- 1879,1884 ---- public void testDeleteOwner() throws Exception { Session s = sessions.openSession(); ! Qux q = new Qux(); ! s.save(q); Fum f1 = new Fum( fumKey("f1") ); Fum f2 = new Fum( fumKey("f2") ); *************** *** 1841,1846 **** q.setFums(set); q.setMoreFums(list); ! s.insert(f1); ! s.insert(f2); s.flush(); s.connection().commit(); --- 1893,1898 ---- q.setFums(set); q.setMoreFums(list); ! s.save(f1); ! s.save(f2); s.flush(); s.connection().commit(); *************** *** 1848,1853 **** s = sessions.openSession(); ! q = (Qux) s.loadWithLock( Qux.class, q.getKey() ); ! s.lock(q); s.delete(q); s.flush(); --- 1900,1905 ---- s = sessions.openSession(); ! q = (Qux) s.load( Qux.class, q.getKey(), LockMode.UPGRADE ); ! s.lock( q, LockMode.UPGRADE ); s.delete(q); s.flush(); *************** *** 1858,1863 **** list = s.find("from fum in class cirrus.hibernate.test.Fum where not fum.fum='FRIEND'"); assertTrue( list.size()==2, "deleted owner" ); ! s.lock( list.get(0) ); ! s.lock( list.get(1) ); Iterator iter = list.iterator(); while ( iter.hasNext() ) { --- 1910,1915 ---- list = s.find("from fum in class cirrus.hibernate.test.Fum where not fum.fum='FRIEND'"); assertTrue( list.size()==2, "deleted owner" ); ! s.lock( list.get(0), LockMode.UPGRADE ); ! s.lock( list.get(1), LockMode.UPGRADE ); Iterator iter = list.iterator(); while ( iter.hasNext() ) { *************** *** 1901,1905 **** s = sessions.openSession(); try { ! Foo f = (Foo) s.loadWithLock(Foo.class, fid); s.delete(f); s.flush(); --- 1953,1957 ---- s = sessions.openSession(); try { ! Foo f = (Foo) s.load(Foo.class, fid, LockMode.UPGRADE); s.delete(f); s.flush(); *************** *** 1961,1970 **** s = sessions.openSession(); ! Many manyB = (Many) s.create(Many.class); ! One oneB = (One) s.create(One.class); oneB.setValue("b"); manyB.setOne(oneB); ! Many manyA = (Many) s.create(Many.class); ! One oneA = (One) s.create(One.class); oneA.setValue("a"); manyA.setOne(oneA); --- 2013,2026 ---- s = sessions.openSession(); ! Many manyB = new Many(); ! s.save(manyB); ! One oneB = new One(); ! s.save(oneB); oneB.setValue("b"); manyB.setOne(oneB); ! Many manyA = new Many(); ! s.save(manyA); ! One oneA = new One(); ! s.save(oneA); oneA.setValue("a"); manyA.setOne(oneA); *************** *** 2182,2186 **** public void testFindLoad() throws Exception { Session s = sessions.openSession(); ! FooProxy foo = (FooProxy) s.create(Foo.class); s.flush(); s.connection().commit(); --- 2238,2243 ---- public void testFindLoad() throws Exception { Session s = sessions.openSession(); ! FooProxy foo = new Foo(); ! s.save(foo); s.flush(); s.connection().commit(); *************** *** 2205,2209 **** public void testAutoFlush() throws Exception { Session s = sessions.openSession(); ! FooProxy foo = (FooProxy) s.create(Foo.class); assertTrue( s.find("from foo in class cirrus.hibernate.test.Foo").size()==1, "autoflush create" ); foo.setChar( new Character('X') ); --- 2262,2267 ---- public void testAutoFlush() throws Exception { Session s = sessions.openSession(); ! FooProxy foo = new Foo(); ! s.save(foo); assertTrue( s.find("from foo in class cirrus.hibernate.test.Foo").size()==1, "autoflush create" ); foo.setChar( new Character('X') ); *************** *** 2231,2240 **** Fum fum = new Fum( fumKey("fum") ); fum.setFum("fo fee fi"); ! s.insert(fum); fum = new Fum( fumKey("fi") ); fum.setFum("fee fi fo"); ! s.insert(fum); List list = s.findIdentifiers("from fum in class cirrus.hibernate.test.Fum where not fum.fum='FRIEND'"); assertTrue( list.size()==2, "list identifiers"); s.delete( s.load(Fum.class, (Serializable) list.get(0) ) ); s.delete( s.load(Fum.class, (Serializable) list.get(1) ) ); --- 2289,2305 ---- Fum fum = new Fum( fumKey("fum") ); fum.setFum("fo fee fi"); ! s.save(fum); fum = new Fum( fumKey("fi") ); fum.setFum("fee fi fo"); ! s.save(fum); List list = s.findIdentifiers("from fum in class cirrus.hibernate.test.Fum where not fum.fum='FRIEND'"); assertTrue( list.size()==2, "list identifiers"); + Iterator iter = s.iterate("select fum.id from fum in class cirrus.hibernate.test.Fum where not fum.fum='FRIEND'"); + int i=0; + while ( iter.hasNext() ) { + assertTrue( iter.next() instanceof FumCompositeID, "iterate identifiers"); + i++; + } + assertTrue(i==2); s.delete( s.load(Fum.class, (Serializable) list.get(0) ) ); s.delete( s.load(Fum.class, (Serializable) list.get(1) ) ); *************** *** 2351,2355 **** fo.setSerial(props); fo.setBuf( "abcdefghij1`23%$*^*$*\n\t".getBytes() ); ! s.insert( fo, fumKey("an instance of fo") ); s.flush(); props.setProperty("x", "y"); --- 2416,2420 ---- fo.setSerial(props); fo.setBuf( "abcdefghij1`23%$*^*$*\n\t".getBytes() ); ! s.save( fo, fumKey("an instance of fo") ); s.flush(); props.setProperty("x", "y"); Index: Fum.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Fum.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Fum.java 13 Aug 2002 16:20:23 -0000 1.7 --- Fum.java 5 Nov 2002 16:58:14 -0000 1.8 *************** *** 94,98 **** Iterator iter = friends.iterator(); while ( iter.hasNext() ) { ! s.insert( iter.next() ); } } --- 94,98 ---- Iterator iter = friends.iterator(); while ( iter.hasNext() ) { ! s.save( iter.next() ); } } Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/MasterDetailTest.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** MasterDetailTest.java 30 Oct 2002 13:34:25 -0000 1.37 --- MasterDetailTest.java 5 Nov 2002 16:58:14 -0000 1.38 *************** *** 42,46 **** Master master = new Master(); assertTrue( s.save(master)!=null, "save returned native id" ); ! Serializable mid = s.getID(master); Detail d1 = new Detail(); d1.setMaster(master); --- 42,46 ---- Master master = new Master(); assertTrue( s.save(master)!=null, "save returned native id" ); ! Serializable mid = s.getIdentifier(master); Detail d1 = new Detail(); d1.setMaster(master); *************** *** 108,114 **** public void testIncomingOutgoing() throws Exception { Session s = sessions.openSession(); ! Master master1 = (Master) s.create(Master.class); ! Master master2 = (Master) s.create(Master.class); ! Master master3 = (Master) s.create(Master.class); master1.addIncoming(master2); master2.addOutgoing(master1); --- 108,117 ---- public void testIncomingOutgoing() throws Exception { Session s = sessions.openSession(); ! Master master1 = new Master(); ! Master master2 = new Master(); ! Master master3 = new Master(); ! s.save(master1); ! s.save(master2); ! s.save(master3); master1.addIncoming(master2); master2.addOutgoing(master1); *************** *** 209,216 **** } else if (dialect instanceof HSQLDialect ) { ! s.insert( d1, new Integer(666) ); } else { ! s.insert( d1, new Long(666) ); } //s.save(d2); --- 212,219 ---- } else if (dialect instanceof HSQLDialect ) { ! s.save( d1, new Integer(666) ); } else { ! s.save( d1, new Long(666) ); } //s.save(d2); *************** *** 230,234 **** Detail d = (Detail) iter.next(); assertTrue( d.getMaster()==m2, "deserialization" ); ! if ( s.getID(d)!=null ) s.delete(d); } s.delete(m2); --- 233,241 ---- Detail d = (Detail) iter.next(); assertTrue( d.getMaster()==m2, "deserialization" ); ! try { ! s.getIdentifier(d); ! s.delete(d); ! } ! catch (Exception e) {} } s.delete(m2); *************** *** 286,295 **** } else if (dialect instanceof HSQLDialect ) { ! s.insert( d1, new Integer(666) ); ! s.insert( d2, new Integer(667) ); } else { ! s.insert( d1, new Long(666) ); ! s.insert( d2, new Long(667) ); } s.flush(); --- 293,302 ---- } else if (dialect instanceof HSQLDialect ) { ! s.save( d1, new Integer(666) ); ! s.save( d2, new Integer(667) ); } else { ! s.save( d1, new Long(666) ); ! s.save( d2, new Long(667) ); } s.flush(); Index: Qux.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Qux.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Qux.java 5 Nov 2002 03:44:02 -0000 1.13 --- Qux.java 5 Nov 2002 16:58:14 -0000 1.14 *************** *** 36,40 **** created=true; try { ! foo = (Foo) session.create(Foo.class); } catch (Exception e) { --- 36,41 ---- created=true; try { ! foo = new Foo(); ! session.save(foo); } catch (Exception e) { |
From: <one...@us...> - 2002-11-05 16:58:18
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/odmg In directory usw-pr-cvs1:/tmp/cvs-serv12927/cirrus/hibernate/odmg Modified Files: Implementation.java Transaction.java Log Message: removed deprecated methods in preparation for version 1.2 Index: Implementation.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/odmg/Implementation.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Implementation.java 26 Oct 2002 09:39:47 -0000 1.7 --- Implementation.java 5 Nov 2002 16:58:14 -0000 1.8 *************** *** 126,130 **** public String getObjectId(Object obj) { try { ! return database.getSession().getID(obj).toString(); } catch (HibernateException he) { --- 126,130 ---- public String getObjectId(Object obj) { try { ! return database.getSession().getIdentifier(obj).toString(); } catch (HibernateException he) { Index: Transaction.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/odmg/Transaction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Transaction.java 12 Sep 2002 18:19:15 -0000 1.5 --- Transaction.java 5 Nov 2002 16:58:14 -0000 1.6 *************** *** 2,6 **** import java.sql.SQLException; import org.odmg.LockNotGrantedException; import org.odmg.ODMGException; import org.odmg.ODMGRuntimeException; ! import cirrus.hibernate.HibernateException; import cirrus.hibernate.Session; /** * Implements the ODMG <tt>Transaction</tt> API. */ public class Transaction implements org.odmg.Transaction { private final Database database; private final Session session; private cirrus.hibernate.Transaction tx; --- 2,6 ---- import java.sql.SQLException; import org.odmg.LockNotGrantedException; import org.odmg.ODMGException; import org.odmg.ODMGRuntimeException; ! import cirrus.hibernate.HibernateException; import cirrus.hibernate.LockMode; import cirrus.hibernate.Session; /** * Implements the ODMG <tt>Transaction</tt> API. */ public class Transaction implements org.odmg.Transaction { private final Database database; private final Session session; private cirrus.hibernate.Transaction tx; *************** *** 13,17 **** /** * Commit the transaction. * @see org.odmg.Transaction#commit() */ public void commit() { database.disassociateThread(); try { tx.commit(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } /** * Abort the transaction. * @see org.odmg.Transaction#abort() */ public void abort() { database.disassociateThread(); try { tx.rollback(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } ! /** * Commit the changes, but leave the transaction open. This implementation * does not have quite the same semantics os ODMG (locks are not retained). * So you should only use this with versioned data. * @see org.odmg.Transaction#checkpoint() */ public void checkpoint() { try { tx.commit(); tx = session.beginTransaction(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Obtain a lock upon the given object. In the present implementation, * <tt>READ</tt> lock mode is ignored while <tt>UPGRADE</tt> and * <tt>WRITE</tt> lock modes obtain an <tt>UPGRADE</tt> lock for databases * which support <tt>for update</tt>. We should improve this eventually.... * @see org.odmg.Transaction#lock(Object, int) */ public void lock(Object obj, int lockMode) throws LockNotGrantedException { //TODO: check the semantics of this... try { if ( lockMode!=org.odmg.Transaction.READ ) { session.lock(obj); } } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Not implemented. * @see org.odmg.Transaction#tryLock(Object, int) */ public boolean tryLock(Object obj, int lockMode) { throw new UnsupportedOperationException("try using lock()"); } } --- 13,17 ---- /** * Commit the transaction. * @see org.odmg.Transaction#commit() */ public void commit() { database.disassociateThread(); try { tx.commit(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } /** * Abort the transaction. * @see org.odmg.Transaction#abort() */ public void abort() { database.disassociateThread(); try { tx.rollback(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } ! /** * Commit the changes, but leave the transaction open. This implementation * does not have quite the same semantics os ODMG (locks are not retained). * So you should only use this with versioned data. * @see org.odmg.Transaction#checkpoint() */ public void checkpoint() { try { tx.commit(); tx = session.beginTransaction(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Obtain a lock upon the given object. In the present implementation, * <tt>READ</tt> lock mode is ignored while <tt>UPGRADE</tt> and * <tt>WRITE</tt> lock modes obtain an <tt>UPGRADE</tt> lock for databases * which support <tt>for update</tt>. We should improve this eventually.... * @see org.odmg.Transaction#lock(Object, int) */ public void lock(Object obj, int lockMode) throws LockNotGrantedException { //TODO: check the semantics of this... try { if ( lockMode==org.odmg.Transaction.READ ) { session.lock(obj, LockMode.READ); } else { session.lock(obj, LockMode.UPGRADE); } } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Not implemented. * @see org.odmg.Transaction#tryLock(Object, int) */ public boolean tryLock(Object obj, int lockMode) { throw new UnsupportedOperationException("try using lock()"); } } |
From: <one...@us...> - 2002-11-05 16:58:18
|
Update of /cvsroot/hibernate/Hibernate In directory usw-pr-cvs1:/tmp/cvs-serv12927 Modified Files: changelog.txt Log Message: removed deprecated methods in preparation for version 1.2 Index: changelog.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate/changelog.txt,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -d -r1.258 -r1.259 *** changelog.txt 5 Nov 2002 13:40:53 -0000 1.258 --- changelog.txt 5 Nov 2002 16:58:12 -0000 1.259 *************** *** 2,7 **** =================== ! Changes in version 1.1.9 (x.11.2002) ! ------------------------------------ * Fixed a bad bug binding to JNDI with servers that use serialization in preference to getReference() * support for quoted SQL identifiers (patch by Jean-Francois Nadeau) --- 2,7 ---- =================== ! Changes in version 1.2 beta 1 (x.11.2002) ! ----------------------------------------- * Fixed a bad bug binding to JNDI with servers that use serialization in preference to getReference() * support for quoted SQL identifiers (patch by Jean-Francois Nadeau) *************** *** 12,15 **** --- 12,18 ---- * finished work on normalized table mappings using <joined-subclass> declaration * deprecated hibernate-mapping.dtd in favor of hibernate-mapping-1.1.dtd + * reworked unmapped class / interface query functionality, fixing several problems + * removed deprecated methods + * deprecated findIdentifiers() Changes in version 1.1.8 (30.10.2002) |
From: <one...@us...> - 2002-11-05 16:58:17
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate In directory usw-pr-cvs1:/tmp/cvs-serv12927/cirrus/hibernate Modified Files: Session.java Log Message: removed deprecated methods in preparation for version 1.2 Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/Session.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** Session.java 24 Oct 2002 20:02:54 -0000 1.77 --- Session.java 5 Nov 2002 16:58:13 -0000 1.78 *************** *** 307,348 **** /** - * Execute a query, returning only the identifiers. - * - * @param query a query expressed in Hibernate's query language - * @return a distinct list of identifiers (or arrays of identifiers) - * @throws SQLException - * @throws HibernateException - */ - public List findIdentifiers(String query) throws SQLException, HibernateException; - - /** - * Execute a query, returning only the identifiers, binding a value to a "?" parameter - * in the query string. - * - * @param query the query string - * @param value a value to be bound to a "?" placeholder (JDBC IN parameter). - * @param type the Hibernate type of the value - * @see Hibernate for access to <tt>Type</tt> instances - * @return a distinct list of identifiers (or arrays of identifiers) - * @throws SQLException - * @throws HibernateException - */ - public List findIdentifiers(String query, Object value, Type type) throws SQLException, HibernateException; - - /** - * Execute a query, returning only the identifiers, binding an array of values to "?" parameters - * in the query string. - * - * @param query the query string - * @param values an array of values to be bound to the "?" placeholders (JDBC IN parameters). - * @param types an array of Hibernate types of the values - * @see Hibernate for access to <tt>Type</tt> instances - * @return a distinct list of identifiers (or arrays of identifiers) - * @throws SQLException - * @throws HibernateException - */ - public List findIdentifiers(String query, Object[] values, Type[] types) throws SQLException, HibernateException; - - /** * Execute a query and return the results in an iterator. If the query has multiple * return values, values will be returned in an array of type <tt>Object[].</tt><br> --- 307,310 ---- *************** *** 549,585 **** /** - * Load the persistent instance of the given entity class with the given id, using an - * sql <tt>select .... for update</tt> (pessimistic locking). If <tt>for update</tt> is - * not supported by the underlying database, load the instance normally. If the instance - * is already loaded and <tt>for update</tt> is supported, <tt>lock()</tt> the instance. - * - * @deprecated use <tt>load()</tt>, specifying <tt>LockMode.UPGRADE</tt>. - * @param theClass a persistent class - * @param id a valid identifier of an existing persistent instance of the class - * @return the persistent instance - * @throws SQLException - * @throws HibernateException - */ - public Object loadWithLock(Class theClass, Serializable id) throws SQLException, HibernateException; - - /** - * Lock the given object for update (on the database) and check the version number. - * This is used to support a pessimistic locking strategy. If <tt>for update</tt> is - * not supported by the underlying database, do a simple version number check. - * - * @deprecated use <tt>lock()</tt>, specifying <tt>LockMode.UPGRADE</tt>. - * @param object a persistent instance - * @throws SQLException - * @throws HibernateException - */ - public void lock(Object object) throws SQLException, HibernateException; - - /** * Update the persistent instance with the identifier of the given transient * instance. If there is a persistent instance with the same identifier, * an exception is thrown.<br> * <br> ! * If the given transient instance has a null identifier, the session will ! * <tt>save()</tt> the instance with a generated identifier. This is useful * used in conjuction with cascading updates to persist a graph of transient * objects, some of which are newly instantiated.<br> --- 511,520 ---- /** * Update the persistent instance with the identifier of the given transient * instance. If there is a persistent instance with the same identifier, * an exception is thrown.<br> * <br> ! * If the given transient instance has a <tt>null</tt> identifier, the session ! * will <tt>save()</tt> the instance with a generated identifier. This is useful * used in conjuction with cascading updates to persist a graph of transient * objects, some of which are newly instantiated.<br> *************** *** 595,657 **** */ public void update(Object object) throws SQLException, HibernateException; ! /** ! * Persist the given transient instance, using the current value of its identifier property. ! * ! * @deprecated use <literal>save()</literal> together with an <literal>assigned</literal> ! * identifier generator. * ! * @param object a transient instance of a persistent class, with an initialized ! * identifier * @throws SQLException * @throws HibernateException */ ! public void insert(Object object) throws SQLException, HibernateException; /** ! * Persist the given transient instance, using the given identifier. * ! * @deprecated use the two-argument form of <literal>save()</literal>. * ! * @param object a transient instance of a persistent class ! * @param id an unused valid identifier * @throws SQLException * @throws HibernateException */ ! public void insert(Object object, Serializable id) throws SQLException, HibernateException; /** ! * Instantiate a persistent instance of an entity class. * ! * @deprecated instantiate the class yourself and use <tt>save()</tt>. ! * @param theClass ! * @return a persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public Object create(Class theClass) throws SQLException, HibernateException; ! ! /** ! * Create a persistent instance with an assigned identifier. * ! * @deprecated instantiate the class yourself and use <tt>save()</tt>. ! * @param theClass ! * @param id ! * @return a persistent instance * @throws SQLException * @throws HibernateException */ ! public Object create(Class theClass, Serializable id) throws SQLException, HibernateException; - /** - * Returns the identifier of an entity instance cached by the <tt>Session</tt>, or - * <tt>null</tt> if the instance is transient or associated with a different - * <tt>Session</tt>. - * - * @deprecated use <tt>getIdentifier()</tt> - * @param object a persistent instance - * @return the identifier - * @throws HibernateException if the <tt>Session</tt> is connected - */ - public Serializable getID(Object object) throws HibernateException; } --- 530,577 ---- */ public void update(Object object) throws SQLException, HibernateException; ! /** ! * Execute a query, returning only the identifiers. ! * ! * @deprecated use <tt>iterate("select foo.id from .....")</tt> * ! * @param query a query expressed in Hibernate's query language ! * @return a distinct list of identifiers (or arrays of identifiers) * @throws SQLException * @throws HibernateException */ ! public List findIdentifiers(String query) throws SQLException, HibernateException; /** ! * Execute a query, returning only the identifiers, binding a value to a "?" parameter ! * in the query string. * ! * @deprecated use <tt>iterate("select foo.id from .....")</tt> * ! * @param query the query string ! * @param value a value to be bound to a "?" placeholder (JDBC IN parameter). ! * @param type the Hibernate type of the value ! * @see Hibernate for access to <tt>Type</tt> instances ! * @return a distinct list of identifiers (or arrays of identifiers) * @throws SQLException * @throws HibernateException */ ! public List findIdentifiers(String query, Object value, Type type) throws SQLException, HibernateException; /** ! * Execute a query, returning only the identifiers, binding an array of values to "?" parameters ! * in the query string. * ! * @deprecated use <tt>iterate("select foo.id from .....")</tt> * ! * @param query the query string ! * @param values an array of values to be bound to the "?" placeholders (JDBC IN parameters). ! * @param types an array of Hibernate types of the values ! * @see Hibernate for access to <tt>Type</tt> instances ! * @return a distinct list of identifiers (or arrays of identifiers) * @throws SQLException * @throws HibernateException */ ! public List findIdentifiers(String query, Object[] values, Type[] types) throws SQLException, HibernateException; } |
From: <one...@us...> - 2002-11-05 16:58:17
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl In directory usw-pr-cvs1:/tmp/cvs-serv12927/cirrus/hibernate/impl Modified Files: SessionImpl.java Log Message: removed deprecated methods in preparation for version 1.2 Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionImpl.java,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** SessionImpl.java 5 Nov 2002 15:24:35 -0000 1.148 --- SessionImpl.java 5 Nov 2002 16:58:14 -0000 1.149 *************** *** 40,44 **** import cirrus.hibernate.Validatable; import cirrus.hibernate.helpers.*; - import cirrus.hibernate.id.IdentifierGenerator; import cirrus.hibernate.type.AbstractComponentType; import cirrus.hibernate.type.EntityType; --- 40,43 ---- *************** *** 474,497 **** /** - * Create a persistent object with a generated id. - */ - public Object create(Class theClass) throws SQLException, HibernateException { - IdentifierGenerator idGen = getPersister(theClass).getIdentifierGenerator(); - return create( theClass, idGen.generate(this, null) ); - } - - /** - * Create a Object object with the given id. - */ - public Object create(Class theClass, Serializable id) throws SQLException, HibernateException { - - if ( log.isTraceEnabled() ) log.trace( "creating " + theClass.getName() + '#' + id ); - - Object object = getPersister(theClass).instantiate(id); - doSave(object, id); - return object; - } - - /** * Save a transient object ... an id and is generated, assigned to the given * object and returned. --- 473,476 ---- *************** *** 503,527 **** Serializable id = getPersister(object).getIdentifierGenerator().generate(this, object); return doSave(object, id); - } - - /** - * Save a transient object with a manually assigned ID. - */ - public void insert(Object object) throws SQLException, HibernateException { - - if (object==null) throw new NullPointerException("attempted to insert null"); - - Serializable id = getPersister(object).getIdentifier(object); - - if (id==null) throw new NullPointerException("the object passed to insert() had a null identifier"); - - doSave(object, id); - } - - /** - * Save a transient object with a manually assigned ID. - */ - public void insert(Object object, Serializable id) throws SQLException, HibernateException { - save(object, id); } --- 482,485 ---- |
From: <one...@us...> - 2002-11-05 16:58:17
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/engine In directory usw-pr-cvs1:/tmp/cvs-serv12927/cirrus/hibernate/engine Modified Files: SessionImplementor.java Log Message: removed deprecated methods in preparation for version 1.2 Index: SessionImplementor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/engine/SessionImplementor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SessionImplementor.java 29 Oct 2002 02:45:42 -0000 1.6 --- SessionImplementor.java 5 Nov 2002 16:58:13 -0000 1.7 *************** *** 162,165 **** --- 162,170 ---- public void afterTransactionCompletion(); + /** + * Return the identifier of the persistent object, or null if transient + */ + public Serializable getID(Object obj); + } |
From: <one...@us...> - 2002-11-05 15:24:40
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl In directory usw-pr-cvs1:/tmp/cvs-serv4736/hibernate/impl Modified Files: SessionFactoryImpl.java SessionImpl.java Log Message: queries against mapped classes now pick up *all* subclasses, wether mapped as subclasses or not fixed a bug when the same classname appeared twice in a query Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** SessionFactoryImpl.java 30 Oct 2002 15:28:04 -0000 1.56 --- SessionFactoryImpl.java 5 Nov 2002 15:24:35 -0000 1.57 *************** *** 589,601 **** public String[] getImplementors(Class clazz) { ! if ( classPersisters.containsKey(clazz) ) return null; ArrayList results = new ArrayList(); ! Iterator iter = classPersisters.keySet().iterator(); while ( iter.hasNext() ) { ! Object o = iter.next(); ! if ( o instanceof String ) continue; ! Class persistent = (Class) o; ! if ( clazz.isAssignableFrom(persistent) ) { ! results.add( persistent.getName() ); } } --- 589,606 ---- public String[] getImplementors(Class clazz) { ! //if ( classPersisters.containsKey(clazz) ) return null; ArrayList results = new ArrayList(); ! Iterator iter = classPersisters.values().iterator(); while ( iter.hasNext() ) { ! ClassPersister p = (ClassPersister) iter.next(); ! if ( ! (p instanceof Queryable) && ( ! clazz.equals( p.getMappedClass() ) || ( ! ( ! ( (Queryable) p ).isInherited() ) && ! clazz.isAssignableFrom( p.getMappedClass() ) ! ) ! ) ! ) { ! results.add( p.getClassName() ); } } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionImpl.java,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -d -r1.147 -r1.148 *** SessionImpl.java 5 Nov 2002 11:48:07 -0000 1.147 --- SessionImpl.java 5 Nov 2002 15:24:35 -0000 1.148 *************** *** 1057,1063 **** QueryTranslator[] q = getQueries(query, false); ! if (q.length==0) return Collections.EMPTY_LIST; ! ! List result = null; dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called --- 1057,1061 ---- QueryTranslator[] q = getQueries(query, false); ! List results = Collections.EMPTY_LIST; dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called *************** *** 1067,1078 **** for ( int i=0; i<q.length; i++ ) { ! List currentResult = q[i].find(this, values, types, true, selection, namedParams); ! if (result==null) { ! result = currentResult; ! } ! else { ! result.addAll(currentResult); ! } ! } } --- 1065,1071 ---- for ( int i=0; i<q.length; i++ ) { ! List currentResults = q[i].find(this, values, types, true, selection, namedParams); ! currentResults.addAll(results); ! results = currentResults; } } *************** *** 1080,1084 **** dontFlushFromFind--; } ! return result; } --- 1073,1077 ---- dontFlushFromFind--; } ! return results; } *************** *** 1123,1126 **** --- 1116,1121 ---- QueryTranslator[] q = getQueries(query, true); + if (q.length==0) return Collections.EMPTY_LIST.iterator(); + Iterator result = null; Iterator[] results = null; *************** *** 1147,1152 **** if (values.length!=0) log.trace( "parameters: " + StringHelper.toString(values) ); } ! ! QueryTranslator q = factory.getScalarQuery(query); autoFlushIfRequired( q.getQuerySpaces() ); return q.scroll(values, types, selection, namedParams, this); --- 1142,1149 ---- if (values.length!=0) log.trace( "parameters: " + StringHelper.toString(values) ); } ! String[] concreteQueries = QueryTranslator.concreteQueries(query, factory); ! if ( concreteQueries.length>1 ) throw new HibernateException("This query cannot be scrolled: " + query); ! if ( concreteQueries.length==0 ) return null; //TODO: fix this and return an empty ScrollableResults ! QueryTranslator q = factory.getScalarQuery( concreteQueries[0] ); autoFlushIfRequired( q.getQuerySpaces() ); return q.scroll(values, types, selection, namedParams, this); *************** *** 1168,1174 **** } ! QueryTranslator q = factory.getQuery(query); ! autoFlushIfRequired( q.getQuerySpaces() ); ! return q.findIdentifiers(values, types, this); } --- 1165,1182 ---- } ! QueryTranslator[] q = getQueries(query, false); ! ! List result = Collections.EMPTY_LIST; ! ! //execute the queries and return all result lists as a single list ! ! for ( int i=0; i<q.length; i++ ) { ! ! List currentResult = q[i].findIdentifiers(values, types, this); ! currentResult.addAll(result); ! result = currentResult; ! } ! ! return result; } *************** *** 1989,1993 **** for (int i=0; i<fields.length; i++) { Object result = wrap( fields[i], types[i] ); ! if ( result!=fields[i] ) { // && result!=null <---- what was that for?? fields[i] = result; substitute = true; --- 1997,2001 ---- for (int i=0; i<fields.length; i++) { Object result = wrap( fields[i], types[i] ); ! if ( result!=fields[i] ) { fields[i] = result; substitute = true; *************** *** 2543,2556 **** public List filter(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { ! FilterTranslator q = getFilterTranslator(collection, filter, values, types, selection, namedParams, false); dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called ! try { ! return q.find(this, values, types, true, selection, namedParams); } finally { dontFlushFromFind--; } } --- 2551,2575 ---- public List filter(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { ! String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory); ! FilterTranslator[] filters = new FilterTranslator[ concreteFilters.length ]; ! ! for ( int i=0; i<concreteFilters.length; i++ ) { ! filters[i] = getFilterTranslator(collection, concreteFilters[i], values, types, selection, namedParams, false); ! } dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called ! ! List results = Collections.EMPTY_LIST; try { ! for ( int i=0; i<concreteFilters.length; i++ ) { ! List currentResults = filters[i].find(this, values, types, true, selection, namedParams); ! currentResults.addAll(results); ! results = currentResults; ! } } finally { dontFlushFromFind--; } + return results; } *************** *** 2558,2571 **** public Iterator iterateFilter(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { ! FilterTranslator q = getFilterTranslator(collection, filter, values, types, selection, namedParams, true); ! ! dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called ! ! try { ! return q.iterate(values, types, selection, namedParams, this); } ! finally { ! dontFlushFromFind--; } } --- 2577,2605 ---- public Iterator iterateFilter(Object collection, String filter, Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams) throws SQLException, HibernateException { ! String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory); ! FilterTranslator[] filters = new FilterTranslator[ concreteFilters.length ]; ! ! for ( int i=0; i<concreteFilters.length; i++ ) { ! filters[i] = getFilterTranslator(collection, concreteFilters[i], values, types, selection, namedParams, true); } ! ! if (filters.length==0) return Collections.EMPTY_LIST.iterator(); ! ! Iterator result = null; ! Iterator[] results = null; ! boolean many = filters.length>1; ! if (many) results = new Iterator[filters.length]; ! ! //execute the queries and return all results as a single iterator ! for ( int i=0; i<filters.length; i++ ) { ! ! result = filters[i].iterate(values, types, selection, namedParams, this); ! if ( many ) { ! results[i] = result; ! } ! } + + return many ? new JoinedIterator(results) : result; } |
From: <one...@us...> - 2002-11-05 15:24:40
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister In directory usw-pr-cvs1:/tmp/cvs-serv4736/hibernate/persister Modified Files: Queryable.java Log Message: queries against mapped classes now pick up *all* subclasses, wether mapped as subclasses or not fixed a bug when the same classname appeared twice in a query Index: Queryable.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/Queryable.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Queryable.java 5 Nov 2002 03:44:02 -0000 1.6 --- Queryable.java 5 Nov 2002 15:24:36 -0000 1.7 *************** *** 11,15 **** */ public interface Queryable extends Loadable { ! /** * Get the discriminator value for this particular concrete subclass, --- 11,19 ---- */ public interface Queryable extends Loadable { ! ! /** ! * Is this class mapped as a subclass of another class? ! */ ! public boolean isInherited(); /** * Get the discriminator value for this particular concrete subclass, |
From: <one...@us...> - 2002-11-05 15:24:40
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/query In directory usw-pr-cvs1:/tmp/cvs-serv4736/hibernate/query Modified Files: QueryTranslator.java Log Message: queries against mapped classes now pick up *all* subclasses, wether mapped as subclasses or not fixed a bug when the same classname appeared twice in a query Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/query/QueryTranslator.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** QueryTranslator.java 4 Nov 2002 08:10:52 -0000 1.41 --- QueryTranslator.java 5 Nov 2002 15:24:36 -0000 1.42 *************** *** 260,266 **** } else { ! Queryable result = getPersister(typeName); ! if ( result==null ) throw new QueryException( "persistent class not found: " + typeName ); ! return result; } } --- 260,269 ---- } else { ! try { ! return (Queryable) factory.getPersister(typeName); ! } ! catch (MappingException me) { ! throw new QueryException( "persistent class not found: " + typeName ); ! } } } *************** *** 789,792 **** --- 792,796 ---- ArrayList placeholders = new ArrayList(); ArrayList replacements = new ArrayList(); + int count=0; boolean check = false; while ( tokens.hasMoreTokens() ) { *************** *** 813,818 **** } String[] implementors = factory.getImplementors(clazz); if ( implementors!=null ) { ! placeholders.add(token); replacements.add(implementors); } --- 817,824 ---- } String[] implementors = factory.getImplementors(clazz); + String placeholder = "$clazz" + count + "$"; + query = StringHelper.replaceOnce(query, token, placeholder); if ( implementors!=null ) { ! placeholders.add(placeholder); replacements.add(implementors); } |
From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/doc/reference/html_single In directory usw-pr-cvs1:/tmp/cvs-serv22899/doc/reference/html_single Modified Files: index.html Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html_single/index.html,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** index.html 30 Oct 2002 13:34:25 -0000 1.75 --- index.html 5 Nov 2002 13:40:54 -0000 1.76 *************** *** 1,5 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Hibernate Reference Documentation</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.52.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book"><div class="titlepage"><div><h1 class="title"><a name="d45e1"></a>Hibernate Reference Documentation</h1></div><div><h2 class="subtitle">Relational Persistence for Idiomatic Java</h2></div><div><h2 class="subtitle">http://hibernate.sourceforge.net/</h2></div><hr noshade="true"></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="#architecture">Architecture</a></dt><dd><dl><dt>1.1. <a href="#architecture-s1">Overview</a></dt><dt>1.2. <a href="#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <a href="#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="#session-configuration">SessionFactory Configuration</a></dt><dd><dl><dt>2.1. <a href="#session-configuration-s1">Programmatic Datastore Configuration</a></dt><dt>2.2. <a href="#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt>2.3. <a href="#session-configuration-s3">User provided JDBC Connection</a></dt><dt>2.4. <a href="#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt>2.5. <a href="#session-configuration-s5">Other properties</a></dt><dt>2.6. <a href="#session-configuration-s6">XML Configuration File</a></dt><dt>2.7. <a href="#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="#persistent-classes">Persistent Classes</a></dt><dd><dl><dt>3.1. <a href="#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt>3.1.1. <a href="#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt>3.1.2. <a href="#persistent-classes-s1-2">Implement a default constructor</a></dt><dt>3.1.3. <a href="#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt>3.2. <a href="#persistent-classes-s2">Inheritance</a></dt><dt>3.3. <a href="#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt>3.4. <a href="#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="#or-mapping">Basic O/R Mapping</a></dt><dd><dl><dt>4.1. <a href="#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="#or-mapping-s1-12">Collection elements</a></dt></dl></dd><dt>4.2. <a href="#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="#or-mapping-s2-5">The object type</a></dt></dl></dd><dt>4.3. <a href="#or-mapping-s3">Limitations</a></dt></dl></dd><dt>5. <a href="#adv-or-mapping">Advanced O/R Mapping</a></dt><dd><dl><dt>5.1. <a href="#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="#adv-or-mapping-s1-11">Collection Example</a></dt></dl></dd><dt>5.2. <a href="#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt>5.3. <a href="#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="#manipulating-data">Manipulating Persistent Data</a></dt><dd><dl><dt>6.1. <a href="#manipulating-data-s1">Creating a persistent object</a></dt><dt>6.2. <a href="#manipulating-data-s2">Loading an object</a></dt><dt>6.3. <a href="#manipulating-data-s3">Querying</a></dt><dd><dl><dt>6.3.1. <a href="#manipulating-data-s4">Scalar queries</a></dt><dt>6.3.2. <a href="#manipulating-data-s5">The Query interface</a></dt><dt>6.3.3. <a href="#manipulating-data-s5b">Scrollable iteration</a></dt><dt>6.3.4. <a href="#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt>6.4. <a href="#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt>6.5. <a href="#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt>6.6. <a href="#manipulating-data-s9">Deleting persistent objects</a></dt><dt>6.7. <a href="#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt>6.7.1. <a href="#manipulating-data-s11a">Lifecycle objects</a></dt><dt>6.7.2. <a href="#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt>6.8. <a href="#manipulating-data-s12">Flushing</a></dt><dt>6.9. <a href="#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt>6.9.1. <a href="#manipulating-data-s13b">Flushing the session</a></dt><dt>6.9.2. <a href="#manipulating-data-s13b">Committing the transaction</a></dt><dt>6.9.3. <a href="#manipulating-data-s13c">Closing the session</a></dt><dt>6.9.4. <a href="#manipulating-data-s13d">Exception handling</a></dt></dl></dd><dt>6.10. <a href="#manipulating-data-s17">Interceptors</a></dt></dl></dd><dt>7. <a href="#query-language">Hibernate Query Language</a></dt><dd><dl><dt>7.1. <a href="#query-language-s1">Case Sensitivity</a></dt><dt>7.2. <a href="#query-language-s2">The from clause</a></dt><dt>7.3. <a href="#query-language-s3">The select clause</a></dt><dt>7.4. <a href="#query-language-s3b">polymorphism</a></dt><dt>7.5. <a href="#query-language-s4">from collections</a></dt><dt>7.6. <a href="#query-language-s5">The where clause</a></dt><dt>7.7. <a href="#query-language-s6">Expressions</a></dt><dt>7.8. <a href="#query-language-s7">The order by clause</a></dt><dt>7.9. <a href="#query-language-s8">The group by clause</a></dt><dt>7.10. <a href="#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="#transactions">Transactions And Concurrency</a></dt><dd><dl><dt>8.1. <a href="#transactions-s1">Datastores, Sessions and Factories</a></dt><dt>8.2. <a href="#transactions-s3">Threads and connections</a></dt><dt>8.3. <a href="#transactions-s5">Optimistic Locking / Versioning</a></dt><dd><dl><dt>8.3.1. <a href="#transactions-s5-1">Long session with automatic versioning</a></dt><dt>8.3.2. <a href="#transactions-s5-2">Many sessions with automatic versioning</a></dt><dt>8.3.3. <a href="#transactions-s5-3">Application version checking</a></dt></dl></dd><dt>8.4. <a href="#transactions-s2">Session disconnection</a></dt><dt>8.5. <a href="#transactions-s4">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="#examples">Examples</a></dt><dd><dl><dt>9.1. <a href="#examples-s0">Employer / Employee</a></dt><dt>9.2. <a href="#examples-s1">Author / Work</a></dt><dt>9.3. <a href="#examples-s2">Customer / Order / Product</a></dt></dl></dd><dt>10. <a href="#best-practices">Best Practices</a></dt></dl></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="architecture"></a>Chapter 1. Architecture</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1.1. <a href="#architecture-s1">Overview</a></dt><dt>1.2. <a href="#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <a href="#architecture-s3">JMX Integration</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="architecture-s1"></a>1.1. Overview</h2></div></div><p> A (very) high-level view of the Hibernate architecture: </p><div class="mediaobject"><img src="../images/overview.gif" align="center"></div><p> --- 1,5 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Hibernate Reference Documentation</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.52.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book"><div class="titlepage"><div><h1 class="title"><a name="d0e1"></a>Hibernate Reference Documentation</h1></div><div><h2 class="subtitle">Relational Persistence for Idiomatic Java</h2></div><div><h2 class="subtitle">http://hibernate.sourceforge.net/</h2></div><hr noshade="true"></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="#architecture">Architecture</a></dt><dd><dl><dt>1.1. <a href="#architecture-s1">Overview</a></dt><dt>1.2. <a href="#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <a href="#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="#session-configuration">SessionFactory Configuration</a></dt><dd><dl><dt>2.1. <a href="#session-configuration-s1">Programmatic Datastore Configuration</a></dt><dt>2.2. <a href="#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt>2.3. <a href="#session-configuration-s3">User provided JDBC Connection</a></dt><dt>2.4. <a href="#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt>2.5. <a href="#session-configuration-s5">Other properties</a></dt><dt>2.6. <a href="#session-configuration-s6">XML Configuration File</a></dt><dt>2.7. <a href="#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="#persistent-classes">Persistent Classes</a></dt><dd><dl><dt>3.1. <a href="#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt>3.1.1. <a href="#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt>3.1.2. <a href="#persistent-classes-s1-2">Implement a default constructor</a></dt><dt>3.1.3. <a href="#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt>3.2. <a href="#persistent-classes-s2">Inheritance</a></dt><dt>3.3. <a href="#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt>3.4. <a href="#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="#or-mapping">Basic O/R Mapping</a></dt><dd><dl><dt>4.1. <a href="#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt>4.2. <a href="#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></dd><dt>5. <a href="#adv-or-mapping">Advanced O/R Mapping</a></dt><dd><dl><dt>5.1. <a href="#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="#adv-or-mapping-s1-11">Collection Example</a></dt></dl></dd><dt>5.2. <a href="#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt>5.3. <a href="#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="#manipulating-data">Manipulating Persistent Data</a></dt><dd><dl><dt>6.1. <a href="#manipulating-data-s1">Creating a persistent object</a></dt><dt>6.2. <a href="#manipulating-data-s2">Loading an object</a></dt><dt>6.3. <a href="#manipulating-data-s3">Querying</a></dt><dd><dl><dt>6.3.1. <a href="#manipulating-data-s4">Scalar queries</a></dt><dt>6.3.2. <a href="#manipulating-data-s5">The Query interface</a></dt><dt>6.3.3. <a href="#manipulating-data-s5b">Scrollable iteration</a></dt><dt>6.3.4. <a href="#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt>6.4. <a href="#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt>6.5. <a href="#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt>6.6. <a href="#manipulating-data-s9">Deleting persistent objects</a></dt><dt>6.7. <a href="#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt>6.7.1. <a href="#manipulating-data-s11a">Lifecycle objects</a></dt><dt>6.7.2. <a href="#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt>6.8. <a href="#manipulating-data-s12">Flushing</a></dt><dt>6.9. <a href="#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt>6.9.1. <a href="#manipulating-data-s13b">Flushing the session</a></dt><dt>6.9.2. <a href="#manipulating-data-s13b">Committing the transaction</a></dt><dt>6.9.3. <a href="#manipulating-data-s13c">Closing the session</a></dt><dt>6.9.4. <a href="#manipulating-data-s13d">Exception handling</a></dt></dl></dd><dt>6.10. <a href="#manipulating-data-s17">Interceptors</a></dt></dl></dd><dt>7. <a href="#query-language">Hibernate Query Language</a></dt><dd><dl><dt>7.1. <a href="#query-language-s1">Case Sensitivity</a></dt><dt>7.2. <a href="#query-language-s2">The from clause</a></dt><dt>7.3. <a href="#query-language-s3">The select clause</a></dt><dt>7.4. <a href="#query-language-s3b">polymorphism</a></dt><dt>7.5. <a href="#query-language-s4">from collections</a></dt><dt>7.6. <a href="#query-language-s5">The where clause</a></dt><dt>7.7. <a href="#query-language-s6">Expressions</a></dt><dt>7.8. <a href="#query-language-s7">The order by clause</a></dt><dt>7.9. <a href="#query-language-s8">The group by clause</a></dt><dt>7.10. <a href="#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="#transactions">Transactions And Concurrency</a></dt><dd><dl><dt>8.1. <a href="#transactions-s1">Datastores, Sessions and Factories</a></dt><dt>8.2. <a href="#transactions-s3">Threads and connections</a></dt><dt>8.3. <a href="#transactions-s5">Optimistic Locking / Versioning</a></dt><dd><dl><dt>8.3.1. <a href="#transactions-s5-1">Long session with automatic versioning</a></dt><dt>8.3.2. <a href="#transactions-s5-2">Many sessions with automatic versioning</a></dt><dt>8.3.3. <a href="#transactions-s5-3">Application version checking</a></dt></dl></dd><dt>8.4. <a href="#transactions-s2">Session disconnection</a></dt><dt>8.5. <a href="#transactions-s4">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="#examples">Examples</a></dt><dd><dl><dt>9.1. <a href="#examples-s0">Employer / Employee</a></dt><dt>9.2. <a href="#examples-s1">Author / Work</a></dt><dt>9.3. <a href="#examples-s2">Customer / Order / Product</a></dt></dl></dd><dt>10. <a href="#best-practices">Best Practices</a></dt></dl></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="architecture"></a>Chapter 1. Architecture</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1.1. <a href="#architecture-s1">Overview</a></dt><dt>1.2. <a href="#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <a href="#architecture-s3">JMX Integration</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="architecture-s1"></a>1.1. Overview</h2></div></div><p> A (very) high-level view of the Hibernate architecture: </p><div class="mediaobject"><img src="../images/overview.gif" align="center"></div><p> *************** *** 469,474 **** </p><pre class="programlisting">package eg; - import java.util.Date; - public class DomesticCat extends Cat { private String name; --- 469,472 ---- *************** *** 538,542 **** application should not rely upon calls to <tt>validate()</tt> for business functionality. ! </p></div></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="or-mapping"></a>Chapter 4. Basic O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1. <a href="#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="#or-mapping-s1-12">Collection elements</a></dt></dl></dd><dt>4.2. <a href="#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="#or-mapping-s2-5">The object type</a></dt></dl></dd><dt>4.3. <a href="#or-mapping-s3">Limitations</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="or-mapping-s1"></a>4.1. Mapping declaration</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1.1. <a href="#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="#or-mapping-s1-12">Collection elements</a></dt></dl></div><p> Object-relational mappings may be defined in an external XML document. </p><p> --- 536,540 ---- application should not rely upon calls to <tt>validate()</tt> for business functionality. ! </p></div></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="or-mapping"></a>Chapter 4. Basic O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1. <a href="#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt>4.2. <a href="#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="or-mapping-s1"></a>4.1. Mapping declaration</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1.1. <a href="#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="#or-mapping-s1-12">map, set, list, bag</a></dt></dl></div><p> Object-relational mappings may be defined in an external XML document. </p><p> *************** *** 545,549 **** <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> <hibernate-mapping> --- 543,547 ---- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> <hibernate-mapping> *************** *** 564,568 **** </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="date" column="bar-date" type="date"/> </subclass> </class> --- 562,566 ---- </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="name" type="string"/> </subclass> </class> *************** *** 766,775 **** unsaved-value="any|none|null"> ! <property name="propertyName" type="typename"/> ...... </composite-id></pre><p> For a table with a composite key, you may map multiple properties of the class as identifier properties. The <tt><composite-id></tt> element ! accepts <tt><property></tt> mappings as child elements. </p><pre class="programlisting"><composite-id> <property name="medicareNumber"/> --- 764,774 ---- unsaved-value="any|none|null"> ! <key-property name="propertyName" type="typename"/> ...... </composite-id></pre><p> For a table with a composite key, you may map multiple properties of the class as identifier properties. The <tt><composite-id></tt> element ! accepts <tt><key-property></tt> property mappings and ! <tt><key-many-to-one></tt> mappings as child elements. </p><pre class="programlisting"><composite-id> <property name="medicareNumber"/> *************** *** 798,808 **** column="discriminator_column" type="discriminator_type"/></pre><p> ! The <tt><discriminator></tt> element is required for ! polymorphic persistence and declares a discriminator column of the table. The ! discriminator column contains marker values that tell the persistence layer ! what subclass to instantiate for a particular row. A restricted set of types ! may be used: <tt>string</tt>, <tt>character</tt>, ! <tt>integer</tt>, <tt>byte</tt>, <tt>short</tt>, ! <tt>boolean</tt>, <tt>yes_no</tt>, <tt>true_false</tt>. </p><div class="itemizedlist"><ul type="disc"><li><p> <tt>column</tt> (optional - defaults to <tt>class</tt>) the --- 797,807 ---- column="discriminator_column" type="discriminator_type"/></pre><p> ! The <tt><discriminator></tt> element is required for polymorphic persistence ! using the table-per-class-hierarchy mapping strategy and declares a discriminator column of the ! table. The discriminator column contains marker values that tell the persistence layer what ! subclass to instantiate for a particular row. A restricted set of types may be used: ! <tt>string</tt>, <tt>character</tt>, <tt>integer</tt>, ! <tt>byte</tt>, <tt>short</tt>, <tt>boolean</tt>, ! <tt>yes_no</tt>, <tt>true_false</tt>. </p><div class="itemizedlist"><ul type="disc"><li><p> <tt>column</tt> (optional - defaults to <tt>class</tt>) the *************** *** 974,978 **** </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-11"></a>4.1.13. subclass</h3></div></div><p> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. </p><pre class="programlisting"><subclass name="ClassName" --- 973,978 ---- </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-11"></a>4.1.13. subclass</h3></div></div><p> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. For the (recommended) table-per-class-hierarchy ! mapping strategy, the <tt><subclass></tt> declaration is used. </p><pre class="programlisting"><subclass name="ClassName" *************** *** 996,1000 **** define a unique <tt>discriminator-value</tt>. If none is specified, the fully qualified Java class name is used. ! </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-12"></a>4.1.14. Collection elements</h3></div></div><p> Collections are discussed later. For now we will just mention that a collection may be declared either directly beneath the root element of a mapping file or --- 996,1051 ---- define a unique <tt>discriminator-value</tt>. If none is specified, the fully qualified Java class name is used. ! </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-11b"></a>4.1.14. joined-subclass</h3></div></div><p> ! Alternatively, a subclass that is persisted to its own table (table-per-subclass ! mapping strategy) is declared using <tt><joined-subclass></tt> ! </p><pre class="programlisting"><joined-subclass ! name="ClassName" ! proxy="ProxyInterface"> ! ! <key .... > ! ! <property .... /> ! ..... ! </subclass></pre><div class="itemizedlist"><ul type="disc"><li><p> ! <tt>name</tt>: The fully qualified class name of the subclass. ! </p></li><li><p> ! <tt>proxy</tt> (optional): Specifies an interface to use for lazy ! initializing proxies (JDK 1.3+ only). ! </p></li></ul></div><p> ! No discriminator column is required for this mapping strategy. Each subclass must, ! however, declare a table column holding the object identifier using the ! <tt><key></tt> element. The mapping at the start of the chapter ! would be re-written as: ! </p><pre class="programlisting"><?xml version="1.0"?> ! <!DOCTYPE hibernate-mapping PUBLIC ! "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> ! ! <hibernate-mapping> ! ! <class name="eg.Cat" table="CATS"> ! <id name="id" column="uid" type="long"> ! <generator class="hilo.long"/> ! </id> ! <property name="birthdate" type="date"/> ! <property name="color" not-null="true"/> ! <property name="sex" not-null="true"/> ! <property name="weight"/> ! <many-to-one name="mate"/> ! <set role="kittens"> ! <key column="MOTHER"/> ! <one-to-many class="eg.Cat"/> ! </set> ! <joined-subclass name="eg.DomesticCat"> ! <key column="CAT_ID"/> ! <property name="name" type="string"/> ! </joined-subclass> ! </class> ! ! <class name="eg.Baz"> ! <!-- mapping for Baz goes here --> ! </class> ! ! </hibernate-mapping></pre></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-12"></a>4.1.15. map, set, list, bag</h3></div></div><p> Collections are discussed later. For now we will just mention that a collection may be declared either directly beneath the root element of a mapping file or *************** *** 1138,1160 **** <column name="class_name"/> <column name="id"/> ! </property></pre></div></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="or-mapping-s3"></a>4.3. Limitations</h2></div></div><p> ! You should be aware of the following limitation to the relational mappings used ! by Hibernate. ! </p><div class="variablelist"><dl><dt><span class="term">non-normalized table design</span></dt><dd><p> ! Only two O-R mapping strategies are properly supported: ! </p><div class="itemizedlist"><ul type="disc"><li><p> ! table per class hierarchy ! </p></li><li><p> ! table per concrete class ! </p></li></ul></div><p> ! There is so far no support for a normalized table per subclass design. On ! the other hand, the good news is that you can mix together the two supported ! strategies in the same class hierarchy. ! </p></dd><br></dl></div><p> ! See Scott Ambler's paper at ! <a href="http://www.ambysoft.com/mappingObjects.pdf" target="_top">http://www.ambysoft.com/mappingObjects.pdf</a> ! for further discussion of this issue. Of course, the table per class hierarchy strategy ! has much to recommend itself; it is the simplest and most cpu-efficient strategy. ! </p></div></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="adv-or-mapping"></a>Chapter 5. Advanced O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>5.1. <a href="#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="#adv-or-mapping-s1-11">Collection Example</a></dt></dl></dd><dt>5.2. <a href="#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt>5.3. <a href="#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="adv-or-mapping-s1"></a>5.1. Collections</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>5.1.1. <a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="#adv-or-mapping-s1-11">Collection Example</a></dt></dl></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="adv-or-mapping-s1-1"></a>5.1.1. Persistent Collection Styles</h3></div></div><p> This section does not contain much example Java code. We assume you already know how to use Java's collections framework. If so, theres not really anything more --- 1189,1193 ---- <column name="class_name"/> <column name="id"/> ! </property></pre></div></div></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="adv-or-mapping"></a>Chapter 5. Advanced O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>5.1. <a href="#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="#adv-or-mapping-s1-11">Collection Example</a></dt></dl></dd><dt>5.2. <a href="#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt>5.3. <a href="#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="adv-or-mapping-s1"></a>5.1. Collections</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>5.1.1. <a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="#adv-or-mapping-s1-11">Collection Example</a></dt></dl></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="adv-or-mapping-s1-1"></a>5.1.1. Persistent Collection Styles</h3></div></div><p> This section does not contain much example Java code. We assume you already know how to use Java's collections framework. If so, theres not really anything more *************** *** 1338,1342 **** if the map was a subcollection): </p><pre class="programlisting"><map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <key column="id" type="string"> <generator class="uuid.hex"/> </key> --- 1371,1375 ---- if the map was a subcollection): </p><pre class="programlisting"><map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <generated-key column="id" type="string"> <generator class="uuid.hex"/> </key> *************** *** 1572,1576 **** <set role="childset" lazy="true"> ! <key type="long" column="id"> <generator class="sequence"/> </key> --- 1605,1609 ---- <set role="childset" lazy="true"> ! <generated-key type="long" column="id"> <generator class="sequence"/> </key> *************** *** 1759,1765 **** </p><pre class="programlisting"><class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <property name="string"/> ! <property name="short"/> ! <property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> --- 1792,1798 ---- </p><pre class="programlisting"><class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <key-property name="string"/> ! <key-property name="short"/> ! <key-property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> |
From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/doc/reference/html In directory usw-pr-cvs1:/tmp/cvs-serv22899/doc/reference/html Modified Files: adv-or-mapping.html index.html or-mapping.html persistent-classes.html Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: adv-or-mapping.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html/adv-or-mapping.html,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** adv-or-mapping.html 29 Oct 2002 16:09:07 -0000 1.24 --- adv-or-mapping.html 5 Nov 2002 13:40:53 -0000 1.25 *************** *** 183,187 **** if the map was a subcollection): </p><pre class="programlisting"><map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <key column="id" type="string"> <generator class="uuid.hex"/> </key> --- 183,187 ---- if the map was a subcollection): </p><pre class="programlisting"><map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <generated-key column="id" type="string"> <generator class="uuid.hex"/> </key> *************** *** 417,421 **** <set role="childset" lazy="true"> ! <key type="long" column="id"> <generator class="sequence"/> </key> --- 417,421 ---- <set role="childset" lazy="true"> ! <generated-key type="long" column="id"> <generator class="sequence"/> </key> *************** *** 604,610 **** </p><pre class="programlisting"><class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <property name="string"/> ! <property name="short"/> ! <property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> --- 604,610 ---- </p><pre class="programlisting"><class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <key-property name="string"/> ! <key-property name="short"/> ! <key-property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html/index.html,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** index.html 29 Oct 2002 16:09:07 -0000 1.33 --- index.html 5 Nov 2002 13:40:53 -0000 1.34 *************** *** 1,3 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Hibernate Reference Documentation</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.52.1"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="next" href="architecture.html" title="Chapter 1. Architecture"><link rel="chapter" href="architecture.html" title="Chapter 1. Architecture"><link rel="chapter" href="session-configuration.html" title="Chapter 2. SessionFactory Configuration"><link rel="chapter" href="persistent-classes.html" title="Chapter 3. Persistent Classes"><link rel="chapter" href="or-mapping.html" title="Chapter 4. Basic O/R Mapping"><link rel="chapter" href="adv-or-mapping.html" title="Chapter 5. Advanced O/R Mapping"><link rel="chapter" href="manipulating-data.html" title="Chapter 6. Manipulating Persistent Data"><link rel="chapter" href="query-language.html" title="Chapter 7. Hibernate Query Language"><link rel="chapter" href="transactions.html" title="Chapter 8. Transactions And Concurrency"><link rel="chapter" href="examples.html" title="Chapter 9. Examples"><link rel="chapter" href="best-practices.html" title="Chapter 10. Best Practices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Hibernate Reference Documentation</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr></table><hr></div><div class="book"><div class="titlepage"><div><h1 class="title"><a name="d48e1"></a>Hibernate Reference Documentation</h1></div><div><h2 class="subtitle">Relational Persistence for Idiomatic Java</h2></div><div><h2 class="subtitle">http://hibernate.sourceforge.net/</h2></div><hr noshade="true"></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="architecture.html">Architecture</a></dt><dd><dl><dt>1.1. <a href="architecture.html#architecture-s1">Overview</a></dt><dt>1.2. <a href="architecture.html#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <a href="architecture.html#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="session-configuration.html">SessionFactory Configuration</a></dt><dd><dl><dt>2.1. <a href="session-configuration.html#session-configuration-s1">Programmatic Datastore Configuration</a></dt><dt>2.2. <a href="session-configuration.html#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt>2.3. <a href="session-configuration.html#session-configuration-s3">User provided JDBC Connection</a></dt><dt>2.4. <a href="session-configuration.html#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt>2.5. <a href="session-configuration.html#session-configuration-s5">Other properties</a></dt><dt>2.6. <a href="session-configuration.html#session-configuration-s6">XML Configuration File</a></dt><dt>2.7. <a href="session-configuration.html#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="persistent-classes.html">Persistent Classes</a></dt><dd><dl><dt>3.1. <a href="persistent-classes.html#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt>3.1.1. <a href="persistent-classes.html#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt>3.1.2. <a href="persistent-classes.html#persistent-classes-s1-2">Implement a default constructor</a></dt><dt>3.1.3. <a href="persistent-classes.html#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt>3.2. <a href="persistent-classes.html#persistent-classes-s2">Inheritance</a></dt><dt>3.3. <a href="persistent-classes.html#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt>3.4. <a href="persistent-classes.html#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="or-mapping.html">Basic O/R Mapping</a></dt><dd><dl><dt>4.1. <a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-12">Collection elements</a></dt></dl></dd><dt>4.2. <a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="or-mapping.html#or-mapping-s2-5">The object type</a></dt></dl></dd><dt>4.3. <a href="or-mapping.html#or-mapping-s3">Limitations</a></dt></dl></dd><dt>5. <a href="adv-or-mapping.html">Advanced O/R Mapping</a></dt><dd><dl><dt>5.1. <a href="adv-or-mapping.html#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="adv-or-mapping.html#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="adv-or-mapping.html#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="adv-or-mapping.html#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="adv-or-mapping.html#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="adv-or-mapping.html#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="adv-or-mapping.html#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="adv-or-mapping.html#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="adv-or-mapping.html#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="adv-or-mapping.html#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="adv-or-mapping.html#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="adv-or-mapping.html#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="adv-or-mapping.html#adv-or-mapping-s1-11">Collection Example</a></dt></dl></dd><dt>5.2. <a href="adv-or-mapping.html#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="adv-or-mapping.html#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="adv-or-mapping.html#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="adv-or-mapping.html#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="adv-or-mapping.html#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt>5.3. <a href="adv-or-mapping.html#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="adv-or-mapping.html#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="adv-or-mapping.html#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="adv-or-mapping.html#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="adv-or-mapping.html#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="manipulating-data.html">Manipulating Persistent Data</a></dt><dd><dl><dt>6.1. <a href="manipulating-data.html#manipulating-data-s1">Creating a persistent object</a></dt><dt>6.2. <a href="manipulating-data.html#manipulating-data-s2">Loading an object</a></dt><dt>6.3. <a href="manipulating-data.html#manipulating-data-s3">Querying</a></dt><dd><dl><dt>6.3.1. <a href="manipulating-data.html#manipulating-data-s4">Scalar queries</a></dt><dt>6.3.2. <a href="manipulating-data.html#manipulating-data-s5">The Query interface</a></dt><dt>6.3.3. <a href="manipulating-data.html#manipulating-data-s5b">Scrollable iteration</a></dt><dt>6.3.4. <a href="manipulating-data.html#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt>6.4. <a href="manipulating-data.html#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt>6.5. <a href="manipulating-data.html#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt>6.6. <a href="manipulating-data.html#manipulating-data-s9">Deleting persistent objects</a></dt><dt>6.7. <a href="manipulating-data.html#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt>6.7.1. <a href="manipulating-data.html#manipulating-data-s11a">Lifecycle objects</a></dt><dt>6.7.2. <a href="manipulating-data.html#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt>6.8. <a href="manipulating-data.html#manipulating-data-s12">Flushing</a></dt><dt>6.9. <a href="manipulating-data.html#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt>6.9.1. <a href="manipulating-data.html#manipulating-data-s13b">Flushing the session</a></dt><dt>6.9.2. <a href="manipulating-data.html#manipulating-data-s13b">Committing the transaction</a></dt><dt>6.9.3. <a href="manipulating-data.html#manipulating-data-s13c">Closing the session</a></dt><dt>6.9.4. <a href="manipulating-data.html#manipulating-data-s13d">Exception handling</a></dt></dl></dd><dt>6.10. <a href="manipulating-data.html#manipulating-data-s17">Interceptors</a></dt></dl></dd><dt>7. <a href="query-language.html">Hibernate Query Language</a></dt><dd><dl><dt>7.1. <a href="query-language.html#query-language-s1">Case Sensitivity</a></dt><dt>7.2. <a href="query-language.html#query-language-s2">The from clause</a></dt><dt>7.3. <a href="query-language.html#query-language-s3">The select clause</a></dt><dt>7.4. <a href="query-language.html#query-language-s3b">polymorphism</a></dt><dt>7.5. <a href="query-language.html#query-language-s4">from collections</a></dt><dt>7.6. <a href="query-language.html#query-language-s5">The where clause</a></dt><dt>7.7. <a href="query-language.html#query-language-s6">Expressions</a></dt><dt>7.8. <a href="query-language.html#query-language-s7">The order by clause</a></dt><dt>7.9. <a href="query-language.html#query-language-s8">The group by clause</a></dt><dt>7.10. <a href="query-language.html#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="transactions.html">Transactions And Concurrency</a></dt><dd><dl><dt>8.1. <a href="transactions.html#transactions-s1">Datastores, Sessions and Factories</a></dt><dt>8.2. <a href="transactions.html#transactions-s3">Threads and connections</a></dt><dt>8.3. <a href="transactions.html#transactions-s5">Optimistic Locking / Versioning</a></dt><dd><dl><dt>8.3.1. <a href="transactions.html#transactions-s5-1">Long session with automatic versioning</a></dt><dt>8.3.2. <a href="transactions.html#transactions-s5-2">Many sessions with automatic versioning</a></dt><dt>8.3.3. <a href="transactions.html#transactions-s5-3">Application version checking</a></dt></dl></dd><dt>8.4. <a href="transactions.html#transactions-s2">Session disconnection</a></dt><dt>8.5. <a href="transactions.html#transactions-s4">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="examples.html">Examples</a></dt><dd><dl><dt>9.1. <a href="examples.html#examples-s0">Employer / Employee</a></dt><dt>9.2. <a href="examples.html#examples-s1">Author / Work</a></dt><dt>9.3. <a href="examples.html#examples-s2">Customer / Order / Product</a></dt></dl></dd><dt>10. <a href="best-practices.html">Best Practices</a></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Architecture</td></tr></table></div></body></html> \ No newline at end of file --- 1,3 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Hibernate Reference Documentation</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.52.1"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="next" href="architecture.html" title="Chapter 1. Architecture"><link rel="chapter" href="architecture.html" title="Chapter 1. Architecture"><link rel="chapter" href="session-configuration.html" title="Chapter 2. SessionFactory Configuration"><link rel="chapter" href="persistent-classes.html" title="Chapter 3. Persistent Classes"><link rel="chapter" href="or-mapping.html" title="Chapter 4. Basic O/R Mapping"><link rel="chapter" href="adv-or-mapping.html" title="Chapter 5. Advanced O/R Mapping"><link rel="chapter" href="manipulating-data.html" title="Chapter 6. Manipulating Persistent Data"><link rel="chapter" href="query-language.html" title="Chapter 7. Hibernate Query Language"><link rel="chapter" href="transactions.html" title="Chapter 8. Transactions And Concurrency"><link rel="chapter" href="examples.html" title="Chapter 9. Examples"><link rel="chapter" href="best-practices.html" title="Chapter 10. Best Practices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Hibernate Reference Documentation</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr></table><hr></div><div class="book"><div class="titlepage"><div><h1 class="title"><a name="d0e1"></a>Hibernate Reference Documentation</h1></div><div><h2 class="subtitle">Relational Persistence for Idiomatic Java</h2></div><div><h2 class="subtitle">http://hibernate.sourceforge.net/</h2></div><hr noshade="true"></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="architecture.html">Architecture</a></dt><dd><dl><dt>1.1. <a href="architecture.html#architecture-s1">Overview</a></dt><dt>1.2. <a href="architecture.html#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <a href="architecture.html#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="session-configuration.html">SessionFactory Configuration</a></dt><dd><dl><dt>2.1. <a href="session-configuration.html#session-configuration-s1">Programmatic Datastore Configuration</a></dt><dt>2.2. <a href="session-configuration.html#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt>2.3. <a href="session-configuration.html#session-configuration-s3">User provided JDBC Connection</a></dt><dt>2.4. <a href="session-configuration.html#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt>2.5. <a href="session-configuration.html#session-configuration-s5">Other properties</a></dt><dt>2.6. <a href="session-configuration.html#session-configuration-s6">XML Configuration File</a></dt><dt>2.7. <a href="session-configuration.html#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="persistent-classes.html">Persistent Classes</a></dt><dd><dl><dt>3.1. <a href="persistent-classes.html#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt>3.1.1. <a href="persistent-classes.html#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt>3.1.2. <a href="persistent-classes.html#persistent-classes-s1-2">Implement a default constructor</a></dt><dt>3.1.3. <a href="persistent-classes.html#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt>3.2. <a href="persistent-classes.html#persistent-classes-s2">Inheritance</a></dt><dt>3.3. <a href="persistent-classes.html#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt>3.4. <a href="persistent-classes.html#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="or-mapping.html">Basic O/R Mapping</a></dt><dd><dl><dt>4.1. <a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="or-mapping.html#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt>4.2. <a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="or-mapping.html#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></dd><dt>5. <a href="adv-or-mapping.html">Advanced O/R Mapping</a></dt><dd><dl><dt>5.1. <a href="adv-or-mapping.html#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="adv-or-mapping.html#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt>5.1.2. <a href="adv-or-mapping.html#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt>5.1.3. <a href="adv-or-mapping.html#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.4. <a href="adv-or-mapping.html#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt>5.1.5. <a href="adv-or-mapping.html#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.6. <a href="adv-or-mapping.html#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.7. <a href="adv-or-mapping.html#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.8. <a href="adv-or-mapping.html#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.9. <a href="adv-or-mapping.html#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.10. <a href="adv-or-mapping.html#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.11. <a href="adv-or-mapping.html#adv-or-mapping-s1-10">Ternary Associations</a></dt><dt>5.1.12. <a href="adv-or-mapping.html#adv-or-mapping-s1-11">Collection Example</a></dt></dl></dd><dt>5.2. <a href="adv-or-mapping.html#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="adv-or-mapping.html#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="adv-or-mapping.html#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="adv-or-mapping.html#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="adv-or-mapping.html#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt>5.3. <a href="adv-or-mapping.html#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="adv-or-mapping.html#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="adv-or-mapping.html#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="adv-or-mapping.html#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="adv-or-mapping.html#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="manipulating-data.html">Manipulating Persistent Data</a></dt><dd><dl><dt>6.1. <a href="manipulating-data.html#manipulating-data-s1">Creating a persistent object</a></dt><dt>6.2. <a href="manipulating-data.html#manipulating-data-s2">Loading an object</a></dt><dt>6.3. <a href="manipulating-data.html#manipulating-data-s3">Querying</a></dt><dd><dl><dt>6.3.1. <a href="manipulating-data.html#manipulating-data-s4">Scalar queries</a></dt><dt>6.3.2. <a href="manipulating-data.html#manipulating-data-s5">The Query interface</a></dt><dt>6.3.3. <a href="manipulating-data.html#manipulating-data-s5b">Scrollable iteration</a></dt><dt>6.3.4. <a href="manipulating-data.html#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt>6.4. <a href="manipulating-data.html#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt>6.5. <a href="manipulating-data.html#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt>6.6. <a href="manipulating-data.html#manipulating-data-s9">Deleting persistent objects</a></dt><dt>6.7. <a href="manipulating-data.html#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt>6.7.1. <a href="manipulating-data.html#manipulating-data-s11a">Lifecycle objects</a></dt><dt>6.7.2. <a href="manipulating-data.html#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt>6.8. <a href="manipulating-data.html#manipulating-data-s12">Flushing</a></dt><dt>6.9. <a href="manipulating-data.html#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt>6.9.1. <a href="manipulating-data.html#manipulating-data-s13b">Flushing the session</a></dt><dt>6.9.2. <a href="manipulating-data.html#manipulating-data-s13b">Committing the transaction</a></dt><dt>6.9.3. <a href="manipulating-data.html#manipulating-data-s13c">Closing the session</a></dt><dt>6.9.4. <a href="manipulating-data.html#manipulating-data-s13d">Exception handling</a></dt></dl></dd><dt>6.10. <a href="manipulating-data.html#manipulating-data-s17">Interceptors</a></dt></dl></dd><dt>7. <a href="query-language.html">Hibernate Query Language</a></dt><dd><dl><dt>7.1. <a href="query-language.html#query-language-s1">Case Sensitivity</a></dt><dt>7.2. <a href="query-language.html#query-language-s2">The from clause</a></dt><dt>7.3. <a href="query-language.html#query-language-s3">The select clause</a></dt><dt>7.4. <a href="query-language.html#query-language-s3b">polymorphism</a></dt><dt>7.5. <a href="query-language.html#query-language-s4">from collections</a></dt><dt>7.6. <a href="query-language.html#query-language-s5">The where clause</a></dt><dt>7.7. <a href="query-language.html#query-language-s6">Expressions</a></dt><dt>7.8. <a href="query-language.html#query-language-s7">The order by clause</a></dt><dt>7.9. <a href="query-language.html#query-language-s8">The group by clause</a></dt><dt>7.10. <a href="query-language.html#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="transactions.html">Transactions And Concurrency</a></dt><dd><dl><dt>8.1. <a href="transactions.html#transactions-s1">Datastores, Sessions and Factories</a></dt><dt>8.2. <a href="transactions.html#transactions-s3">Threads and connections</a></dt><dt>8.3. <a href="transactions.html#transactions-s5">Optimistic Locking / Versioning</a></dt><dd><dl><dt>8.3.1. <a href="transactions.html#transactions-s5-1">Long session with automatic versioning</a></dt><dt>8.3.2. <a href="transactions.html#transactions-s5-2">Many sessions with automatic versioning</a></dt><dt>8.3.3. <a href="transactions.html#transactions-s5-3">Application version checking</a></dt></dl></dd><dt>8.4. <a href="transactions.html#transactions-s2">Session disconnection</a></dt><dt>8.5. <a href="transactions.html#transactions-s4">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="examples.html">Examples</a></dt><dd><dl><dt>9.1. <a href="examples.html#examples-s0">Employer / Employee</a></dt><dt>9.2. <a href="examples.html#examples-s1">Author / Work</a></dt><dt>9.3. <a href="examples.html#examples-s2">Customer / Order / Product</a></dt></dl></dd><dt>10. <a href="best-practices.html">Best Practices</a></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Architecture</td></tr></table></div></body></html> \ No newline at end of file Index: or-mapping.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html/or-mapping.html,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** or-mapping.html 30 Oct 2002 13:34:25 -0000 1.29 --- or-mapping.html 5 Nov 2002 13:40:53 -0000 1.30 *************** *** 1,5 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 4. Basic O/R Mapping</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.52.1"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="up" href="index.html" title="Hibernate Reference Documentation"><link rel="previous" href="persistent-classes.html" title="Chapter 3. Persistent Classes"><link rel="next" href="adv-or-mapping.html" title="Chapter 5. Advanced O/R Mapping"><link rel="chapter" href="architecture.html" title="Chapter 1. Architecture"><link rel="chapter" href="session-configuration.html" title="Chapter 2. SessionFactory Configuration"><link rel="chapter" href="persistent-classes.html" title="Chapter 3. Persistent Classes"><link rel="chapter" href="or-mapping.html" title="Chapter 4. Basic O/R Mapping"><link rel="chapter" href="adv-or-mapping.html" title="Chapter 5. Advanced O/R Mapping"><link rel="chapter" href="manipulating-data.html" title="Chapter 6. Manipulating Persistent Data"><link rel="chapter" href="query-language.html" title="Chapter 7. Hibernate Query Language"><link rel="chapter" href="transactions.html" title="Chapter 8. Transactions And Concurrency"><link rel="chapter" href="examples.html" title="Chapter 9. Examples"><link rel="chapter" href="best-practices.html" title="Chapter 10. Best Practices"><link rel="section" href="or-mapping.html#or-mapping-s1" title="4.1. Mapping declaration"><link rel="section" href="or-mapping.html#or-mapping-s2" title="4.2. Hibernate Types"><link rel="section" href="or-mapping.html#or-mapping-s3" title="4.3. Limitations"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Basic O/R Mapping</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="persistent-classes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="adv-or-mapping.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="or-mapping"></a>Chapter 4. Basic O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1. <a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-12">Collection elements</a></dt></dl></dd><dt>4.2. <a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="or-mapping.html#or-mapping-s2-5">The object type</a></dt></dl></dd><dt>4.3. <a href="or-mapping.html#or-mapping-s3">Limitations</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="or-mapping-s1"></a>4.1. Mapping declaration</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-12">Collection elements</a></dt></dl></div><p> Object-relational mappings may be defined in an external XML document. </p><p> --- 1,5 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 4. Basic O/R Mapping</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.52.1"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="up" href="index.html" title="Hibernate Reference Documentation"><link rel="previous" href="persistent-classes.html" title="Chapter 3. Persistent Classes"><link rel="next" href="adv-or-mapping.html" title="Chapter 5. Advanced O/R Mapping"><link rel="chapter" href="architecture.html" title="Chapter 1. Architecture"><link rel="chapter" href="session-configuration.html" title="Chapter 2. SessionFactory Configuration"><link rel="chapter" href="persistent-classes.html" title="Chapter 3. Persistent Classes"><link rel="chapter" href="or-mapping.html" title="Chapter 4. Basic O/R Mapping"><link rel="chapter" href="adv-or-mapping.html" title="Chapter 5. Advanced O/R Mapping"><link rel="chapter" href="manipulating-data.html" title="Chapter 6. Manipulating Persistent Data"><link rel="chapter" href="query-language.html" title="Chapter 7. Hibernate Query Language"><link rel="chapter" href="transactions.html" title="Chapter 8. Transactions And Concurrency"><link rel="chapter" href="examples.html" title="Chapter 9. Examples"><link rel="chapter" href="best-practices.html" title="Chapter 10. Best Practices"><link rel="section" href="or-mapping.html#or-mapping-s1" title="4.1. Mapping declaration"><link rel="section" href="or-mapping.html#or-mapping-s2" title="4.2. Hibernate Types"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Basic O/R Mapping</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="persistent-classes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="adv-or-mapping.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="or-mapping"></a>Chapter 4. Basic O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1. <a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="or-mapping.html#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt>4.2. <a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <a href="or-mapping.html#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="or-mapping-s1"></a>4.1. Mapping declaration</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="or-mapping.html#or-mapping-s1-12">map, set, list, bag</a></dt></dl></div><p> Object-relational mappings may be defined in an external XML document. </p><p> *************** *** 8,12 **** <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> <hibernate-mapping> --- 8,12 ---- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> <hibernate-mapping> *************** *** 27,31 **** </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="date" column="bar-date" type="date"/> </subclass> </class> --- 27,31 ---- </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="name" type="string"/> </subclass> </class> *************** *** 229,238 **** unsaved-value="any|none|null"> ! <property name="propertyName" type="typename"/> ...... </composite-id></pre><p> For a table with a composite key, you may map multiple properties of the class as identifier properties. The <tt><composite-id></tt> element ! accepts <tt><property></tt> mappings as child elements. </p><pre class="programlisting"><composite-id> <property name="medicareNumber"/> --- 229,239 ---- unsaved-value="any|none|null"> ! <key-property name="propertyName" type="typename"/> ...... </composite-id></pre><p> For a table with a composite key, you may map multiple properties of the class as identifier properties. The <tt><composite-id></tt> element ! accepts <tt><key-property></tt> property mappings and ! <tt><key-many-to-one></tt> mappings as child elements. </p><pre class="programlisting"><composite-id> <property name="medicareNumber"/> *************** *** 261,271 **** column="discriminator_column" type="discriminator_type"/></pre><p> ! The <tt><discriminator></tt> element is required for ! polymorphic persistence and declares a discriminator column of the table. The ! discriminator column contains marker values that tell the persistence layer ! what subclass to instantiate for a particular row. A restricted set of types ! may be used: <tt>string</tt>, <tt>character</tt>, ! <tt>integer</tt>, <tt>byte</tt>, <tt>short</tt>, ! <tt>boolean</tt>, <tt>yes_no</tt>, <tt>true_false</tt>. </p><div class="itemizedlist"><ul type="disc"><li><p> <tt>column</tt> (optional - defaults to <tt>class</tt>) the --- 262,272 ---- column="discriminator_column" type="discriminator_type"/></pre><p> ! The <tt><discriminator></tt> element is required for polymorphic persistence ! using the table-per-class-hierarchy mapping strategy and declares a discriminator column of the ! table. The discriminator column contains marker values that tell the persistence layer what ! subclass to instantiate for a particular row. A restricted set of types may be used: ! <tt>string</tt>, <tt>character</tt>, <tt>integer</tt>, ! <tt>byte</tt>, <tt>short</tt>, <tt>boolean</tt>, ! <tt>yes_no</tt>, <tt>true_false</tt>. </p><div class="itemizedlist"><ul type="disc"><li><p> <tt>column</tt> (optional - defaults to <tt>class</tt>) the *************** *** 437,441 **** </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-11"></a>4.1.13. subclass</h3></div></div><p> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. </p><pre class="programlisting"><subclass name="ClassName" --- 438,443 ---- </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-11"></a>4.1.13. subclass</h3></div></div><p> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. For the (recommended) table-per-class-hierarchy ! mapping strategy, the <tt><subclass></tt> declaration is used. </p><pre class="programlisting"><subclass name="ClassName" *************** *** 459,463 **** define a unique <tt>discriminator-value</tt>. If none is specified, the fully qualified Java class name is used. ! </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-12"></a>4.1.14. Collection elements</h3></div></div><p> Collections are discussed later. For now we will just mention that a collection may be declared either directly beneath the root element of a mapping file or --- 461,516 ---- define a unique <tt>discriminator-value</tt>. If none is specified, the fully qualified Java class name is used. ! </p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-11b"></a>4.1.14. joined-subclass</h3></div></div><p> ! Alternatively, a subclass that is persisted to its own table (table-per-subclass ! mapping strategy) is declared using <tt><joined-subclass></tt> ! </p><pre class="programlisting"><joined-subclass ! name="ClassName" ! proxy="ProxyInterface"> ! ! <key .... > ! ! <property .... /> ! ..... ! </subclass></pre><div class="itemizedlist"><ul type="disc"><li><p> ! <tt>name</tt>: The fully qualified class name of the subclass. ! </p></li><li><p> ! <tt>proxy</tt> (optional): Specifies an interface to use for lazy ! initializing proxies (JDK 1.3+ only). ! </p></li></ul></div><p> ! No discriminator column is required for this mapping strategy. Each subclass must, ! however, declare a table column holding the object identifier using the ! <tt><key></tt> element. The mapping at the start of the chapter ! would be re-written as: ! </p><pre class="programlisting"><?xml version="1.0"?> ! <!DOCTYPE hibernate-mapping PUBLIC ! "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> ! ! <hibernate-mapping> ! ! <class name="eg.Cat" table="CATS"> ! <id name="id" column="uid" type="long"> ! <generator class="hilo.long"/> ! </id> ! <property name="birthdate" type="date"/> ! <property name="color" not-null="true"/> ! <property name="sex" not-null="true"/> ! <property name="weight"/> ! <many-to-one name="mate"/> ! <set role="kittens"> ! <key column="MOTHER"/> ! <one-to-many class="eg.Cat"/> ! </set> ! <joined-subclass name="eg.DomesticCat"> ! <key column="CAT_ID"/> ! <property name="name" type="string"/> ! </joined-subclass> ! </class> ! ! <class name="eg.Baz"> ! <!-- mapping for Baz goes here --> ! </class> ! ! </hibernate-mapping></pre></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="or-mapping-s1-12"></a>4.1.15. map, set, list, bag</h3></div></div><p> Collections are discussed later. For now we will just mention that a collection may be declared either directly beneath the root element of a mapping file or *************** *** 601,621 **** <column name="class_name"/> <column name="id"/> ! </property></pre></div></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="or-mapping-s3"></a>4.3. Limitations</h2></div></div><p> ! You should be aware of the following limitation to the relational mappings used ! by Hibernate. ! </p><div class="variablelist"><dl><dt><span class="term">non-normalized table design</span></dt><dd><p> ! Only two O-R mapping strategies are properly supported: ! </p><div class="itemizedlist"><ul type="disc"><li><p> ! table per class hierarchy ! </p></li><li><p> ! table per concrete class ! </p></li></ul></div><p> ! There is so far no support for a normalized table per subclass design. On ! the other hand, the good news is that you can mix together the two supported ! strategies in the same class hierarchy. ! </p></dd><br></dl></div><p> ! See Scott Ambler's paper at ! <a href="http://www.ambysoft.com/mappingObjects.pdf" target="_top">http://www.ambysoft.com/mappingObjects.pdf</a> ! for further discussion of this issue. Of course, the table per class hierarchy strategy ! has much to recommend itself; it is the simplest and most cpu-efficient strategy. ! </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="persistent-classes.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="adv-or-mapping.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Persistent Classes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Advanced O/R Mapping</td></tr></table></div></body></html> \ No newline at end of file --- 654,656 ---- <column name="class_name"/> <column name="id"/> ! </property></pre></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="persistent-classes.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="adv-or-mapping.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Persistent Classes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Advanced O/R Mapping</td></tr></table></div></body></html> \ No newline at end of file Index: persistent-classes.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html/persistent-classes.html,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** persistent-classes.html 27 Oct 2002 11:48:37 -0000 1.8 --- persistent-classes.html 5 Nov 2002 13:40:54 -0000 1.9 *************** *** 109,114 **** </p><pre class="programlisting">package eg; - import java.util.Date; - public class DomesticCat extends Cat { private String name; --- 109,112 ---- |
From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/doc/reference/src In directory usw-pr-cvs1:/tmp/cvs-serv22899/doc/reference/src Modified Files: advanced_or_mapping.xml basic_or_mapping.xml persistent_classes.xml Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: advanced_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/src/advanced_or_mapping.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** advanced_or_mapping.xml 29 Oct 2002 16:09:08 -0000 1.23 --- advanced_or_mapping.xml 5 Nov 2002 13:40:54 -0000 1.24 *************** *** 300,304 **** <programlisting><![CDATA[<map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <key column="id" type="string"> <generator class="uuid.hex"/> </key> --- 300,304 ---- <programlisting><![CDATA[<map role="holidays" table="holidays" schema="dbo" order-by="hol_name asc"> ! <generated-key column="id" type="string"> <generator class="uuid.hex"/> </key> *************** *** 680,684 **** <set role="childset" lazy="true"> ! <key type="long" column="id"> <generator class="sequence"/> </key> --- 680,684 ---- <set role="childset" lazy="true"> ! <generated-key type="long" column="id"> <generator class="sequence"/> </key> *************** *** 951,957 **** <programlisting><![CDATA[<class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <property name="string"/> ! <property name="short"/> ! <property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> --- 951,957 ---- <programlisting><![CDATA[<class name="eg.Foo" table"FOOS"> <composite-id name="comp_id" class="eg.FooCompositeID"> ! <key-property name="string"/> ! <key-property name="short"/> ! <key-property name="date" column="date_" type="date"/> </composite-id> <property name="name"/> Index: basic_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/src/basic_or_mapping.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** basic_or_mapping.xml 30 Oct 2002 13:34:25 -0000 1.31 --- basic_or_mapping.xml 5 Nov 2002 13:40:54 -0000 1.32 *************** *** 17,21 **** <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> <hibernate-mapping> --- 17,21 ---- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> <hibernate-mapping> *************** *** 36,40 **** </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="date" column="bar-date" type="date"/> </subclass> </class> --- 36,40 ---- </set> <subclass name="eg.DomesticCat" discriminator-value="D"> ! <property name="name" type="string"/> </subclass> </class> *************** *** 412,416 **** unsaved-value="any|none|null"> ! <property name="propertyName" type="typename"/> ...... </composite-id>]]></programlisting> --- 412,416 ---- unsaved-value="any|none|null"> ! <key-property name="propertyName" type="typename"/> ...... </composite-id>]]></programlisting> *************** *** 419,423 **** For a table with a composite key, you may map multiple properties of the class as identifier properties. The <literal><composite-id></literal> element ! accepts <literal><property></literal> mappings as child elements. </para> --- 419,424 ---- For a table with a composite key, you may map multiple properties of the class as identifier properties. The <literal><composite-id></literal> element ! accepts <literal><key-property></literal> property mappings and ! <literal><key-many-to-one></literal> mappings as child elements. </para> *************** *** 471,481 **** <para> ! The <literal><discriminator></literal> element is required for ! polymorphic persistence and declares a discriminator column of the table. The ! discriminator column contains marker values that tell the persistence layer ! what subclass to instantiate for a particular row. A restricted set of types ! may be used: <literal>string</literal>, <literal>character</literal>, ! <literal>integer</literal>, <literal>byte</literal>, <literal>short</literal>, ! <literal>boolean</literal>, <literal>yes_no</literal>, <literal>true_false</literal>. </para> --- 472,482 ---- <para> ! The <literal><discriminator></literal> element is required for polymorphic persistence ! using the table-per-class-hierarchy mapping strategy and declares a discriminator column of the ! table. The discriminator column contains marker values that tell the persistence layer what ! subclass to instantiate for a particular row. A restricted set of types may be used: ! <literal>string</literal>, <literal>character</literal>, <literal>integer</literal>, ! <literal>byte</literal>, <literal>short</literal>, <literal>boolean</literal>, ! <literal>yes_no</literal>, <literal>true_false</literal>. </para> *************** *** 839,843 **** <para> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. </para> --- 840,845 ---- <para> Finally, polymorphic persistence requires the declaration of each subclass of ! the root persistent class. For the (recommended) table-per-class-hierarchy ! mapping strategy, the <literal><subclass></literal> declaration is used. </para> *************** *** 880,885 **** </sect2> ! <sect2 id="or-mapping-s1-12"> ! <title>Collection elements</title> <para> --- 882,960 ---- </sect2> ! <sect2 id="or-mapping-s1-11b"> ! <title>joined-subclass</title> ! ! <para> ! Alternatively, a subclass that is persisted to its own table (table-per-subclass ! mapping strategy) is declared using <literal><joined-subclass></literal> ! </para> ! ! <programlisting><![CDATA[<joined-subclass ! name="ClassName" ! proxy="ProxyInterface"> ! ! <key .... > ! ! <property .... /> ! ..... ! </subclass>]]></programlisting> ! ! <itemizedlist> ! <listitem> ! <para> ! <literal>name</literal>: The fully qualified class name of the subclass. ! </para> ! </listitem> ! <listitem> ! <para> ! <literal>proxy</literal> (optional): Specifies an interface to use for lazy ! initializing proxies (JDK 1.3+ only). ! </para> ! </listitem> ! </itemizedlist> ! ! <para> ! No discriminator column is required for this mapping strategy. Each subclass must, ! however, declare a table column holding the object identifier using the ! <literal><key></literal> element. The mapping at the start of the chapter ! would be re-written as: ! </para> ! ! <programlisting><![CDATA[<?xml version="1.0"?> ! <!DOCTYPE hibernate-mapping PUBLIC ! "-//Hibernate/Hibernate Mapping DTD//EN" ! "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd"> ! ! <hibernate-mapping> ! ! <class name="eg.Cat" table="CATS"> ! <id name="id" column="uid" type="long"> ! <generator class="hilo.long"/> ! </id> ! <property name="birthdate" type="date"/> ! <property name="color" not-null="true"/> ! <property name="sex" not-null="true"/> ! <property name="weight"/> ! <many-to-one name="mate"/> ! <set role="kittens"> ! <key column="MOTHER"/> ! <one-to-many class="eg.Cat"/> ! </set> ! <joined-subclass name="eg.DomesticCat"> ! <key column="CAT"/> ! <property name="name" type="string"/> ! </joined-subclass> ! </class> ! ! <class name="eg.Baz"> ! <!-- mapping for Baz goes here --> ! </class> ! ! </hibernate-mapping>]]></programlisting> ! ! </sect2> ! ! <sect2 id="or-mapping-s1-12"> ! <title>map, set, list, bag</title> <para> *************** *** 1141,1190 **** </sect2> - </sect1> - - - - <sect1 id="or-mapping-s3"> - <title>Limitations</title> - - <para> - You should be aware of the following limitation to the relational mappings used - by Hibernate. - </para> - - <variablelist> - <varlistentry> - <term>non-normalized table design</term> - <listitem> - <para> - Only two O-R mapping strategies are properly supported: - </para> - <itemizedlist> - <listitem> - <para> - table per class hierarchy - </para> - </listitem> - <listitem> - <para> - table per concrete class - </para> - </listitem> - </itemizedlist> - <para> - There is so far no support for a normalized table per subclass design. On - the other hand, the good news is that you can mix together the two supported - strategies in the same class hierarchy. - </para> - </listitem> - </varlistentry> - </variablelist> - - <para> - See Scott Ambler's paper at - <ulink url="http://www.ambysoft.com/mappingObjects.pdf">http://www.ambysoft.com/mappingObjects.pdf</ulink> - for further discussion of this issue. Of course, the table per class hierarchy strategy - has much to recommend itself; it is the simplest and most cpu-efficient strategy. - </para> </sect1> --- 1216,1219 ---- Index: persistent_classes.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/src/persistent_classes.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** persistent_classes.xml 14 Sep 2002 09:10:54 -0000 1.9 --- persistent_classes.xml 5 Nov 2002 13:40:54 -0000 1.10 *************** *** 164,169 **** <programlisting><![CDATA[package eg; - import java.util.Date; - public class DomesticCat extends Cat { private String name; --- 164,167 ---- |
From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/map In directory usw-pr-cvs1:/tmp/cvs-serv22899/cirrus/hibernate/map Modified Files: Collection.java Subclass.java Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: Collection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Collection.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Collection.java 31 Oct 2002 14:00:27 -0000 1.45 --- Collection.java 5 Nov 2002 13:40:53 -0000 1.46 *************** *** 140,144 **** String name = subnode.getNodeName(); ! if ( "key".equals(name) ) { identifier = new Value(subnode, null, DEFAULT_KEY_COLUMN_NAME, isOneToMany, table, root); if (!toplevel) identifier.setType( owner.getIdentifier().getType() ); --- 140,144 ---- String name = subnode.getNodeName(); ! if ( "key".equals(name) || "generated-key".equals(name) ) { identifier = new Value(subnode, null, DEFAULT_KEY_COLUMN_NAME, isOneToMany, table, root); if (!toplevel) identifier.setType( owner.getIdentifier().getType() ); Index: Subclass.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Subclass.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Subclass.java 31 Oct 2002 14:00:28 -0000 1.18 --- Subclass.java 5 Nov 2002 13:40:53 -0000 1.19 *************** *** 125,129 **** NodeList subnodes = node.getChildNodes(); for ( int i=0; i<subnodes.getLength(); i++ ) { ! if ( "superclass-key".equals( subnodes.item(i).getNodeName() ) ) { key = new Value( subnodes.item(i), Root.ROOT_ROLE_NAME, false, this.table, root ); } --- 125,129 ---- NodeList subnodes = node.getChildNodes(); for ( int i=0; i<subnodes.getLength(); i++ ) { ! if ( "key".equals( subnodes.item(i).getNodeName() ) ) { key = new Value( subnodes.item(i), Root.ROOT_ROLE_NAME, false, this.table, root ); } |
From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory usw-pr-cvs1:/tmp/cvs-serv22899/cirrus/hibernate/test Modified Files: Baz.hbm.xml Multi.hbm.xml Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Baz.hbm.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Baz.hbm.xml 22 Oct 2002 11:53:32 -0000 1.19 --- Baz.hbm.xml 5 Nov 2002 13:40:53 -0000 1.20 *************** *** 5,18 **** <set role="stringSet" lazy="true" sort="natural"> <!--<jcs-cache usage="read-write"/>--> ! <key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </key> <element column="element" type="string" not-null="true"/> </set> <map role="stringDateMap" lazy="true" sort="cirrus.hibernate.test.ReverseComparator"> ! <key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </key> <index column="map_key" type="string" length="32"/> <element column="map_value" type="date"/> --- 5,18 ---- <set role="stringSet" lazy="true" sort="natural"> <!--<jcs-cache usage="read-write"/>--> ! <generated-key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </generated-key> <element column="element" type="string" not-null="true"/> </set> <map role="stringDateMap" lazy="true" sort="cirrus.hibernate.test.ReverseComparator"> ! <generated-key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </generated-key> <index column="map_key" type="string" length="32"/> <element column="map_value" type="date"/> *************** *** 21,27 **** <array role="fooArray" element-class="cirrus.hibernate.test.FooProxy"> <!--<jcs-cache usage="read-write"/>--> ! <key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </key> <index column="i"/> <many-to-many class="cirrus.hibernate.test.Foo"> --- 21,27 ---- <array role="fooArray" element-class="cirrus.hibernate.test.FooProxy"> <!--<jcs-cache usage="read-write"/>--> ! <generated-key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </generated-key> <index column="i"/> <many-to-many class="cirrus.hibernate.test.Foo"> *************** *** 31,37 **** <array role="stringArray"> ! <key column="id_" type="long"> <generator class="hilo.long"/> ! </key> <index column="i"/> <element column="name" type="string"/> --- 31,37 ---- <array role="stringArray"> ! <generated-key column="id_" type="long"> <generator class="hilo.long"/> ! </generated-key> <index column="i"/> <element column="name" type="string"/> *************** *** 39,48 **** <array role="setArray" table="set_array"> ! <key column="id_" type="long"> <generator class="hilo.long"> <param>uid_gen</param> <param>uid_hi</param> </generator> ! </key> <index column="i"/> <subcollection column="names_" length="32" role="stringSet" not-null="true" unique="true"/> --- 39,48 ---- <array role="setArray" table="set_array"> ! <generated-key column="id_" type="long"> <generator class="hilo.long"> <param>uid_gen</param> <param>uid_hi</param> </generator> ! </generated-key> <index column="i"/> <subcollection column="names_" length="32" role="stringSet" not-null="true" unique="true"/> *************** *** 50,56 **** <map role="stringArrayMap" table="str_array_map" lazy="true"> ! <key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </key> <index column="map_key" type="string" length="32"/> <subcollection column="map_value" role="stringArray"/> --- 50,56 ---- <map role="stringArrayMap" table="str_array_map" lazy="true"> ! <generated-key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </generated-key> <index column="map_key" type="string" length="32"/> <subcollection column="map_value" role="stringArray"/> *************** *** 58,64 **** <list role="setList" table="set_list" lazy="true"> ! <key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </key> <index column="i"/> <subcollection column="element" role="stringSet"/> --- 58,64 ---- <list role="setList" table="set_list" lazy="true"> ! <generated-key column="id_" type="string" length="32"> <generator class="uuid.hex"/> ! </generated-key> <index column="i"/> <subcollection column="element" role="stringSet"/> *************** *** 66,72 **** <list role="anotherSetList" table="set_list_2" lazy="true"> ! <key column="id_" type="long"> <generator class="hilo.long"/> ! </key> <index column="i"/> <subcollection column="element" role="stringSet"/> --- 66,72 ---- <list role="anotherSetList" table="set_list_2" lazy="true"> ! <generated-key column="id_" type="long"> <generator class="hilo.long"/> ! </generated-key> <index column="i"/> <subcollection column="element" role="stringSet"/> *************** *** 74,80 **** <list role="customs"> ! <key column="id_" type="long"> <generator class="hilo.long"/> ! </key> <index column="indx"/> <element type="cirrus.hibernate.test.DoubleStringType"> --- 74,80 ---- <list role="customs"> ! <generated-key column="id_" type="long"> <generator class="hilo.long"/> ! </generated-key> <index column="indx"/> <element type="cirrus.hibernate.test.DoubleStringType"> *************** *** 86,92 **** <array role="baz_dates"> <!--<jcs-cache usage="read-write"/>--> ! <key column="id_" type="long"> <generator class="hilo.long"/> ! </key> <index column="i"/> <element type="date" column="the_date"/> --- 86,92 ---- <array role="baz_dates"> <!--<jcs-cache usage="read-write"/>--> ! <generated-key column="id_" type="long"> <generator class="hilo.long"/> ! </generated-key> <index column="i"/> <element type="date" column="the_date"/> *************** *** 95,101 **** <list role="components" table="topcomponents"> <!--<jcs-cache usage="read-write"/>--> ! <key column="id_" type="long"> <generator class="hilo.long"/> ! </key> <index column="i"/> <composite-element class="cirrus.hibernate.test.FooComponent"> --- 95,101 ---- <list role="components" table="topcomponents"> <!--<jcs-cache usage="read-write"/>--> ! <generated-key column="id_" type="long"> <generator class="hilo.long"/> ! </generated-key> <index column="i"/> <composite-element class="cirrus.hibernate.test.FooComponent"> *************** *** 107,120 **** <set role="topbar"> ! <key column="idtopbar" type="string" length="32"> <generator class="uuid.hex"/> ! </key> <one-to-many class = "cirrus.hibernate.test.Bar"/> </set> <map role="topglarch"> ! <key column="idtopglarch" type="string"> <generator class="uuid.hex"/> ! </key> <index column="mapkey" type="character"/> <one-to-many class = "cirrus.hibernate.test.Glarch"/> --- 107,120 ---- <set role="topbar"> ! <generated-key column="idtopbar" type="string" length="32"> <generator class="uuid.hex"/> ! </generated-key> <one-to-many class = "cirrus.hibernate.test.Bar"/> </set> <map role="topglarch"> ! <generated-key column="idtopglarch" type="string"> <generator class="uuid.hex"/> ! </generated-key> <index column="mapkey" type="character"/> <one-to-many class = "cirrus.hibernate.test.Glarch"/> Index: Multi.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Multi.hbm.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Multi.hbm.xml 5 Nov 2002 10:42:52 -0000 1.12 --- Multi.hbm.xml 5 Nov 2002 13:40:53 -0000 1.13 *************** *** 13,17 **** <joined-subclass name="cirrus.hibernate.test.LessSimple" table="subclass"> ! <superclass-key column="id_"/> <property name="intprop" not-null="true"/> <one-to-one name="other" class="cirrus.hibernate.test.LessSimple"/> --- 13,17 ---- <joined-subclass name="cirrus.hibernate.test.LessSimple" table="subclass"> ! <key column="id_"/> <property name="intprop" not-null="true"/> <one-to-one name="other" class="cirrus.hibernate.test.LessSimple"/> *************** *** 26,35 **** <joined-subclass name="cirrus.hibernate.test.Multi" table="nuthasubclass"> ! <superclass-key column="sid"/> <property name="extraProp"/> <many-to-one name="other" column="other2" class="cirrus.hibernate.test.Multi" /> <joined-subclass name="cirrus.hibernate.test.SubMulti" table="submulti"> ! <superclass-key column="sid"/> <property name="amount"/> </joined-subclass> --- 26,35 ---- <joined-subclass name="cirrus.hibernate.test.Multi" table="nuthasubclass"> ! <key column="sid"/> <property name="extraProp"/> <many-to-one name="other" column="other2" class="cirrus.hibernate.test.Multi" /> <joined-subclass name="cirrus.hibernate.test.SubMulti" table="submulti"> ! <key column="sid"/> <property name="amount"/> </joined-subclass> |
From: <one...@us...> - 2002-11-05 13:40:57
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate In directory usw-pr-cvs1:/tmp/cvs-serv22899/cirrus/hibernate Modified Files: hibernate-mapping-1.1.dtd Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: hibernate-mapping-1.1.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/hibernate-mapping-1.1.dtd,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** hibernate-mapping-1.1.dtd 27 Oct 2002 18:30:56 -0000 1.10 --- hibernate-mapping-1.1.dtd 5 Nov 2002 13:40:53 -0000 1.11 *************** *** 102,106 **** <!ELEMENT joined-subclass ( ! superclass-key, (property|many-to-one|one-to-one|collection|component|map|set|list|bag|array|primitive-array)*, joined-subclass* --- 102,106 ---- <!ELEMENT joined-subclass ( ! key, (property|many-to-one|one-to-one|collection|component|map|set|list|bag|array|primitive-array)*, joined-subclass* *************** *** 108,118 **** <!ATTLIST joined-subclass name CDATA #REQUIRED> <!ATTLIST joined-subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface --> - <!ATTLIST joined-subclass discriminator-value CDATA #IMPLIED> <!-- default: unqualified class name | none --> <!ATTLIST joined-subclass table CDATA #REQUIRED> <!ATTLIST joined-subclass schema CDATA #IMPLIED> - - <!ELEMENT superclass-key (column*)> - <!ATTLIST superclass-key column CDATA #IMPLIED> - <!ATTLIST superclass-key length CDATA #IMPLIED> <!-- Property of an entity class or component, component-element, composite-id, etc. --- 108,113 ---- *************** *** 206,210 **** <!ELEMENT map ( jcs-cache?, ! key, (index|composite-index|index-many-to-many), (element|one-to-many|many-to-many|subcollection|composite-element) --- 201,205 ---- <!ELEMENT map ( jcs-cache?, ! (key|generated-key), (index|composite-index|index-many-to-many), (element|one-to-many|many-to-many|subcollection|composite-element) *************** *** 220,224 **** <!ELEMENT set ( jcs-cache?, ! key, (element|one-to-many|many-to-many|subcollection|composite-element) )> --- 215,219 ---- <!ELEMENT set ( jcs-cache?, ! (key|generated-key), (element|one-to-many|many-to-many|subcollection|composite-element) )> *************** *** 234,238 **** <!ELEMENT bag ( jcs-cache?, ! key, (element|one-to-many|many-to-many|subcollection|composite-element) )> --- 229,233 ---- <!ELEMENT bag ( jcs-cache?, ! (key|generated-key), (element|one-to-many|many-to-many|subcollection|composite-element) )> *************** *** 247,251 **** <!ELEMENT list ( jcs-cache?, ! key, index, (element|one-to-many|many-to-many|subcollection|composite-element) --- 242,246 ---- <!ELEMENT list ( jcs-cache?, ! (key|generated-key), index, (element|one-to-many|many-to-many|subcollection|composite-element) *************** *** 259,263 **** <!ELEMENT array ( jcs-cache?, ! key, index, (element|one-to-many|many-to-many|subcollection|composite-element) --- 254,258 ---- <!ELEMENT array ( jcs-cache?, ! (key|generated-key), index, (element|one-to-many|many-to-many|subcollection|composite-element) *************** *** 332,340 **** no guarantee of key stability of a particular collection instance. --> ! <!ELEMENT key (generator?, column*)> <!ATTLIST key column CDATA #IMPLIED> - <!ATTLIST key type CDATA #IMPLIED> <!-- needed for toplevel collections only --> <!ATTLIST key length CDATA #IMPLIED> ! <!-- Declares the type and column mapping for a collection index (array or list index, or key of a map). --> --- 327,339 ---- no guarantee of key stability of a particular collection instance. --> ! <!ELEMENT key (column*)> <!ATTLIST key column CDATA #IMPLIED> <!ATTLIST key length CDATA #IMPLIED> ! ! <!ELEMENT generated-key (generator, column*)> ! <!ATTLIST generated-key column CDATA #IMPLIED> ! <!ATTLIST generated-key type CDATA #REQUIRED> ! <!ATTLIST generated-key length CDATA #IMPLIED> ! <!-- Declares the type and column mapping for a collection index (array or list index, or key of a map). --> |
From: <one...@us...> - 2002-11-05 13:40:56
|
Update of /cvsroot/hibernate/Hibernate/doc In directory usw-pr-cvs1:/tmp/cvs-serv22899/doc Modified Files: features.aft features.html links.aft links.html Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: features.aft =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/features.aft,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** features.aft 29 Oct 2002 16:09:05 -0000 1.27 --- features.aft 5 Nov 2002 13:40:53 -0000 1.28 *************** *** 25,29 **** **Flexible object / relational mappings ! [Polymorphic associations and queries] [Multiple-objects to single-row mapping] "components" allow for use of fine-grained object composition [Associations] --- 25,32 ---- **Flexible object / relational mappings ! [Polymorphic associations and queries] Three mapping strategies are provided ! * table-per-class-hierarchy: polymorphic associations and queries supported ! * table-per-subclass (normalized mapping): polymorphic associations and queries supported ! * table-per-concrete-class: polymorphic queries and non-polymorphic associations supported [Multiple-objects to single-row mapping] "components" allow for use of fine-grained object composition [Associations] Index: features.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/features.html,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** features.html 5 Nov 2002 08:04:00 -0000 1.47 --- features.html 5 Nov 2002 13:40:53 -0000 1.48 *************** *** 45,49 **** <h3><a name="Flexible object / relational mappings">Flexible object / relational mappings</a></h3> <dl> ! <dt><strong>Polymorphic associations and queries</strong><dd></dd></dt> <dt><strong>Multiple-objects to single-row mapping</strong><dd> "components" allow for use of fine-grained object composition</dd></dt> <dt><strong>Associations</strong><dd></dd></dt> --- 45,56 ---- <h3><a name="Flexible object / relational mappings">Flexible object / relational mappings</a></h3> <dl> ! <dt><strong>Polymorphic associations and queries</strong><dd> Three mapping strategies are provided</dd></dt> ! </dl> ! <ul> ! <li> table-per-class-hierarchy: polymorphic associations and queries supported</li> ! <li> table-per-subclass (normalized mapping): polymorphic associations and queries supported</li> ! <li> table-per-concrete-class: polymorphic queries and non-polymorphic associations supported</li> ! </ul> ! <dl> <dt><strong>Multiple-objects to single-row mapping</strong><dd> "components" allow for use of fine-grained object composition</dd></dt> <dt><strong>Associations</strong><dd></dd></dt> Index: links.aft =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/links.aft,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** links.aft 5 Nov 2002 08:04:02 -0000 1.1 --- links.aft 5 Nov 2002 13:40:53 -0000 1.2 *************** *** 14,17 **** --- 14,21 ---- #---PASS-HTML <ul><li> <a href="http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison">http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison</a></li></ul> + Scott Ambler's well-known paper is the about best explanation of O / R mapping strategies around + + * http://www.ambysoft.com/mappingObjects.pdf + **Related Projects *************** *** 24,29 **** * http://sourceforge.net/projects/c3p0 ! Hibernate uses various pieces of Jakarta commons and Turbine JCS internally * http://jakarta.apache.org --- 28,42 ---- * http://sourceforge.net/projects/c3p0 ! Hibernate uses Turbine JCS and various pieces of Jakarta commons * http://jakarta.apache.org + **Other Projects + + WebWork is a great MVC framework for agile development + + * http://www.opensymphony.com/webwork/ + + JBoss is a free application server with JMX + + * http://jboss.org Index: links.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/links.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** links.html 5 Nov 2002 08:04:02 -0000 1.1 --- links.html 5 Nov 2002 13:40:53 -0000 1.2 *************** *** 28,32 **** The Cayenne project maintains a Wiki page comparing features of various Java O / R tools </p> ! <ul><li> <a href="http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison">http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison</a></li></ul><!--End Section 2--> <h3><a name="Related Projects">Related Projects</a></h3> <p class="Body"> --- 28,38 ---- The Cayenne project maintains a Wiki page comparing features of various Java O / R tools </p> ! <ul><li> <a href="http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison">http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison</a></li></ul><p class="Body"> ! Scott Ambler's well-known paper is the about best explanation of O / R mapping strategies around ! </p> ! <ul> ! <li> <a href="http://www.ambysoft.com/mappingObjects.pdf">http://www.ambysoft.com/mappingObjects.pdf</a></li> ! </ul> ! <!--End Section 2--> <h3><a name="Related Projects">Related Projects</a></h3> <p class="Body"> *************** *** 43,50 **** </ul> <p class="Body"> ! Hibernate uses various pieces of Jakarta commons and Turbine JCS internally </p> <ul> <li> <a href="http://jakarta.apache.org">http://jakarta.apache.org</a></li> </ul> <!--End Section 2--> --- 49,70 ---- </ul> <p class="Body"> ! Hibernate uses Turbine JCS and various pieces of Jakarta commons </p> <ul> <li> <a href="http://jakarta.apache.org">http://jakarta.apache.org</a></li> + </ul> + <!--End Section 2--> + <h3><a name="Other Projects">Other Projects</a></h3> + <p class="Body"> + WebWork is a great MVC framework for agile development + </p> + <ul> + <li> <a href="http://www.opensymphony.com/webwork">http://www.opensymphony.com/webwork</a>/</li> + </ul> + <p class="Body"> + JBoss is a free application server with JMX + </p> + <ul> + <li> <a href="http://jboss.org">http://jboss.org</a></li> </ul> <!--End Section 2--> |
From: <one...@us...> - 2002-11-05 13:40:56
|
Update of /cvsroot/hibernate/Hibernate In directory usw-pr-cvs1:/tmp/cvs-serv22899 Modified Files: changelog.txt todo.txt Log Message: updates to hibernate-mapping-1.1.dtd and documentation Index: changelog.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate/changelog.txt,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -d -r1.257 -r1.258 *** changelog.txt 5 Nov 2002 08:03:55 -0000 1.257 --- changelog.txt 5 Nov 2002 13:40:53 -0000 1.258 *************** *** 10,13 **** --- 10,15 ---- * fixed a problem with outerjoin fetching of one-to-one associations defined on subclasses * fixed a minor problem with proxies of classes that override finalize() + * finished work on normalized table mappings using <joined-subclass> declaration + * deprecated hibernate-mapping.dtd in favor of hibernate-mapping-1.1.dtd Changes in version 1.1.8 (30.10.2002) Index: todo.txt =================================================================== RCS file: /cvsroot/hibernate/Hibernate/todo.txt,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** todo.txt 31 Oct 2002 14:02:18 -0000 1.25 --- todo.txt 5 Nov 2002 13:40:53 -0000 1.26 *************** *** 1,10 **** TODO ==== - * normalized table-per-subclass mapping style * immediate deep fetching for queries * allow version numbers to be tracked by persistence layer, not persistent objects (make property optional) - - * Getting started documentation - Feature Requests: http://sourceforge.net/tracker/?atid=428711&group_id=40712&func=browse --- 1,6 ---- |
From: <one...@us...> - 2002-11-05 11:48:12
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl In directory usw-pr-cvs1:/tmp/cvs-serv20016/hibernate/impl Modified Files: ScheduledUpdate.java SessionImpl.java Log Message: for normalized table mappings, only update the tables that have dirty properties Index: ScheduledUpdate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/ScheduledUpdate.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ScheduledUpdate.java 1 Oct 2002 01:25:30 -0000 1.18 --- ScheduledUpdate.java 5 Nov 2002 11:48:07 -0000 1.19 *************** *** 14,27 **** private final Object[] fields; private final Object lastVersion; ! public ScheduledUpdate(Serializable id, Object[] fields, Object lastVersion, Object instance, ClassPersister persister, SessionImplementor session) { super(session, id, instance, persister); this.fields = fields; this.lastVersion = lastVersion; } public void execute() throws SQLException, HibernateException { if ( persister.hasCache() ) persister.getCache().lock(id); ! persister.update(id, fields, lastVersion, instance, session); } --- 14,29 ---- private final Object[] fields; private final Object lastVersion; + private final int[] dirtyFields; ! public ScheduledUpdate(Serializable id, Object[] fields, int[] dirtyProperties, Object lastVersion, Object instance, ClassPersister persister, SessionImplementor session) { super(session, id, instance, persister); this.fields = fields; this.lastVersion = lastVersion; + this.dirtyFields = dirtyProperties; } public void execute() throws SQLException, HibernateException { if ( persister.hasCache() ) persister.getCache().lock(id); ! persister.update(id, fields, dirtyFields, lastVersion, instance, session); } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionImpl.java,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** SessionImpl.java 2 Nov 2002 14:32:12 -0000 1.146 --- SessionImpl.java 5 Nov 2002 11:48:07 -0000 1.147 *************** *** 1770,1779 **** boolean substitute = wrap(values, types); // substitutes into values by side-effect ! // compare to cached state (ignoring nested collections) if ( ! /*( status==LOADED &&*/ entry.loadedState==null || // object loaded by update() ! persister.isDirty(values, entry.loadedState, object, this) || ! ( status==LOADED && persister.isVersioned() && persister.hasCollections() && searchForDirtyCollections(values, types) ) ) { // its dirty! --- 1770,1792 ---- boolean substitute = wrap(values, types); // substitutes into values by side-effect ! ! boolean noCleanState = entry.loadedState==null; // object loaded by update() ! final int[] dirtyProperties; ! if (!noCleanState) { ! dirtyProperties = persister.findDirty(values, entry.loadedState, object, this); ! } ! else { ! dirtyProperties = null; ! } ! // compare to cached state (ignoring nested collections) if ( ! noCleanState || ! (dirtyProperties!=null) || ( ! status==LOADED && ! persister.isVersioned() && ! persister.hasCollections() && ! searchForDirtyCollections(values, types) ! ) ) { // its dirty! *************** *** 1790,1799 **** Object[] copiedValues = new Object[values.length]; TypeFactory.deepCopy(values, types, copiedValues); ! entry.loadedState = copiedValues; //for next time ! //entry.wasCached = false; ! entry.nextLockMode = LockMode.WRITE; //if this flush completes successfully, we will have an exclusive lock } ! //increment the version number (if necessary) if ( persister.isVersioned() ) { if (status!=DELETED) entry.nextVersion = Versioning.increment( entry.lastVersion, persister.getVersionType() ); --- 1803,1811 ---- Object[] copiedValues = new Object[values.length]; TypeFactory.deepCopy(values, types, copiedValues); ! entry.loadedState = copiedValues; // for next time ! entry.nextLockMode = LockMode.WRITE; // if this flush goes ahead, we will have a write lock } ! // increment the version number (if necessary) if ( persister.isVersioned() ) { if (status!=DELETED) entry.nextVersion = Versioning.increment( entry.lastVersion, persister.getVersionType() ); *************** *** 1804,1808 **** updates.put( new Key(entry.id, persister), ! new ScheduledUpdate( entry.id, values, entry.lastVersion, object, persister, this ) ); --- 1816,1820 ---- updates.put( new Key(entry.id, persister), ! new ScheduledUpdate( entry.id, values, dirtyProperties, entry.lastVersion, object, persister, this ) ); *************** *** 1810,1814 **** if (status==DELETED) { ! entry.status = GONE; //for next time } else { --- 1822,1826 ---- if (status==DELETED) { ! entry.status = GONE; //for next time } else { *************** *** 1820,1824 **** // Search for collections by reachability, updating their role. // We don't want to touch collections reachable from a deleted object - updateReachables(values, types, object); } --- 1832,1835 ---- |
From: <one...@us...> - 2002-11-05 11:48:12
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory usw-pr-cvs1:/tmp/cvs-serv20016/hibernate/test Modified Files: CustomPersister.java Nameable.hbm.xml Log Message: for normalized table mappings, only update the tables that have dirty properties Index: CustomPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/CustomPersister.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CustomPersister.java 25 Oct 2002 18:26:11 -0000 1.13 --- CustomPersister.java 5 Nov 2002 11:48:08 -0000 1.14 *************** *** 167,171 **** * @see cirrus.hibernate.persister.ClassPersister#isDirty(Object[], Object[], Object, SessionImplementor) */ ! public boolean isDirty( Object[] x, Object[] y, --- 167,171 ---- * @see cirrus.hibernate.persister.ClassPersister#isDirty(Object[], Object[], Object, SessionImplementor) */ ! public int[] findDirty( Object[] x, Object[] y, *************** *** 173,177 **** SessionImplementor session) throws HibernateException { ! return x[0]!=y[0] && ( x[0]==null || y[0]==null || !x[0].equals(y[0]) ); } --- 173,182 ---- SessionImplementor session) throws HibernateException { ! if ( x[0]!=y[0] && ( x[0]==null || y[0]==null || !x[0].equals(y[0]) ) ) { ! return new int[] { 0 }; ! } ! else { ! return null; ! } } *************** *** 330,333 **** --- 335,339 ---- Serializable id, Object[] fields, + int[] dirtyFields, Object oldVersion, Object object, Index: Nameable.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/Nameable.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Nameable.hbm.xml 5 Nov 2002 07:09:14 -0000 1.2 --- Nameable.hbm.xml 5 Nov 2002 11:48:08 -0000 1.3 *************** *** 4,8 **** <class name="cirrus.hibernate.test.Nameable"> ! <id name="key_"> <generator class="native"/> </id> --- 4,8 ---- <class name="cirrus.hibernate.test.Nameable"> ! <id name="key" column="key_"> <generator class="native"/> </id> |
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister In directory usw-pr-cvs1:/tmp/cvs-serv20016/hibernate/persister Modified Files: AbstractEntityPersister.java ClassPersister.java EntityPersister.java MultiTableEntityPersister.java Log Message: for normalized table mappings, only update the tables that have dirty properties Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/AbstractEntityPersister.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AbstractEntityPersister.java 31 Oct 2002 14:00:25 -0000 1.10 --- AbstractEntityPersister.java 5 Nov 2002 11:48:08 -0000 1.11 *************** *** 233,244 **** * Determine if the given field values are dirty */ ! public boolean isDirty(Object[] x, Object[] y, Object owner, SessionImplementor session) throws HibernateException { ! int prop = TypeFactory.findDirty( propertyTypes, x, y, owner, session.getFactory() ); ! if ( prop==-1) { ! return false; } else { ! if ( log.isTraceEnabled() ) log.trace( className + "."+ propertyNames[prop] + " is dirty" ); ! return true; } } --- 233,248 ---- * Determine if the given field values are dirty */ ! public int[] findDirty(Object[] x, Object[] y, Object owner, SessionImplementor session) throws HibernateException { ! int[] props = TypeFactory.findDirty( propertyTypes, x, y, owner, session.getFactory() ); ! if ( props==null) { ! return null; } else { ! if ( log.isTraceEnabled() ) { ! for ( int i=0; i<props.length; i++ ) { ! log.trace( className + '.'+ propertyNames[ props[i] ] + " is dirty" ); ! } ! } ! return props; } } Index: ClassPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/ClassPersister.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ClassPersister.java 25 Oct 2002 18:26:11 -0000 1.18 --- ClassPersister.java 5 Nov 2002 11:48:08 -0000 1.19 *************** *** 140,145 **** /** * Compare two snapshots of the state of an instance to determine if the persistent state was modified */ ! public boolean isDirty(Object[] x, Object[] y, Object owner, SessionImplementor session) throws HibernateException; /** --- 140,146 ---- /** * Compare two snapshots of the state of an instance to determine if the persistent state was modified + * @return <tt>null</tt> or the indices of the dirty properties */ ! public int[] findDirty(Object[] x, Object[] y, Object owner, SessionImplementor session) throws HibernateException; /** *************** *** 221,225 **** * Update a persistent instance */ ! public void update(Serializable id, Object[] fields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException; /** --- 222,226 ---- * Update a persistent instance */ ! public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException; /** Index: EntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/EntityPersister.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** EntityPersister.java 5 Nov 2002 10:42:52 -0000 1.37 --- EntityPersister.java 5 Nov 2002 11:48:08 -0000 1.38 *************** *** 628,632 **** * Update an object */ ! public void update(Serializable id, Object[] fields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { --- 628,632 ---- * Update an object */ ! public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { Index: MultiTableEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/MultiTableEntityPersister.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** MultiTableEntityPersister.java 5 Nov 2002 10:42:52 -0000 1.27 --- MultiTableEntityPersister.java 5 Nov 2002 11:48:08 -0000 1.28 *************** *** 25,28 **** --- 25,29 ---- import java.sql.SQLException; import java.util.ArrayList; + import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; *************** *** 527,530 **** --- 528,533 ---- private int dehydrate(Serializable id, Object[] fields, int table, PreparedStatement statement, SessionImplementor session) throws SQLException, HibernateException { + if (statement==null) return -1; + int index = 1; *************** *** 752,757 **** * Update an object */ ! public void update(Serializable id, Object[] fields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException { if ( log.isTraceEnabled() ) { log.trace("Updating entity: " + getClassName() + '#' + id); --- 755,775 ---- * Update an object */ ! public void update(Serializable id, Object[] fields, int[] dirtyFields, Object oldVersion, Object object, SessionImplementor session) throws SQLException, HibernateException { ! ! if (!hasColumns) return; // for objects that came in via update() ! ! int tables = tableNames.length; + boolean[] tableUpdateNeeded = new boolean[tables]; + if (dirtyFields==null) { + Arrays.fill(tableUpdateNeeded, true); // for objects that came in via update() + } + else { + for ( int i=0; i<dirtyFields.length; i++ ) { + tableUpdateNeeded[ propertyTables[ dirtyFields[i] ] ] = true; + } + if ( isVersioned() ) tableUpdateNeeded[0] = true; + } + if ( log.isTraceEnabled() ) { log.trace("Updating entity: " + getClassName() + '#' + id); *************** *** 759,777 **** } - if (!hasColumns) return; - //Render the SQL query ! final PreparedStatement[] statements = new PreparedStatement[ tableNames.length ]; for ( int i=0; i<tableNames.length; i++ ) { ! statements[i] = session.getBatcher().prepareStatement( sqlUpdate()[i] ); } try { ! int versionParam = dehydrate(id, fields, statements, session); if ( isVersioned() ) getVersionType().nullSafeSet( statements[0], oldVersion, versionParam, session ); ! for ( int i=0; i<tableNames.length; i++ ) check( statements[i].executeUpdate(), id ); --- 777,795 ---- } //Render the SQL query ! final PreparedStatement[] statements = new PreparedStatement[tables]; for ( int i=0; i<tableNames.length; i++ ) { ! if ( tableUpdateNeeded[i] ) statements[i] = session.getBatcher().prepareStatement( sqlUpdate()[i] ); } try { ! int versionParam = dehydrate(id, fields, statements, session); //TODO if ( isVersioned() ) getVersionType().nullSafeSet( statements[0], oldVersion, versionParam, session ); ! for ( int i=0; i<tables; i++ ) { ! if ( tableUpdateNeeded[i] ) check( statements[i].executeUpdate(), id ); ! } *************** *** 782,786 **** } finally { ! for ( int i=0; i<tableNames.length; i++ ) session.getBatcher().closeStatement( statements[i] ); } --- 800,806 ---- } finally { ! for ( int i=0; i<tableNames.length; i++ ) { ! if ( tableUpdateNeeded[i] ) session.getBatcher().closeStatement( statements[i] ); ! } } |
From: <one...@us...> - 2002-11-05 11:48:11
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/type In directory usw-pr-cvs1:/tmp/cvs-serv20016/hibernate/type Modified Files: TypeFactory.java Log Message: for normalized table mappings, only update the tables that have dirty properties Index: TypeFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/TypeFactory.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** TypeFactory.java 5 Oct 2002 09:33:42 -0000 1.20 --- TypeFactory.java 5 Nov 2002 11:48:08 -0000 1.21 *************** *** 176,182 **** /** * Return <tt>-1</tt> if non-dirty, or the index of the first dirty value otherwise */ ! public static int findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException { for (int i=0; i<types.length; i++) { if ( types[i].isDirty( x[i], y[i], owner, factory ) ) { --- 176,205 ---- /** + * Determine if any of the given field values are dirty, returning an array containing indexes of + * the dirty fields or <tt>null</tt> if no fields are dirty. + */ + public static int[] findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException { + int[] results = null; + int count = 0; + for (int i=0; i<types.length; i++) { + if ( types[i].isDirty( x[i], y[i], owner, factory ) ) { + if (results==null) results = new int[ types.length ]; + results[count++]=i; + } + } + if (count==0) { + return null; + } + else { + int[] trimmed = new int[count]; + System.arraycopy(results, 0, trimmed, 0, count); + return trimmed; + } + } + + /** * Return <tt>-1</tt> if non-dirty, or the index of the first dirty value otherwise */ ! /*public static int findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException { for (int i=0; i<types.length; i++) { if ( types[i].isDirty( x[i], y[i], owner, factory ) ) { *************** *** 185,189 **** } return -1; ! } } --- 208,212 ---- } return -1; ! }*/ } |