1
//$Id: FumTest.java 10976 2006-12-12 23:22:26Z steve.ebersole@jboss.com $
2
package org.hibernate.test.legacy;
4
import java.io.ByteArrayInputStream;
5
import java.io.ByteArrayOutputStream;
6
import java.io.IOException;
7
import java.io.ObjectInputStream;
8
import java.io.ObjectOutputStream;
9
import java.io.Serializable;
10
import java.sql.SQLException;
11
import java.util.ArrayList;
12
import java.util.Date;
13
import java.util.GregorianCalendar;
14
import java.util.HashSet;
15
import java.util.Iterator;
16
import java.util.LinkedList;
17
import java.util.List;
19
import java.util.Properties;
22
import junit.framework.Test;
23
import junit.textui.TestRunner;
25
import org.hibernate.Criteria;
26
import org.hibernate.FetchMode;
27
import org.hibernate.FlushMode;
28
import org.hibernate.Hibernate;
29
import org.hibernate.HibernateException;
30
import org.hibernate.LockMode;
31
import org.hibernate.Query;
32
import org.hibernate.Transaction;
33
import org.hibernate.classic.Session;
34
import org.hibernate.criterion.Expression;
35
import org.hibernate.criterion.MatchMode;
36
import org.hibernate.dialect.HSQLDialect;
37
import org.hibernate.dialect.MckoiDialect;
38
import org.hibernate.dialect.MySQLDialect;
39
import org.hibernate.dialect.PointbaseDialect;
40
import org.hibernate.dialect.TimesTenDialect;
41
import org.hibernate.dialect.Dialect;
42
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
43
import org.hibernate.transform.Transformers;
44
import org.hibernate.type.DateType;
45
import org.hibernate.type.EntityType;
46
import org.hibernate.type.StringType;
47
import org.hibernate.type.Type;
49
public class FumTest extends LegacyTestCase {
51
private static short fumKeyShort = 1;
53
public FumTest(String arg) {
57
public String[] getMappings() {
59
"legacy/FooBar.hbm.xml",
62
"legacy/Glarch.hbm.xml",
64
"legacy/Fumm.hbm.xml",
67
"legacy/Many.hbm.xml",
68
"legacy/Immutable.hbm.xml",
70
"legacy/Vetoer.hbm.xml",
71
"legacy/Holder.hbm.xml",
72
"legacy/Location.hbm.xml",
73
"legacy/Stuff.hbm.xml",
74
"legacy/Container.hbm.xml",
75
"legacy/Simple.hbm.xml",
76
"legacy/Middle.hbm.xml"
80
public static Test suite() {
81
return new FunctionalTestClassTestSuite( FumTest.class );
84
public static void main(String[] args) throws Exception {
85
TestRunner.run( suite() );
88
public void testQuery() {
89
Session s = openSession();
90
Transaction t = s.beginTransaction();
91
s.createQuery("from Fum fum where fum.fo.id.string = 'x'").list();
96
public void testCriteriaCollection() throws Exception {
97
Session s = openSession();
98
Fum fum = new Fum( fumKey("fum") );
99
fum.setFum("a value");
100
fum.getMapComponent().getFummap().put("self", fum);
101
fum.getMapComponent().getStringmap().put("string", "a staring");
102
fum.getMapComponent().getStringmap().put("string2", "a notha staring");
103
fum.getMapComponent().setCount(1);
106
s.connection().commit();
109
Fum b = (Fum) s.createCriteria(Fum.class).add(
110
Expression.in("fum", new String[] { "a value", "no value" } )
113
//assertTrue( Hibernate.isInitialized( b.getMapComponent().getFummap() ) );
114
assertTrue( Hibernate.isInitialized( b.getMapComponent().getStringmap() ) );
115
assertTrue( b.getMapComponent().getFummap().size()==1 );
116
assertTrue( b.getMapComponent().getStringmap().size()==2 );
119
s.connection().commit();
123
public void testCriteria() throws Exception {
124
Session s = openSession();
125
Transaction txn = s.beginTransaction();
126
Fum fum = new Fum( fumKey("fum") );
127
fum.setFo( new Fum( fumKey("fo") ) );
128
fum.setFum("fo fee fi");
129
fum.getFo().setFum("stuff");
130
Fum fr = new Fum( fumKey("fr") );
132
Fum fr2 = new Fum( fumKey("fr2") );
134
fum.setFriends( new HashSet() );
135
fum.getFriends().add(fr);
136
fum.getFriends().add(fr2);
139
s.save( fum.getFo() );
142
Criteria base = s.createCriteria(Fum.class)
143
.add( Expression.like("fum", "f", MatchMode.START) );
144
base.createCriteria("fo")
145
.add( Expression.isNotNull("fum") );
146
base.createCriteria("friends")
147
.add( Expression.like("fum", "g%") );
148
List list = base.list();
149
assertTrue( list.size()==1 && list.get(0)==fum );
151
base = s.createCriteria(Fum.class)
152
.add( Expression.like("fum", "f%") )
153
.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
154
base.createCriteria("fo", "fo")
155
.add( Expression.isNotNull("fum") );
156
base.createCriteria("friends", "fum")
157
.add( Expression.like("fum", "g", MatchMode.START) );
158
Map map = (Map) base.uniqueResult();
161
map.get("this")==fum &&
162
map.get("fo")==fum.getFo() &&
163
fum.getFriends().contains( map.get("fum") ) &&
167
base = s.createCriteria(Fum.class)
168
.add( Expression.like("fum", "f%") )
169
.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP)
170
.setFetchMode("friends", FetchMode.EAGER);
171
base.createCriteria("fo", "fo")
172
.add( Expression.eq( "fum", fum.getFo().getFum() ) );
173
map = (Map) base.list().get(0);
176
map.get("this")==fum &&
177
map.get("fo")==fum.getFo() &&
181
list = s.createCriteria(Fum.class)
182
.createAlias("friends", "fr")
183
.createAlias("fo", "fo")
184
.add( Expression.like("fum", "f%") )
185
.add( Expression.isNotNull("fo") )
186
.add( Expression.isNotNull("fo.fum") )
187
.add( Expression.like("fr.fum", "g%") )
188
.add( Expression.eqProperty("fr.id.short", "id.short") )
190
assertTrue( list.size()==1 && list.get(0)==fum );
195
txn = s.beginTransaction();
196
base = s.createCriteria(Fum.class)
197
.add( Expression.like("fum", "f%") );
198
base.createCriteria("fo")
199
.add( Expression.isNotNull("fum") );
200
base.createCriteria("friends")
201
.add( Expression.like("fum", "g%") );
202
fum = (Fum) base.list().get(0);
203
assertTrue( fum.getFriends().size()==2 );
205
s.delete( fum.getFo() );
206
Iterator iter = fum.getFriends().iterator();
207
while ( iter.hasNext() ) s.delete( iter.next() );
212
static public class ABean {
218
public void setFo(Fum fo) {
221
public Fum getFum() {
224
public void setFum(Fum fum) {
229
public void testBeanResultTransformer() throws HibernateException, SQLException {
231
Session s = openSession();
232
Transaction transaction = s.beginTransaction();
233
Fum fum = new Fum( fumKey("fum") );
234
fum.setFo( new Fum( fumKey("fo") ) );
235
fum.setFum("fo fee fi");
236
fum.getFo().setFum("stuff");
237
Fum fr = new Fum( fumKey("fr") );
239
Fum fr2 = new Fum( fumKey("fr2") );
241
fum.setFriends( new HashSet() );
242
fum.getFriends().add(fr);
243
fum.getFriends().add(fr2);
246
s.save( fum.getFo() );
249
Criteria test = s.createCriteria(Fum.class, "xam")
250
.createCriteria("fo", "fo")
251
.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
253
Map fc = (Map) test.list().get(0);
254
assertNotNull(fc.get("xam"));
256
Criteria base = s.createCriteria(Fum.class, "fum")
257
.add( Expression.like("fum", "f%") )
258
.setResultTransformer(Transformers.aliasToBean(ABean.class))
259
.setFetchMode("friends", FetchMode.JOIN);
260
base.createCriteria("fo", "fo")
261
.add( Expression.eq( "fum", fum.getFo().getFum() ) );
262
ABean map = (ABean) base.list().get(0);
266
map.getFo()==fum.getFo() );
271
s.delete(fum.getFo());
273
transaction.commit();
279
public void testListIdentifiers() throws Exception {
280
Session s = openSession();
281
Transaction txn = s.beginTransaction();
282
Fum fum = new Fum( fumKey("fum") );
283
fum.setFum("fo fee fi");
285
fum = new Fum( fumKey("fi") );
286
fum.setFum("fee fi fo");
288
List list = s.find("select fum.id from Fum as fum where not fum.fum='FRIEND'");
289
assertTrue( "list identifiers", list.size()==2);
290
Iterator iter = s.iterate("select fum.id from Fum fum where not fum.fum='FRIEND'");
292
while ( iter.hasNext() ) {
293
assertTrue( "iterate identifiers", iter.next() instanceof FumCompositeID);
298
s.delete( s.load(Fum.class, (Serializable) list.get(0) ) );
299
s.delete( s.load(Fum.class, (Serializable) list.get(1) ) );
305
public FumCompositeID fumKey(String str) {
307
return fumKey(str,false);
310
private FumCompositeID fumKey(String str, boolean aCompositeQueryTest) {
311
FumCompositeID id = new FumCompositeID();
312
if ( Dialect.getDialect() instanceof MckoiDialect ) {
313
GregorianCalendar now = new GregorianCalendar();
314
GregorianCalendar cal = new GregorianCalendar(
315
now.get(java.util.Calendar.YEAR),
316
now.get(java.util.Calendar.MONTH),
317
now.get(java.util.Calendar.DATE)
319
id.setDate( cal.getTime() );
322
id.setDate( new Date() );
324
id.setString( new String(str) );
326
if (aCompositeQueryTest) {
327
id.setShort( fumKeyShort++ );
330
id.setShort( (short) 12 );
336
public void testCompositeID() throws Exception {
337
Session s = openSession();
338
Transaction txn = s.beginTransaction();
339
Fum fum = new Fum( fumKey("fum") );
340
fum.setFum("fee fi fo");
342
assertTrue( "load by composite key", fum==s.load( Fum.class, fumKey("fum") ) );
347
txn = s.beginTransaction();
348
fum = (Fum) s.load( Fum.class, fumKey("fum"), LockMode.UPGRADE );
349
assertTrue( "load by composite key", fum!=null );
351
Fum fum2 = new Fum( fumKey("fi") );
352
fum2.setFum("fee fo fi");
356
"find composite keyed objects",
357
s.find("from Fum fum where not fum.fum='FRIEND'").size()==2
360
"find composite keyed object",
361
s.find("select fum from Fum fum where fum.fum='fee fi fo'").get(0)==fum
368
txn = s.beginTransaction();
369
Iterator iter = s.iterate("from Fum fum where not fum.fum='FRIEND'");
371
while ( iter.hasNext() ) {
372
fum = (Fum) iter.next();
377
assertTrue( "iterate on composite key", i==2 );
382
public void testCompositeIDOneToOne() throws Exception {
383
Session s = openSession();
384
Transaction txn = s.beginTransaction();
385
Fum fum = new Fum( fumKey("fum") );
386
fum.setFum("fee fi fo");
388
Fumm fumm = new Fumm();
395
txn = s.beginTransaction();
396
fumm = (Fumm) s.load( Fumm.class, fumKey("fum") );
397
//s.delete( fumm.getFum() );
403
public void testCompositeIDQuery() throws Exception {
404
Session s = openSession();
405
Fum fee = new Fum( fumKey("fee",true) );
408
Fum fi = new Fum( fumKey("fi",true) );
410
short fiShort = fi.getId().getShort();
412
Fum fo = new Fum( fumKey("fo",true) );
415
Fum fum = new Fum( fumKey("fum",true) );
419
s.connection().commit();
423
// Try to find the Fum object "fo" that we inserted searching by the string in the id
424
List vList = s.find("from Fum fum where fum.id.string='fo'" );
425
assertTrue( "find by composite key query (find fo object)", vList.size() == 1 );
426
fum = (Fum)vList.get(0);
427
assertTrue( "find by composite key query (check fo object)", fum.getId().getString().equals("fo") );
429
// Try to find the Fum object "fi" that we inserted searching by the date in the id
430
vList = s.find("from Fum fum where fum.id.short = ?",new Short(fiShort),Hibernate.SHORT);
431
assertTrue( "find by composite key query (find fi object)", vList.size() == 1 );
432
fi = (Fum)vList.get(0);
433
assertTrue( "find by composite key query (check fi object)", fi.getId().getString().equals("fi") );
435
// Make sure we can return all of the objects by searching by the date id
437
"find by composite key query with arguments",
438
s.find("from Fum fum where fum.id.date <= ? and not fum.fum='FRIEND'",new Date(),Hibernate.DATE).size()==4
441
s.connection().commit();
446
s.iterate("select fum.id.short, fum.id.date, fum.id.string from Fum fum").hasNext()
449
s.iterate("select fum.id from Fum fum").hasNext()
451
Query qu = s.createQuery("select fum.fum, fum , fum.fum, fum.id.date from Fum fum");
452
Type[] types = qu.getReturnTypes();
453
assertTrue(types.length==4);
454
for ( int k=0; k<types.length; k++) {
455
assertTrue( types[k]!=null );
457
assertTrue(types[0] instanceof StringType);
458
assertTrue(types[1] instanceof EntityType);
459
assertTrue(types[2] instanceof StringType);
460
assertTrue(types[3] instanceof DateType);
461
Iterator iter = qu.iterate();
463
while ( iter.hasNext() ) {
465
assertTrue( ( (Object[]) iter.next() )[1] instanceof Fum );
467
assertTrue( "iterate on composite key", j==8 );
469
fum = (Fum) s.load( Fum.class, fum.getId() );
470
s.filter( fum.getQuxArray(), "where this.foo is null" );
471
s.filter( fum.getQuxArray(), "where this.foo.id = ?", "fooid", Hibernate.STRING );
472
Query f = s.createFilter( fum.getQuxArray(), "where this.foo.id = :fooId" );
473
f.setString("fooId", "abc");
474
assertFalse( f.iterate().hasNext() );
476
iter = s.iterate("from Fum fum where not fum.fum='FRIEND'");
478
while ( iter.hasNext() ) {
479
fum = (Fum) iter.next();
484
assertTrue( "iterate on composite key", i==4 );
487
s.iterate("from Fum fu, Fum fo where fu.fo.id.string = fo.id.string and fo.fum is not null");
489
s.find("from Fumm f1 inner join f1.fum f2");
491
s.connection().commit();
496
public void testCompositeIDCollections() throws Exception {
497
Session s = openSession();
498
Fum fum1 = new Fum( fumKey("fum1") );
499
Fum fum2 = new Fum( fumKey("fum2") );
500
fum1.setFum("fee fo fi");
501
fum2.setFum("fee fo fi");
506
Set set = new HashSet();
507
List list = new ArrayList();
508
set.add(fum1); set.add(fum2);
512
fum1.setQuxArray( new Qux[] {q} );
514
s.connection().commit();
518
q = (Qux) s.load( Qux.class, q.getKey() );
519
assertTrue( "collection of fums", q.getFums().size()==2 );
520
assertTrue( "collection of fums", q.getMoreFums().size()==1 );
521
assertTrue( "unkeyed composite id collection", ( (Fum) q.getMoreFums().get(0) ).getQuxArray()[0]==q );
522
Iterator iter = q.getFums().iterator();
524
Fum f = (Fum) iter.next();
527
f = (Fum) iter.next();
531
s.connection().commit();
536
public void testDeleteOwner() throws Exception {
537
Session s = openSession();
540
Fum f1 = new Fum( fumKey("f1") );
541
Fum f2 = new Fum( fumKey("f2") );
542
Set set = new HashSet();
545
List list = new LinkedList();
555
s.connection().commit();
559
q = (Qux) s.load( Qux.class, q.getKey(), LockMode.UPGRADE );
560
s.lock( q, LockMode.UPGRADE );
563
s.connection().commit();
567
list = s.find("from Fum fum where not fum.fum='FRIEND'");
568
assertTrue( "deleted owner", list.size()==2 );
569
s.lock( list.get(0), LockMode.UPGRADE );
570
s.lock( list.get(1), LockMode.UPGRADE );
571
Iterator iter = list.iterator();
572
while ( iter.hasNext() ) {
573
s.delete( iter.next() );
576
s.connection().commit();
581
public void testCompositeIDs() throws Exception {
582
Session s = openSession();
584
Properties props = new Properties();
585
props.setProperty("foo", "bar");
586
props.setProperty("bar", "foo");
588
fo.setBuf( "abcdefghij1`23%$*^*$*\n\t".getBytes() );
589
s.save( fo, fumKey("an instance of fo") );
591
props.setProperty("x", "y");
593
s.connection().commit();
597
fo = (Fo) s.load( Fo.class, fumKey("an instance of fo") );
598
props = (Properties) fo.getSerial();
599
assertTrue( props.getProperty("foo").equals("bar") );
600
//assertTrue( props.contains("x") );
601
assertTrue( props.getProperty("x").equals("y") );
602
assertTrue( fo.getBuf()[0]=='a' );
603
fo.getBuf()[1]=(byte)126;
605
s.connection().commit();
609
fo = (Fo) s.load( Fo.class, fumKey("an instance of fo") );
610
assertTrue( fo.getBuf()[1]==126 );
612
s.iterate("from Fo fo where fo.id.string like 'an instance of fo'").next()==fo
617
s.save( Fo.newFo() );
620
catch (Exception e) {
621
//System.out.println( e.getMessage() );
623
s.connection().commit();
627
public void testKeyManyToOne() throws Exception {
628
Session s = openSession();
629
Inner sup = new Inner();
630
InnerKey sid = new InnerKey();
635
Middle m = new Middle();
636
MiddleKey mid = new MiddleKey();
642
Outer d = new Outer();
643
OuterKey did = new OuterKey();
645
did.setDetailId("detail");
652
s.connection().commit();
656
Inner in = (Inner) s.find("from Inner").get(0);
657
assertTrue( in.getMiddles().size()==1 );
659
s.connection().commit();
662
assertTrue( s.find("from Inner _inner join _inner.middles middle").size()==1 );
664
s.connection().commit();
668
d = (Outer) s.load(Outer.class, did);
669
assertTrue( d.getId().getMaster().getId().getSup().getDudu().equals("dudu") );
671
s.delete( d.getId().getMaster() );
672
s.save( d.getId().getMaster() );
675
s.connection().commit();
679
d = (Outer) s.find("from Outer o where o.id.detailId = ?", d.getId().getDetailId(), Hibernate.STRING ).get(0);
680
s.find("from Outer o where o.id.master.id.sup.dudu is not null");
681
s.find("from Outer o where o.id.master.id.sup.id.akey is not null");
682
s.find("from Inner i where i.backOut.id.master.id.sup.id.akey = i.id.bkey");
683
List l = s.find("select o.id.master.id.sup.dudu from Outer o where o.id.master.id.sup.dudu is not null");
684
assertTrue(l.size()==1);
685
l = s.find("select o.id.master.id.sup.id.akey from Outer o where o.id.master.id.sup.id.akey is not null");
686
assertTrue(l.size()==1);
687
s.find("select i.backOut.id.master.id.sup.id.akey from Inner i where i.backOut.id.master.id.sup.id.akey = i.id.bkey");
688
s.find("from Outer o where o.id.master.bla = ''");
689
s.find("from Outer o where o.id.master.id.one = ''");
690
s.find("from Inner inn where inn.id.bkey is not null and inn.backOut.id.master.id.sup.id.akey > 'a'");
691
s.find("from Outer as o left join o.id.master m left join m.id.sup where o.bubu is not null");
692
s.find("from Outer as o left join o.id.master.id.sup s where o.bubu is not null");
693
s.find("from Outer as o left join o.id.master m left join o.id.master.id.sup s where o.bubu is not null");
695
s.delete( d.getId().getMaster() );
696
s.delete( d.getId().getMaster().getId().getSup() );
698
s.connection().commit();
702
public void testCompositeKeyPathExpressions() throws Exception {
703
Session s = openSession();
704
s.find("select fum1.fo from Fum fum1 where fum1.fo.fum is not null");
705
s.find("from Fum fum1 where fum1.fo.fum is not null order by fum1.fo.fum");
706
if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof PointbaseDialect) ) {
707
s.find("from Fum fum1 where exists elements(fum1.friends)");
708
if(!(getDialect() instanceof TimesTenDialect)) { // can't execute because TimesTen can't do subqueries combined with aggreations
709
s.find("from Fum fum1 where size(fum1.friends) = 0");
712
s.find("select elements(fum1.friends) from Fum fum1");
713
s.find("from Fum fum1, fr in elements( fum1.friends )");
714
s.connection().commit();
718
public void testUnflushedSessionSerialization() throws Exception {
720
///////////////////////////////////////////////////////////////////////////
721
// Test insertions across serializations
722
Session s = getSessions().openSession();
723
s.setFlushMode(FlushMode.NEVER);
725
Simple simple = new Simple();
726
simple.setAddress("123 Main St. Anytown USA");
728
simple.setDate( new Date() );
729
simple.setName("My UnflushedSessionSerialization Simple");
730
simple.setPay( new Float(5000) );
731
s.save( simple, new Long(10) );
733
// Now, try to serialize session without flushing...
735
Session s2 = spoofSerialization(s);
740
simple = (Simple) s.load( Simple.class, new Long(10) );
741
Simple other = new Simple();
743
s.save( other, new Long(11) );
745
simple.setOther(other);
748
s.connection().commit();
750
Simple check = simple;
752
///////////////////////////////////////////////////////////////////////////
753
// Test updates across serializations
754
s = getSessions().openSession();
755
s.setFlushMode(FlushMode.NEVER);
757
simple = (Simple) s.get( Simple.class, new Long(10) );
758
assertTrue("Not same parent instances", check.getName().equals( simple.getName() ) );
759
assertTrue("Not same child instances", check.getOther().getName().equals( other.getName() ) );
761
simple.setName("My updated name");
764
s2 = spoofSerialization(s);
770
s.connection().commit();
774
///////////////////////////////////////////////////////////////////////////
775
// Test deletions across serializations
776
s = getSessions().openSession();
777
s.setFlushMode(FlushMode.NEVER);
779
simple = (Simple) s.get( Simple.class, new Long(10) );
780
assertTrue("Not same parent instances", check.getName().equals( simple.getName() ) );
781
assertTrue("Not same child instances", check.getOther().getName().equals( other.getName() ) );
783
// Now, lets delete across serialization...
787
s2 = spoofSerialization(s);
793
s.connection().commit();
796
///////////////////////////////////////////////////////////////////////////
797
// Test collection actions across serializations
798
s = getSessions().openSession();
799
s.setFlushMode(FlushMode.NEVER);
801
Fum fum = new Fum( fumKey("uss-fum") );
802
fum.setFo( new Fum( fumKey("uss-fo") ) );
803
fum.setFum("fo fee fi");
804
fum.getFo().setFum("stuff");
805
Fum fr = new Fum( fumKey("uss-fr") );
807
Fum fr2 = new Fum( fumKey("uss-fr2") );
809
fum.setFriends( new HashSet() );
810
fum.getFriends().add(fr);
811
fum.getFriends().add(fr2);
814
s.save( fum.getFo() );
818
s2 = spoofSerialization(s);
824
s.connection().commit();
827
s = getSessions().openSession();
828
s.setFlushMode(FlushMode.NEVER);
829
fum = (Fum) s.load( Fum.class, fum.getId() );
831
assertTrue("the Fum.friends did not get saved", fum.getFriends().size() == 2);
833
fum.setFriends(null);
835
s2 = spoofSerialization(s);
842
s.connection().commit();
845
s = getSessions().openSession();
846
s.setFlushMode(FlushMode.NEVER);
847
fum = (Fum) s.load( Fum.class, fum.getId() );
848
assertTrue("the Fum.friends is not empty", fum.getFriends() == null || fum.getFriends().size() == 0);
849
s.connection().commit();
853
private Session spoofSerialization(Session session) throws IOException {
855
// Serialize the incoming out to memory
856
ByteArrayOutputStream serBaOut = new ByteArrayOutputStream();
857
ObjectOutputStream serOut = new ObjectOutputStream(serBaOut);
859
serOut.writeObject(session);
861
// Now, re-constitute the model from memory
862
ByteArrayInputStream serBaIn =
863
new ByteArrayInputStream(serBaOut.toByteArray());
864
ObjectInputStream serIn = new ObjectInputStream(serBaIn);
866
Session outgoing = (Session) serIn.readObject();
870
catch (ClassNotFoundException cnfe) {
871
throw new IOException("Unable to locate class on reconstruction");