1 16 17 package org.springframework.orm.toplink; 18 19 import oracle.toplink.sessions.DatabaseSession; 20 import oracle.toplink.sessions.Session; 21 22 33 public class SingleSessionFactory implements SessionFactory { 34 35 private final Session session; 36 37 38 42 public SingleSessionFactory(Session session) { 43 this.session = session; 44 } 45 46 47 50 public Session createSession() { 51 return this.session; 52 } 53 54 58 public Session createManagedClientSession() { 59 throw new UnsupportedOperationException ("SingleSessionFactory does not support managed client Sessions"); 60 } 61 62 66 public Session createTransactionAwareSession() { 67 throw new UnsupportedOperationException ("SingleSessionFactory does not support transaction-aware Sessions"); 68 } 69 70 71 76 public void close() { 77 if (this.session instanceof DatabaseSession) { 78 ((DatabaseSession) this.session).logout(); 79 } 80 this.session.release(); 81 } 82 83 } 84 | Popular Tags |