001    package com.sptci.jdo;
002    
003    import java.util.Collection;
004    
005    import javax.jdo.Extent;
006    import javax.jdo.PersistenceManagerFactory;
007    import javax.jdo.Query;
008    import javax.jdo.Transaction;
009    
010    /** A proxy around a <code>javax.jdo.PersistenceManager</code> used
011     * to ensure a <code>singleton PersistenceManager</code> instance for
012     * the entire application.
013     *
014     * @see PersistenceManagerFactory#getPersistenceManager
015     * @author Rakesh Vidyadharan 05<sup><small>th</small></sup> February, 2006
016     * <p>Copyright 2006, Sans Pareil Technologies, Inc.</p>
017     *
018     * @version $Id: PersistenceManager.java,v 1.1 2006/02/06 19:55:28 rakesh Exp $
019     */
020    public class PersistenceManager implements javax.jdo.PersistenceManager 
021    {
022      /**
023       * The <code>PersistenceManager</code> instance that is decorated.
024       */
025      private javax.jdo.PersistenceManager persistenceManager;
026    
027      /**
028       * Create a new instance of the decorator using the specified
029       * <code>PersistenceManager</code>
030       *
031       * @param pm The object to decorate.
032       */
033      protected PersistenceManager( javax.jdo.PersistenceManager pm )
034      {
035        this.persistenceManager = pm;
036        setMultithreaded( true );
037      }
038    
039      /** 
040       * A <code>PersistenceManager</code> instance can be used until it 
041       * is closed.  
042       *
043       * @see #close()
044       * @return <code>true</code> if this <code>PersistenceManager</code> 
045       *   has been closed.
046       */
047      public boolean isClosed()
048      {
049        return persistenceManager.isClosed();
050      }
051        
052      /** 
053       * Close this <code>PersistenceManager</code> so that no further 
054       * requests may be made on it.  A <code>PersistenceManager</code> 
055       * instance can be used only until it is closed.
056       *
057       * <p>Closing a <code>PersistenceManager</code> might release it 
058       * to the pool of available <code>PersistenceManager</code>s, or 
059       * might be garbage collected, at the option of the JDO 
060       * implementation.  Before being used again to satisfy a 
061       * <code>getPersistenceManager()</code> request, the default values 
062       * for options will be restored to their values as specified in the 
063       * <code>PersistenceManagerFactory</code>.</p>
064       *
065       * <p>This method closes the <code>PersistenceManager</code>.</p>
066       *
067       * <p><b>Note:</b> Over-ridden to never close the decorated
068       * <code>PersistenceManager</code>.  To close the persistence manager 
069       * execute {@link #getPersistenceManager}.close()</p>
070       */
071      public void close() {}
072    
073      /** 
074       * Return the <code>Transaction</code> instance associated with a 
075       * <code>PersistenceManager</code>.  There is one 
076       * <code>Transaction</code> instance associated with each 
077       * <code>PersistenceManager</code> instance.  The 
078       * <code>Transaction</code> instance supports options as well as 
079       * transaction completion requests.
080       *
081       * @return the <code>Transaction</code> associated with this 
082       *   <code>PersistenceManager</code>.
083       */
084      public Transaction currentTransaction()
085      {
086        return persistenceManager.currentTransaction();
087      }
088    
089      /** 
090       * Mark an instance as no longer needed in the cache.  Eviction is 
091       * normally done automatically by the <code>PersistenceManager</code>
092       * at transaction completion.  This method allows the application to
093       * explicitly provide a hint to the <code>PersistenceManager</code> 
094       * that the instance is no longer needed in the cache.
095       *
096       * @param pc the instance to evict from the cache.
097       */
098      public void evict( Object pc )
099      {
100        persistenceManager.evict( pc );
101      }
102      
103      /** 
104       * Mark an array of instances as no longer needed in the cache.
105       *
106       * @see #evict(Object)
107       * @param pcs the array of instances to evict from the cache.
108       */
109      public void evictAll( Object[] pcs )
110      {
111        persistenceManager.evictAll( pcs );
112      }
113      
114      /** 
115       * Mark a <code>Collection</code> of instances as no longer needed in 
116       * the cache.
117       *
118       * @see #evict(Object)
119       * @param pcs the <code>Collection</code> of instances to evict from 
120       *   the cache.
121       */
122      public void evictAll( Collection pcs )
123      {
124        persistenceManager.evictAll( pcs );
125      }
126      
127      /** 
128       * Mark all persistent-nontransactional instances as no longer needed 
129       * in the cache.  It transitions all persistent-nontransactional 
130       * instances to hollow.  Transactional instances are subject to 
131       * eviction based on the RetainValues setting.
132       *
133       * @see #evict(Object)
134       */
135      public void evictAll()
136      {
137        persistenceManager.evictAll();
138      }
139      
140      /** 
141       * Refresh the state of the instance from the data store.
142       *
143       * <p>In an optimistic transaction, the state of instances in the 
144       * cache might not match the state in the data store.  This method 
145       * is used to reload the state of the instance from the data store 
146       * so that a subsequent commit is more likely to succeed.</p>
147       *
148       * <p>Outside a transaction, this method will refresh 
149       * nontransactional state.</p>
150       *
151       * @param pc the instance to refresh.
152       */
153      public void refresh( Object pc )
154      {
155        persistenceManager.refresh( pc );
156      }
157      
158      /** 
159       * Refresh the state of an array of instances from the data store.
160       *
161       * @see #refresh(Object)
162       * @param pcs the array of instances to refresh.
163       */
164      public void refreshAll( Object[] pcs )
165      {
166        persistenceManager.refreshAll( pcs );
167      }
168      
169      /** 
170       * Refresh the state of a <code>Collection</code> of instances from 
171       * the data store.
172       *
173       * @see #refresh(Object)
174       * @param pcs the <code>Collection</code> of instances to refresh.
175       */
176      public void refreshAll( Collection pcs )
177      {
178        persistenceManager.refreshAll( pcs );
179      }
180      
181      /** 
182       * Refresh the state of all applicable instances from the data store.
183       *
184       * <p>If called with an active transaction, all transactional 
185       * instances will be refreshed.  If called outside an active 
186       * transaction, all nontransactional instances will be refreshed.</p>
187       *
188       * @see #refresh(Object)
189       */
190      public void refreshAll()
191      {
192        persistenceManager.refreshAll();
193      }
194      
195      /** 
196       * Create a new <code>Query</code> with no elements.
197       *
198       * @return the new <code>Query</code>.
199       */
200      public Query newQuery()
201      {
202        return persistenceManager.newQuery();
203      }
204      
205      /** 
206       * Create a new <code>Query</code> using elements from another 
207       * <code>Query</code>.  The other <code>Query</code> must have been 
208       * created by the same JDO implementation.  It might be active
209       * in a different <code>PersistenceManager</code> or might have been 
210       * serialized and restored.
211       *
212       * <p>All of the settings of the other <code>Query</code> are copied 
213       * to this <code>Query</code>, except for the candidate 
214       * <code>Collection</code> or <code>Extent</code>.</p>
215       *
216       * @return the new <code>Query</code>
217       * @param compiled Another <code>Query</code> from the same JDO 
218       *   implementation
219       */
220      public Query newQuery( Object compiled )
221      {
222        return persistenceManager.newQuery( compiled );
223      }
224      
225      /** 
226       * Create a new <code>Query</code> using the specified language.
227       *
228       * @param language the language of the query parameter
229       * @param query the query, which is of a form determined by the 
230       *   language
231       * @return the new <code>Query</code>
232       */    
233      public Query newQuery( String language, Object query )
234      {
235        return persistenceManager.newQuery( language, query );
236      }
237      
238      /** 
239       * Create a new <code>Query</code> specifying the <code>Class</code> 
240       * of the candidate instances.
241       *
242       * @param cls the <code>Class</code> of the candidate instances
243       * @return the new <code>Query</code>
244       */
245      public Query newQuery( Class cls )
246      {
247        return persistenceManager.newQuery( cls );
248      }
249      
250      /** 
251       * Create a new <code>Query</code> with the <code>Class</code> of the
252       * candidate instances and candidate <code>Extent</code>.
253       *
254       * @param cln the <code>Extent</code> of candidate instances
255       * @return the new <code>Query</code>
256       */
257      public Query newQuery( Extent cln )
258      {
259        return persistenceManager.newQuery( cln );
260      }
261      
262      /** 
263       * Create a new <code>Query</code> with the candidate 
264       * <code>Class</code> and <code>Collection</code>.
265       *
266       * @param cls the <code>Class</code> of results
267       * @param cln the <code>Collection</code> of candidate instances
268       * @return the new <code>Query</code>
269       */
270      public Query newQuery( Class cls, Collection cln )
271      {
272        return persistenceManager.newQuery( cls, cln );
273      }
274      
275      /** 
276       * Create a new <code>Query</code> with the <code>Class</code> of the
277       * candidate instances and filter.
278       *
279       * @param cls the <code>Class</code> of results
280       * @param filter the filter for candidate instances
281       * @return the new <code>Query</code>
282       */
283      public Query newQuery( Class cls, String filter )
284      {
285        return persistenceManager.newQuery( cls, filter );
286      }
287      
288      /** 
289       * Create a new <code>Query</code> with the <code>Class</code> of the 
290       * candidate instances, candidate <code>Collection</code>, and filter.
291       *
292       * @param cls the <code>Class</code> of candidate instances
293       * @param cln the <code>Collection</code> of candidate instances
294       * @param filter the filter for candidate instances
295       * @return the new <code>Query</code>
296       */
297      public Query newQuery( Class cls, Collection cln, String filter )
298      {
299        return persistenceManager.newQuery( cls, cln, filter );
300      }
301      
302      /** 
303       * Create a new <code>Query</code> with the candidate 
304       * <code>Extent</code> and filter; the class is taken from the 
305       * <code>Extent</code>.
306       *
307       * @param cln the <code>Extent</code> of candidate instances
308       * @param filter the filter for candidate instances
309       * @return the new <code>Query</code>
310       */
311      public Query newQuery( Extent cln, String filter )
312      {
313        return persistenceManager.newQuery( cln, filter );
314      }
315      
316      /** 
317       * The <code>PersistenceManager</code> manages a collection of 
318       * instances in the data store based on the class of the instances.  
319       * This method returns an <code>Extent</code> of instances in the 
320       * data store that might be iterated or given to a <code>Query</code>.
321       * The <code>Extent</code> itself might not reference any instances, 
322       * but only hold the class name and an indicator as to whether 
323       * subclasses are included in the <code>Extent</code>.
324       *
325       * <p>Note that the <code>Extent</code> might be very large.</p>
326       *
327       * @param persistenceCapableClass <code>Class</code> of instances
328       * @param subclasses whether to include instances of subclasses
329       * @return an <code>Extent</code> of the specified <code>Class</code>
330       */
331      public Extent getExtent( Class persistenceCapableClass, 
332          boolean subclasses)
333      {
334        return persistenceManager.getExtent( persistenceCapableClass, subclasses );
335      }
336    
337      /** 
338       * This method locates a persistent instance in the cache of instances
339       * managed by this <code>PersistenceManager</code>.
340       * The <code>getObjectById</code> method attempts 
341       * to find an instance in the cache with the specified JDO identity. 
342       * The <code>oid</code> parameter object might have been returned by 
343       * an earlier call to <code>getObjectId</code> or 
344       * <code>getTransactionalObjectId</code>, or might have been 
345       * constructed by the application. 
346       *
347       * <p>If the <code>PersistenceManager</code> is unable to resolve the 
348       * <code>oid</code> parameter to an ObjectId instance, then it throws 
349       * a <code>JDOUserException</code>.</p>
350       *
351       * <p>If the <code>validate</code> flag is <code>false</code>, and 
352       * there is already an instance in the cache with the same JDO 
353       * identity as the <code>oid</code> parameter, then this method
354       * returns it. There is no change made to the state of the returned
355       * instance.</p>
356       *
357       * <p>If there is not an instance already in the cache with the same 
358       * JDO identity as the <code>oid</code> parameter, then this method 
359       * creates an instance with the specified JDO identity and returns it.
360       * If there is no transaction in progress, the returned instance will 
361       * be hollow or persistent-nontransactional, at the choice of the 
362       * implementation.</p>
363       *
364       * <p>If there is a transaction in progress, the returned instance 
365       * will be hollow, persistent-nontransactional, or persistent-clean, 
366       * at the choice of the implementation.</p>
367       *
368       * <p>It is an implementation decision whether to access the data 
369       * store, if required to determine the exact class. This will be the 
370       * case of inheritance, where multiple <code>PersistenceCapable</code>
371       * classes share the same ObjectId class.</p>
372       *
373       * <p>If the validate flag is <code>false</code>, and the instance 
374       * does not exist in the data store, then this method might not fail. 
375       * It is an implementation choice whether to fail immediately with a
376       * <code>JDODataStoreException</code>. But a subsequent access of the 
377       * fields of the instance will throw a 
378       * <code>JDODataStoreException</code> if the instance does not exist 
379       * at that time. Further, if a relationship is established to this
380       * instance, then the transaction in which the association was made 
381       * will fail.</p>
382       *
383       * <p>If the <code>validate</code> flag is <code>true</code>, and 
384       * there is already a transactional instance in the cache with the 
385       * same JDO identity as the <code>oid</code> parameter, then this 
386       * method returns it. There is no change made to the state of
387       * the returned instance.</p>
388       *
389       * <p>If there is an instance already in the cache with the same JDO
390       * identity as the <code>oid</code> parameter, but the instance is 
391       * not transactional, then it must be verified in the data store. If 
392       * the instance does not exist in the datastore, then a 
393       * <code>JDODataStoreException</code> is thrown.</p>
394       *
395       * <p>If there is not an instance already in the cache with the same 
396       * JDO identity as the <code>oid</code> parameter, then this method 
397       * creates an instance with the specified JDO identity, verifies that 
398       * it exists in the data store, and returns it. If there is no 
399       * transaction in progress, the returned instance will be hollow or 
400       * persistent-nontransactional, at the choice of the implementation.</p>
401       *
402       * <p>If there is a data store transaction in progress, the returned
403       * instance will be persistent-clean.  If there is an optimistic 
404       * transaction in progress, the returned instance will be 
405       * persistent-nontransactional.</p>
406       *
407       * @see #getObjectId(Object pc)
408       * @see #getTransactionalObjectId(Object pc)
409       * @return the <code>PersistenceCapable</code> instance with the 
410         *   specified ObjectId
411       * @param oid an ObjectId
412       * @param validate if the existence of the instance is to be validated
413       */
414      public Object getObjectById( Object oid, boolean validate )
415      {
416        return persistenceManager.getObjectById( oid, validate );
417      }
418      
419      /** 
420       * The ObjectId returned by this method represents the JDO identity of
421       * the instance.  The ObjectId is a copy (clone) of the internal state
422       * of the instance, and changing it does not affect the JDO identity 
423       * of the instance.  
424       *
425       * <p>The <code>getObjectId</code> method returns an ObjectId 
426       * instance that represents the object identity of the specified JDO 
427       * instance. The identity is guaranteed to be unique only in the 
428       * context of the JDO <code>PersistenceManager</code> that created 
429       * the identity, and only for two types of JDO Identity: those that 
430       * are managed by the application, and those that are managed by the 
431       * data store.</p>
432       *
433       * <p>If the object identity is being changed in the transaction, by 
434       * the application modifying one or more of the application key 
435       * fields, then this method returns the identity as of the beginning 
436       * of the transaction. The value returned by <code>getObjectId</code> 
437       * will be different following <code>afterCompletion</code> processing
438       * for successful transactions.</p>
439       *
440       * <p>Within a transaction, the ObjectId returned will compare equal 
441       * to the ObjectId returned by only one among all JDO instances 
442       * associated with the <code>PersistenceManager</code> regardless of 
443       * the type of ObjectId.</p>
444       *
445       * <p>The ObjectId does not necessarily contain any internal state 
446       * of the instance, nor is it necessarily an instance of the class 
447       * used to manage identity internally. Therefore, if the application 
448       * makes a change to the ObjectId instance returned by this method, 
449       * there is no effect on the instance from which the ObjectId was 
450       * obtained.</p>
451       *
452       * <p>The <code>getObjectById</code> method can be used between 
453       * instances of <code>PersistenceManager</code> of different JDO 
454       * vendors only for instances of persistence capable classes using 
455       * application-managed (primary key) JDO identity. If it is used for 
456       * instances of classes using datastore identity, the method might 
457       * succeed, but there are no guarantees that the parameter and 
458       * return instances are related in any way.</p>
459       *
460       * @see #getTransactionalObjectId(Object pc)
461       * @see #getObjectById(Object oid, boolean validate)
462       * @param pc the <code>PersistenceCapable</code> instance
463       * @return the ObjectId of the instance
464       */
465      public Object getObjectId( Object pc )
466      {
467        return persistenceManager.getObjectId( pc );
468      }
469      
470      /** 
471       * The ObjectId returned by this method represents the JDO identity of
472       * the instance.  The ObjectId is a copy (clone) of the internal state
473       * of the instance, and changing it does not affect the JDO identity 
474       * of the instance.
475       *
476       * <p>If the object identity is being changed in the transaction, by 
477       * the application modifying one or more of the application key 
478       * fields, then this method returns the current identity in the 
479       * transaction.</p>
480       *
481       * <p>If there is no transaction in progress, or if none of the key 
482       * fields is being modified, then this method will return the same 
483       * value as {@link #getObjectId}.</p>
484       *
485       * @see #getObjectId(Object pc)
486       * @see #getObjectById(Object oid, boolean validate)
487       * @param pc a <code>PersistenceCapable</code> instance
488       * @return the ObjectId of the instance
489       */
490      public Object getTransactionalObjectId( Object pc )
491      {
492        return persistenceManager.getTransactionalObjectId( pc );
493      }
494    
495      /** 
496       * This method returns an object id instance corresponding to the 
497       * <code>Class</code> and <code>String</code> arguments. The 
498       * <code>String</code> argument might have been the result of 
499       * executing <code>toString</code> on an object id instance. 
500       *
501       * @param pcClass the <code>Class</code> of the persistence-capable 
502       *   instance
503       * @param str the <code>String</code> form of the object id
504       * @return an instance of the object identity class
505       */
506      public Object newObjectIdInstance( Class pcClass, String str )
507      {
508        return persistenceManager.newObjectIdInstance( pcClass, str );
509      }
510      
511      /** 
512       * Make the transient instance persistent in this 
513       * <code>PersistenceManager</code>.  This method must be called in 
514       * an active transaction. The <code>PersistenceManager</code> assigns 
515       * an ObjectId to the instance and transitions it to persistent-new.
516       * The instance will be managed in the <code>Extent</code> associated 
517       * with its <code>Class</code>.  The instance will be put into the 
518       * data store at commit.  The closure of instances of 
519       * <code>PersistenceCapable</code> classes reachable from persistent
520       * fields will be made persistent at commit.  [This is known as 
521       * persistence by reachability.]
522       *
523       * @param pc a transient instance of a <code>Class</code> that 
524       *   implements <code>PersistenceCapable</code>
525       */
526      public void makePersistent( Object pc )
527      {
528        persistenceManager.makePersistent( pc );
529      }
530      
531      /** 
532       * Make an array of instances persistent.
533       *
534       * @param pcs an array of transient instances
535       * @see #makePersistent(Object)
536       */
537      public void makePersistentAll (Object[] pcs )
538      {
539        persistenceManager.makePersistentAll( pcs );
540      }
541      
542      /** 
543       * Make a <code>Collection</code> of instances persistent.
544       *
545       * @param pcs a <code>Collection</code> of transient instances
546       * @see #makePersistent(Object)
547       */
548      public void makePersistentAll( Collection pcs )
549      {
550        persistenceManager.makePersistentAll( pcs );
551      }
552      
553      /** 
554       * Delete the persistent instance from the data store.
555       * This method must be called in an active transaction.
556       * The data store object will be removed at commit.  Unlike 
557       * <code>makePersistent</code>, which makes the closure of the 
558       * instance persistent, the closure of the instance is not deleted 
559       * from the data store.  This method has no effect if the instance is 
560       * already deleted in the current transaction.  This method throws 
561       * <code>JDOUserException</code> if the instance is transient or 
562       * is managed by another <code>PersistenceManager</code>.
563       *
564       * @param pc a persistent instance
565       */
566      public void deletePersistent( Object pc )
567      {
568        persistenceManager.deletePersistent( pc );
569      }
570      
571      /** 
572       * Delete an array of instances from the data store.
573       *
574       * @param pcs a <code>Collection</code> of persistent instances
575       * @see #deletePersistent(Object)
576       */
577      public void deletePersistentAll( Object[] pcs )
578      {
579        persistenceManager.deletePersistent( pcs );
580      }
581      
582      /** 
583       * Delete a <code>Collection</code> of instances from the data store.
584       *
585       * @param pcs a <code>Collection</code> of persistent instances
586       * @see #deletePersistent(Object)
587       */
588      public void deletePersistentAll( Collection pcs )
589      {
590        persistenceManager.deletePersistentAll( pcs );
591      }
592      
593      /** 
594       * Make an instance transient, removing it from management by this
595       * <code>PersistenceManager</code>.
596       *
597       * <p>The instance loses its JDO identity and it is no longer 
598       * associated with any <code>PersistenceManager</code>.  The state of 
599       * fields is preserved unchanged.</p>
600       *
601       * @param pc the instance to make transient.
602       */
603      public void makeTransient( Object pc )
604      {
605        persistenceManager.makeTransient( pc );
606      }
607      
608      /** 
609       * Make an array of instances transient, removing them from management
610       * by this <code>PersistenceManager</code>.
611       *
612       * <p>The instances lose their JDO identity and they are no longer 
613       * associated with any <code>PersistenceManager</code>.  The state of 
614       * fields is preserved unchanged.</p>
615       *
616       * @param pcs the instances to make transient.
617       */
618      public void makeTransientAll( Object[] pcs )
619      {
620        persistenceManager.makeTransientAll( pcs );
621      }
622      
623      /** 
624       * Make a <code>Collection</code> of instances transient, removing 
625       * them from management by this <code>PersistenceManager</code>.
626       *
627       * <p>The instances lose their JDO identity and they are no longer 
628       * associated with any <code>PersistenceManager</code>.  The state of 
629       * fields is preserved unchanged.</p>
630       *
631       * @param pcs the instances to make transient.
632       */ 
633      public void makeTransientAll( Collection pcs )
634      {
635        persistenceManager.makeTransientAll( pcs );
636      }
637      
638      /** 
639       * Make an instance subject to transactional boundaries.
640       *
641       * <p>Transient instances normally do not observe transaction 
642       * boundaries. This method makes transient instances sensitive to 
643       * transaction completion. If an instance is modified in a 
644       * transaction, and the transaction rolls back,
645       * the state of the instance is restored to the state before the 
646       * first change in the transaction.</p>
647       *
648       * <p>For persistent instances read in optimistic transactions, this 
649       * method allows the application to make the state of the instance 
650       * part of the transactional state.  At transaction commit, the state 
651       * of the instance in the cache is compared to the state of the 
652       * instance in the data store.  If they are not the same, then an 
653       * exception is thrown.</p>
654       *
655       * @param pc the instance to make transactional.
656       */
657      public void makeTransactional( Object pc )
658      {
659        persistenceManager.makeTransactional( pc );
660      }
661    
662      /** 
663       * Make an array of instances subject to transactional boundaries.
664       *
665       * @param pcs the array of instances to make transactional.
666       * @see #makeTransactional(Object)
667       */
668      public void makeTransactionalAll( Object[] pcs )
669      {
670        persistenceManager.makeTransactionalAll( pcs );
671      }
672    
673      /** 
674       * Make a <code>Collection</code> of instances subject to 
675       * transactional boundaries.
676       *
677       * @param pcs the <code>Collection</code> of instances to make 
678       *   transactional.
679       * @see #makeTransactional(Object)
680       */
681      public void makeTransactionalAll( Collection pcs )
682      {
683        persistenceManager.makeTransactionalAll( pcs );
684      }
685      
686      /** 
687       * Make an instance non-transactional after commit.
688       *
689       * <p>Normally, at transaction completion, instances are evicted 
690       * from the cache.  This method allows an application to identify an 
691       * instance as not being evicted from the cache at transaction 
692       * completion.  Instead, the instance remains in the cache with 
693       * nontransactional state.</p>
694       *
695       * @param pc the instance to make nontransactional.
696       */
697      public void makeNontransactional( Object pc )
698      {
699        persistenceManager.makeNontransactional( pc );
700      }
701      
702      /** 
703       * Make an array of instances non-transactional after commit.
704       *
705       * @param pcs the array of instances to make nontransactional.
706       * @see #makeNontransactional(Object)
707       */
708      public void makeNontransactionalAll( Object[] pcs )
709      {
710        persistenceManager.makeNontransactionalAll( pcs );
711      }
712      
713      /** 
714       * Make a <code>Collection</code> of instances non-transactional 
715       * after commit.
716       *
717       * @param pcs the <code>Collection</code> of instances to make 
718       *   nontransactional.
719       * @see #makeNontransactional(Object)
720       */
721      public void makeNontransactionalAll( Collection pcs )
722      {
723        persistenceManager.makeNontransactionalAll( pcs );
724      }
725      
726      /** 
727       * Retrieve field values of an instance from the store.  This tells
728       * the <code>PersistenceManager</code> that the application intends 
729       * to use the instance, and its field values must be retrieved.
730       *
731       * <p>The <code>PersistenceManager</code> might use policy information
732       * about the class to retrieve associated instances.</p>
733       *
734       * @param pc the instance
735       */
736      public void retrieve( Object pc )
737      {
738        persistenceManager.retrieve( pc );
739      }
740      
741      /** 
742       * Retrieve field values of instances from the store.  This tells
743       * the <code>PersistenceManager</code> that the application intends 
744       * to use the instances, and all field values must be retrieved.
745       *
746       * <p>The <code>PersistenceManager</code> might use policy information
747       * about the class to retrieve associated instances.</p>
748       *
749       * @param pcs the instances
750       */
751      public void retrieveAll( Collection pcs )
752      {
753        persistenceManager.retrieveAll( pcs );
754      }
755      
756      /** 
757       * Retrieve field values of instances from the store.  This tells
758       * the <code>PersistenceManager</code> that the application intends 
759       * to use the instances, and all field values must be retrieved.
760       *
761       * <p>The <code>PersistenceManager</code> might use policy information
762       * about the class to retrieve associated instances.</p>
763       *
764       * @param pcs the instances
765       */
766      public void retrieveAll( Object[] pcs )
767      {
768        persistenceManager.retrieveAll( pcs );
769      }
770    
771      /** 
772       * The application can manage the <code>PersistenceManager</code> 
773       * instances more easily by having an application object associated 
774       * with each <code>PersistenceManager</code> instance.
775       *
776       * @param o the user instance to be remembered by the 
777       *   <code>PersistenceManager</code>
778       * @see #getUserObject
779       */
780      public void setUserObject( Object o )
781      {
782        persistenceManager.setUserObject( o );
783      }
784      
785      /** 
786       * The application can manage the <code>PersistenceManager</code> 
787       * instances more easily by having an application object associated 
788       * with each <code>PersistenceManager</code> instance.
789       *
790       * @return the user object associated with this 
791       *   <code>PersistenceManager</code>
792       * @see #setUserObject
793       */
794      public Object getUserObject()
795      {
796        return persistenceManager.getUserObject();
797      }
798       
799      /** This method returns the <code>PersistenceManagerFactory</code> 
800       * used to create this <code>PersistenceManager</code>.
801       *
802       * @return the <code>PersistenceManagerFactory</code> that created
803       *   this <code>PersistenceManager</code>
804       */
805      public PersistenceManagerFactory getPersistenceManagerFactory()
806      {
807        return persistenceManager.getPersistenceManagerFactory();
808      }
809    
810      /** 
811       * Return the <code>Class</code> that implements the JDO Identity for 
812       * the specified <code>PersistenceCapable</code> class.  The 
813       * application can use the returned <code>Class</code> to construct a 
814       * JDO Identity instance for application identity 
815       * <code>PersistenceCapable</code> classes.  This JDO Identity
816       * instance can then be used to get an instance of the
817       * <code>PersistenceCapable</code> class for use in the application.
818       *
819       * <p>In order for the application to construct an instance of the 
820       * ObjectId class it needs to know the class being used by the JDO 
821       * implementation.</p>
822       *
823       * @param cls the <code>PersistenceCapable Class</code>
824       * @return the <code>Class</code> of the ObjectId of the parameter
825       * @see #getObjectById
826       */
827      public Class getObjectIdClass( Class cls )
828      {
829        return persistenceManager.getObjectIdClass( cls );
830      }
831    
832      /** 
833       * Set the Multithreaded flag for this <code>PersistenceManager</code>.  
834       * Applications that use multiple threads to invoke methods or access 
835       * fields from instances managed by this <code>PersistenceManager</code> 
836       * must set this flag to <code>true</code>.  Instances managed by this
837       * <code>PersistenceManager</code> include persistent or
838       * transactional instances of <code>PersistenceCapable</code> classes,
839       * as well as helper instances such as <code>Query</code>, 
840       * <code>Transaction</code>, or <code>Extent</code>.
841       *
842       * @param flag the Multithreaded setting.
843       */
844      public void setMultithreaded( boolean flag )
845      {
846        persistenceManager.setMultithreaded( flag );
847      }
848    
849      /** 
850       * Get the current Multithreaded flag for this 
851       * <code>PersistenceManager</code>.  
852       *
853       * @see #setMultithreaded
854       * @return the Multithreaded setting.
855       */
856      public boolean getMultithreaded()
857      {
858        return persistenceManager.getMultithreaded();
859      }
860      
861      /** 
862       * Set the ignoreCache parameter for queries.
863       *
864       * <p>IgnoreCache set to <code>true</code> specifies that for all 
865       * <code>Query</code> instances created by this
866       * <code>PersistenceManager</code>, the default is the cache should be
867       * ignored for queries.</p>
868       *
869       * @param flag the ignoreCache setting.
870       */
871      public void setIgnoreCache( boolean flag )
872      {
873        persistenceManager.setIgnoreCache( flag );
874      }
875    
876      /** 
877       * Get the ignoreCache setting for queries.
878       *
879       * <p>IgnoreCache set to <code>true</code> specifies that for all 
880       * <code>Query</code> instances created by this
881       * <code>PersistenceManager</code>, the default is the cache should be
882       * ignored for queries.</p>
883       *
884       * @return the ignoreCache setting.
885       */
886      public boolean getIgnoreCache()
887      {
888        return persistenceManager.getIgnoreCache();
889      }
890    
891      /**
892       * Returns {@link #persistenceManager}.  This may be used to
893       * force close the <code>PersistenceManager</code> instance this
894       * class decorates.
895       *
896       * @return PersistenceManager The value/reference of/to persistenceManager.
897       */
898      public final javax.jdo.PersistenceManager getPersistenceManager()
899      {
900        return persistenceManager;
901      }
902    }