Source Code Cross Referenced for OpenJPAEntityManager.java in  » Database-ORM » openjpa » org » apache » openjpa » persistence » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » openjpa » org.apache.openjpa.persistence 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Licensed to the Apache Software Foundation (ASF) under one
0003:         * or more contributor license agreements.  See the NOTICE file
0004:         * distributed with this work for additional information
0005:         * regarding copyright ownership.  The ASF licenses this file
0006:         * to you under the Apache License, Version 2.0 (the
0007:         * "License"); you may not use this file except in compliance
0008:         * with the License.  You may obtain a copy of the License at
0009:         *
0010:         * http://www.apache.org/licenses/LICENSE-2.0
0011:         *
0012:         * Unless required by applicable law or agreed to in writing,
0013:         * software distributed under the License is distributed on an
0014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015:         * KIND, either express or implied.  See the License for the
0016:         * specific language governing permissions and limitations
0017:         * under the License.    
0018:         */
0019:        package org.apache.openjpa.persistence;
0020:
0021:        import java.util.Collection;
0022:        import java.util.EnumSet;
0023:        import javax.persistence.EntityManager;
0024:        import javax.persistence.EntityTransaction;
0025:        import javax.persistence.LockModeType;
0026:        import javax.persistence.Query;
0027:
0028:        import org.apache.openjpa.event.CallbackModes;
0029:        import org.apache.openjpa.kernel.AutoClear;
0030:        import org.apache.openjpa.kernel.AutoDetach;
0031:        import org.apache.openjpa.kernel.ConnectionRetainModes;
0032:        import org.apache.openjpa.kernel.DetachState;
0033:        import org.apache.openjpa.kernel.RestoreState;
0034:
0035:        /**
0036:         * Interface implemented by OpenJPA entity managers.
0037:         *
0038:         * This interface extends {@link EntityTransaction}, but this extension is
0039:         * deprecated.
0040:         *
0041:         * @since 0.4.0
0042:         * @author Abe White
0043:         * @published
0044:         */
0045:        public interface OpenJPAEntityManager extends EntityManager,
0046:                EntityTransaction /* deprecated */{
0047:
0048:            /**
0049:             * Return the factory that produced this entity manager.
0050:             */
0051:            public OpenJPAEntityManagerFactory getEntityManagerFactory();
0052:
0053:            /**
0054:             * Return the (mutable) fetch plan for loading objects from this
0055:             * entity manager.
0056:             */
0057:            public FetchPlan getFetchPlan();
0058:
0059:            /**
0060:             * Return the connection retain mode for this entity manager.
0061:             */
0062:            public ConnectionRetainMode getConnectionRetainMode();
0063:
0064:            /**
0065:             * Whether this entity manager is using managed transactions.
0066:             *
0067:             * @since 1.1.0
0068:             */
0069:            public boolean isTransactionManaged();
0070:
0071:            /**
0072:             * @deprecated use {@link #isTransactionManaged} instead to interrogate
0073:             * whether or not this EntityManager's transaction is managed. To determine
0074:             * if a given entity instance is managed, use {@link #contains}.
0075:             */
0076:            public boolean isManaged();
0077:
0078:            /**
0079:             * Whether to check for a global transaction upon every managed,
0080:             * non-transactional operation. Defaults to false.
0081:             */
0082:            public boolean getSyncWithManagedTransactions();
0083:
0084:            /**
0085:             * Whether to check for a global transaction upon every managed,
0086:             * non-transactional operation. Defaults to false.
0087:             */
0088:            public void setSyncWithManagedTransactions(boolean resync);
0089:
0090:            /**
0091:             * Return the current thread's class loader at the time this entity
0092:             * manager was obtained from the factory.
0093:             */
0094:            public ClassLoader getClassLoader();
0095:
0096:            /**
0097:             * Return the connection user name.
0098:             */
0099:            public String getConnectionUserName();
0100:
0101:            /**
0102:             * Return the connection password.
0103:             */
0104:            public String getConnectionPassword();
0105:
0106:            /**
0107:             * Whether the entity manager or its managed instances are used in a
0108:             * multithreaded environment.
0109:             */
0110:            public boolean getMultithreaded();
0111:
0112:            /**
0113:             * Whether the entity manager or its managed instances are used in a
0114:             * multithreaded environment.
0115:             */
0116:            public void setMultithreaded(boolean multi);
0117:
0118:            /**
0119:             * Whether to take into account changes in the transaction when executing
0120:             * a query or iterating an extent.
0121:             */
0122:            public boolean getIgnoreChanges();
0123:
0124:            /**
0125:             * Whether to take into account changes in the transaction when executing
0126:             * a query or iterating an extent.
0127:             */
0128:            public void setIgnoreChanges(boolean ignore);
0129:
0130:            /**
0131:             * Whether to allow nontransactional access to persistent state.
0132:             */
0133:            public boolean getNontransactionalRead();
0134:
0135:            /**
0136:             * Whether to allow nontransactional access to persistent state.
0137:             */
0138:            public void setNontransactionalRead(boolean read);
0139:
0140:            /**
0141:             * Whether to allow nontransactional changes to persistent state.
0142:             */
0143:            public boolean getNontransactionalWrite();
0144:
0145:            /**
0146:             * Whether to allow nontransactional changes to persistent state.
0147:             */
0148:            public void setNontransactionalWrite(boolean write);
0149:
0150:            /**
0151:             * Whether to use optimistic transactional semantics.
0152:             */
0153:            public boolean getOptimistic();
0154:
0155:            /**
0156:             * Whether to use optimistic transactional semantics.
0157:             */
0158:            public void setOptimistic(boolean opt);
0159:
0160:            /**
0161:             * Whether to restore an object's original state on rollback.
0162:             */
0163:            public RestoreStateType getRestoreState();
0164:
0165:            /**
0166:             * Whether to restore an object's original state on rollback.
0167:             */
0168:            public void setRestoreState(RestoreStateType restoreType);
0169:
0170:            /**
0171:             * Whether objects retain their persistent state on transaction commit.
0172:             */
0173:            public boolean getRetainState();
0174:
0175:            /**
0176:             * Whether objects retain their persistent state on transaction commit.
0177:             */
0178:            public void setRetainState(boolean retain);
0179:
0180:            /**
0181:             * Detach mode constant to determine which fields are part of the
0182:             * detached graph.
0183:             */
0184:            public DetachStateType getDetachState();
0185:
0186:            /**
0187:             * Detach mode constant to determine which fields are part of the
0188:             * detached graph.
0189:             */
0190:            public void setDetachState(DetachStateType type);
0191:
0192:            /**
0193:             * Whether to clear state when entering a transaction.
0194:             */
0195:            public AutoClearType getAutoClear();
0196:
0197:            /**
0198:             * Whether to clear state when entering a transaction.
0199:             */
0200:            public void setAutoClear(AutoClearType clearType);
0201:
0202:            /**
0203:             * {@link AutoDetachType} values which indicate when persistent
0204:             * managed objects should be automatically detached in-place.
0205:             */
0206:            public EnumSet<AutoDetachType> getAutoDetach();
0207:
0208:            /**
0209:             * {@link AutoDetachType} values which indicate when persistent
0210:             * managed objects should be automatically detached in-place.
0211:             * The current value is replaced in its entirety.
0212:             */
0213:            public void setAutoDetach(AutoDetachType value);
0214:
0215:            /**
0216:             * {@link AutoDetachType} values which indicate when persistent
0217:             * managed objects should be automatically detached in-place.
0218:             * The current value is replaced in its entirety.
0219:             */
0220:            public void setAutoDetach(EnumSet<AutoDetachType> values);
0221:
0222:            /**
0223:             * Bit flags marked in {@link AutoDetachType} which indicate when persistent
0224:             * managed objects should be automatically detached in-place.
0225:             *
0226:             * @since 1.1.0
0227:             */
0228:            public void setAutoDetach(AutoDetachType value, boolean on);
0229:
0230:            /**
0231:             * Whether to also evict an object from the store cache when it is
0232:             * evicted through this entity manager.
0233:             */
0234:            public boolean getEvictFromStoreCache();
0235:
0236:            /**
0237:             * Whether to also evict an object from the store cache when it is
0238:             * evicted through this entity manager.
0239:             */
0240:            public void setEvictFromStoreCache(boolean evict);
0241:
0242:            /**
0243:             * Whether objects accessed during this transaction will be added to the
0244:             * store cache. Defaults to true.
0245:             *
0246:             * @since 0.3.4
0247:             */
0248:            public boolean getPopulateStoreCache();
0249:
0250:            /**
0251:             * Whether to populate the store cache with objects used by this
0252:             * transaction. Defaults to true.
0253:             *
0254:             * @since 0.3.4
0255:             */
0256:            public void setPopulateStoreCache(boolean cache);
0257:
0258:            /**
0259:             * Whether memory usage is reduced during this transaction at the expense
0260:             * of tracking changes at the type level instead of the instance level,
0261:             * resulting in more aggressive cache invalidation.
0262:             *
0263:             * @since 1.0.0
0264:             */
0265:            public boolean isTrackChangesByType();
0266:
0267:            /**
0268:             * If a large number of objects will be created, modified, or deleted
0269:             * during this transaction setting this option to true will reduce memory
0270:             * usage if you perform periodic flushes by tracking changes at the type
0271:             * level instead of the instance level, resulting in more aggressive cache
0272:             * invalidation.
0273:             *
0274:             * @since 1.0.0
0275:             */
0276:            public void setTrackChangesByType(boolean track);
0277:
0278:            /**
0279:             * Put the specified key-value pair into the map of user objects. Use
0280:             * a value of null to remove the key.
0281:             */
0282:            public Object putUserObject(Object key, Object val);
0283:
0284:            /**
0285:             * Get the value for the specified key from the map of user objects.
0286:             */
0287:            public Object getUserObject(Object key);
0288:
0289:            ///////////
0290:            // Lookups
0291:            ///////////
0292:
0293:            /**
0294:             * Return the objects with the given oids.
0295:             *
0296:             * @param oids the oids of the objects to return
0297:             * @return the objects that were looked up, in the
0298:             * same order as the oids parameter.
0299:             * @see #find(Class,Object)
0300:             */
0301:            public <T> T[] findAll(Class<T> cls, Object... oids);
0302:
0303:            /**
0304:             * Return the objects with the given oids.
0305:             *
0306:             * @param oids the oids of the objects to return
0307:             * @return the objects that were looked up, in the
0308:             * same order as the oids parameter.
0309:             * @see #find(Class,Object)
0310:             */
0311:            public <T> Collection<T> findAll(Class<T> cls, Collection oids);
0312:
0313:            /**
0314:             * Return the cached instance for the given oid/object, or null if not
0315:             * cached.
0316:             *
0317:             * @param oid the object's id
0318:             * @return the cached object, or null if not cached
0319:             */
0320:            public <T> T findCached(Class<T> cls, Object oid);
0321:
0322:            /**
0323:             * Return the application identity class the given persistent class uses
0324:             * for object ids, or null if not a type that uses application identity.
0325:             */
0326:            public Class getObjectIdClass(Class pcClass);
0327:
0328:            ////////////////
0329:            // Transactions
0330:            ////////////////
0331:
0332:            public OpenJPAEntityTransaction getTransaction();
0333:
0334:            /**
0335:             * Set a transactional savepoint where operations after this savepoint
0336:             * will be rolled back.
0337:             */
0338:            public void setSavepoint(String name);
0339:
0340:            /**
0341:             * Rollback the current transaction to the last savepoint.
0342:             * Savepoints set after this one will become invalid.
0343:             */
0344:            public void rollbackToSavepoint();
0345:
0346:            /**
0347:             * Rollback the current transaction to the given savepoint name.
0348:             * Savepoints set after this one will become invalid.
0349:             */
0350:            public void rollbackToSavepoint(String name);
0351:
0352:            /**
0353:             * Release the last set savepoint and any resources associated with it.
0354:             * The given savepoint and any set after it will become invalid.
0355:             */
0356:            public void releaseSavepoint();
0357:
0358:            /**
0359:             * Release the savepoint and any resources associated with it.
0360:             * The given savepoint and any set after it will become invalid.
0361:             */
0362:            public void releaseSavepoint(String name);
0363:
0364:            /**
0365:             * Run pre-flush actions on transactional objects, including
0366:             * persistence-by-reachability, inverse relationship management,
0367:             * deletion of dependent instances, and instance callbacks.
0368:             * Transaction listeners are not invoked.
0369:             *
0370:             * @since 0.3.3
0371:             */
0372:            public void preFlush();
0373:
0374:            /**
0375:             * Validate the changes made in this transaction, reporting any optimistic
0376:             * violations, constraint violations, etc. In a datastore transaction or
0377:             * a flushed optimistic transaction, this method will act just like
0378:             * {@link #flush()}. In an optimistic transaction that has not yet begun a
0379:             * datastore-level transaction, however, it will only report exceptions
0380:             * that would occur on flush, without retaining any datastore resources.
0381:             */
0382:            public void validateChanges();
0383:
0384:            /**
0385:             * Whether a store transaction is active.
0386:             */
0387:            public boolean isStoreActive();
0388:
0389:            /**
0390:             * Begins a store transaction if one isn't already started. The
0391:             * entity manager must already be in a logical transaction.
0392:             */
0393:            public void beginStore();
0394:
0395:            ////////////////////
0396:            // Object Lifecycle
0397:            ////////////////////
0398:
0399:            /**
0400:             * Whether the given objects are managed.
0401:             */
0402:            public boolean containsAll(Object... pcs);
0403:
0404:            /**
0405:             * Whether the given objects are managed.
0406:             */
0407:            public boolean containsAll(Collection pcs);
0408:
0409:            /**
0410:             * Persist the given objects.
0411:             */
0412:            public void persistAll(Object... pcs);
0413:
0414:            /**
0415:             * Persist the given objects.
0416:             */
0417:            public void persistAll(Collection pcs);
0418:
0419:            /**
0420:             * Delete the given persistent objects.
0421:             */
0422:            public void removeAll(Object... pcs);
0423:
0424:            /**
0425:             * Delete the given persistent objects.
0426:             */
0427:            public void removeAll(Collection pcs);
0428:
0429:            /**
0430:             * Release the given object from management. This operation is not
0431:             * recursive.
0432:             */
0433:            public void release(Object pc);
0434:
0435:            /**
0436:             * Release the given object from management. This operation is not
0437:             * recursive.
0438:             */
0439:            public void releaseAll(Object... pcs);
0440:
0441:            /**
0442:             * Release the given objects from management. This operation is not
0443:             * recursive.
0444:             */
0445:            public void releaseAll(Collection pcs);
0446:
0447:            /**
0448:             * Immediately load the given object's persistent fields. One might
0449:             * use this action to make sure that an instance's fields are loaded
0450:             * before transitioning it to transient. Note that this action is not
0451:             * recursive. Any related objects that are loaded will not necessarily
0452:             * have their fields loaded.
0453:             */
0454:            public void retrieve(Object pc);
0455:
0456:            /**
0457:             * Retrieve the persistent state of the given objects.
0458:             *
0459:             * @see #retrieve
0460:             */
0461:            public void retrieveAll(Object... pcs);
0462:
0463:            /**
0464:             * Retrieve the persistent state of the given objects.
0465:             *
0466:             * @see #retrieve
0467:             */
0468:            public void retrieveAll(Collection pcs);
0469:
0470:            /**
0471:             * Refresh the state of the given objects.
0472:             */
0473:            public void refreshAll(Object... pcs);
0474:
0475:            /**
0476:             * Refresh the state of the given objects.
0477:             */
0478:            public void refreshAll(Collection pcs);
0479:
0480:            /**
0481:             * Refresh all transactional objects.
0482:             */
0483:            public void refreshAll();
0484:
0485:            /**
0486:             * Evict the given object.
0487:             */
0488:            public void evict(Object pc);
0489:
0490:            /**
0491:             * Evict the given objects.
0492:             */
0493:            public void evictAll(Object... pcs);
0494:
0495:            /**
0496:             * Evict the given objects.
0497:             */
0498:            public void evictAll(Collection pcs);
0499:
0500:            /**
0501:             * Evict all clean objects.
0502:             */
0503:            public void evictAll();
0504:
0505:            /**
0506:             * Evict all persistent-clean and persistent-nontransactional
0507:             * instances in the extent of the given class (including subclasses).
0508:             */
0509:            public void evictAll(Class cls);
0510:
0511:            /**
0512:             * Evict all persistent-clean and persistent-nontransactional
0513:             * instances in the given {@link Extent}.
0514:             */
0515:            public void evictAll(Extent extent);
0516:
0517:            /**
0518:             * Detach the specified object from the entity manager.
0519:             *
0520:             * @param pc the instance to detach
0521:             * @return the detached instance
0522:             */
0523:            public <T> T detach(T pc);
0524:
0525:            /**
0526:             * Detach the specified objects from the entity manager.
0527:             *
0528:             * @param pcs the instances to detach
0529:             * @return the detached instances
0530:             */
0531:            public Collection detachAll(Collection pcs);
0532:
0533:            /**
0534:             * Detach the specified objects from the entity manager.
0535:             *
0536:             * @param pcs the instances to detach
0537:             * @return the detached instances
0538:             */
0539:            public Object[] detachAll(Object... pcs);
0540:
0541:            /**
0542:             * Merge the specified objects into the entity manager.
0543:             *
0544:             * @param pcs instances to import
0545:             * @return the re-attached instances
0546:             */
0547:            public Object[] mergeAll(Object... pcs);
0548:
0549:            /**
0550:             * Merge the specified detached objects into the entity manager.
0551:             *
0552:             * @param pcs Collection of instances to import
0553:             * @return the re-attached instances
0554:             */
0555:            public Collection mergeAll(Collection pcs);
0556:
0557:            /**
0558:             * Make the given object transactional.
0559:             *
0560:             * @param pc instance to make transactional
0561:             * @param updateVersion if true, the instance's version will be
0562:             * incremented at the next flush
0563:             */
0564:            public void transactional(Object pc, boolean updateVersion);
0565:
0566:            /**
0567:             * Make the given objects transactional.
0568:             *
0569:             * @param objs instances to make transactional
0570:             * @param updateVersion if true, the instance's version will be
0571:             * incremented at the next flush
0572:             */
0573:            public void transactionalAll(Collection objs, boolean updateVersion);
0574:
0575:            /**
0576:             * Make the given objects transactional.
0577:             *
0578:             * @param objs instances to make transactional
0579:             * @param updateVersion if true, the instance's version will be
0580:             * incremented at the next flush
0581:             */
0582:            public void transactionalAll(Object[] objs, boolean updateVersion);
0583:
0584:            /**
0585:             * Make the given object nontransactional.
0586:             */
0587:            public void nontransactional(Object pc);
0588:
0589:            /**
0590:             * Make the given objects nontransactional.
0591:             */
0592:            public void nontransactionalAll(Collection objs);
0593:
0594:            /**
0595:             * Make the given objects nontransactional.
0596:             */
0597:            public void nontransactionalAll(Object[] objs);
0598:
0599:            ////////////////////////////
0600:            // Extent, Query, Generator
0601:            ////////////////////////////
0602:
0603:            /**
0604:             * Return the named generator defined in the metadata.
0605:             */
0606:            public Generator getNamedGenerator(String name);
0607:
0608:            /**
0609:             * Returns a {@link Generator} for the datastore identity values of the
0610:             * specified type, or null if the type is unmanaged or its identity
0611:             * cannot be represented by a sequence.
0612:             */
0613:            public Generator getIdGenerator(Class forClass);
0614:
0615:            /**
0616:             * Returns a {@link Generator} for the generated values of the specified
0617:             * type, or null if the field is not generated.
0618:             */
0619:            public Generator getFieldGenerator(Class forClass, String fieldName);
0620:
0621:            /**
0622:             * Return an extent of the given class, optionally including subclasses.
0623:             */
0624:            public <T> Extent<T> createExtent(Class<T> cls, boolean subs);
0625:
0626:            public OpenJPAQuery createQuery(String query);
0627:
0628:            public OpenJPAQuery createNamedQuery(String name);
0629:
0630:            public OpenJPAQuery createNativeQuery(String sql);
0631:
0632:            public OpenJPAQuery createNativeQuery(String sql, Class resultClass);
0633:
0634:            public OpenJPAQuery createNativeQuery(String sql,
0635:                    String resultMapping);
0636:
0637:            /**
0638:             * Create a new query from the given one.
0639:             */
0640:            public OpenJPAQuery createQuery(Query query);
0641:
0642:            /**
0643:             * Create a new query in the given language.
0644:             */
0645:            public OpenJPAQuery createQuery(String language, String query);
0646:
0647:            ///////////
0648:            // Locking
0649:            ///////////
0650:
0651:            /**
0652:             * Return the lock mode of the given instance, or null if not locked.
0653:             */
0654:            public LockModeType getLockMode(Object pc);
0655:
0656:            /**
0657:             * Ensure that the given instance is locked at the given lock level.
0658:             *
0659:             * @param pc the object to lock
0660:             * @param mode the lock level to use
0661:             * @param timeout the number of milliseconds to wait for the lock before
0662:             * giving up, or -1 for no limit
0663:             */
0664:            public void lock(Object pc, LockModeType mode, int timeout);
0665:
0666:            /**
0667:             * Ensure that the given instance is locked at the current lock level, as
0668:             * set in the {@link FetchPlan} for the entity manager.
0669:             */
0670:            public void lock(Object pc);
0671:
0672:            /**
0673:             * Ensure that the given instances are locked at the given lock level.
0674:             *
0675:             * @param pcs the objects to lock
0676:             * @param mode the lock level to use
0677:             * @param timeout the number of milliseconds to wait for the lock before
0678:             * giving up, or -1 for no limit
0679:             */
0680:            public void lockAll(Collection pcs, LockModeType mode, int timeout);
0681:
0682:            /**
0683:             * Ensure that the given instances are locked at the current lock level,
0684:             * as set in the {@link FetchPlan} for the entity manager.
0685:             */
0686:            public void lockAll(Collection pcs);
0687:
0688:            /**
0689:             * Ensure that the given instances are locked at the given lock level.
0690:             *
0691:             * @param pcs the objects to lock
0692:             * @param mode the lock level to use
0693:             * @param timeout the number of milliseconds to wait for the lock before
0694:             * giving up, or -1 for no limit
0695:             */
0696:            public void lockAll(Object[] pcs, LockModeType mode, int timeout);
0697:
0698:            /**
0699:             * Ensure that the given instances are locked at the current lock level,
0700:             * as set in the {@link FetchPlan} for the entity manager.
0701:             */
0702:            public void lockAll(Object... pcs);
0703:
0704:            //////////////
0705:            // Connection
0706:            //////////////
0707:
0708:            /**
0709:             * Cancel all pending data store statements. If statements are cancelled
0710:             * while a flush is in progress, the transaction rollback only flag will
0711:             * be set.
0712:             *
0713:             * @return true if any statements were cancelled, false otherwise
0714:             */
0715:            public boolean cancelAll();
0716:
0717:            /**
0718:             * Return the connection in use by the entity manager, or a new
0719:             * connection if none.
0720:             */
0721:            public Object getConnection();
0722:
0723:            /////////
0724:            // Cache
0725:            /////////
0726:
0727:            /**
0728:             * Return a set of all managed instances.
0729:             */
0730:            public Collection getManagedObjects();
0731:
0732:            /**
0733:             * Return a set of current transaction instances.
0734:             */
0735:            public Collection getTransactionalObjects();
0736:
0737:            /**
0738:             * Return a set of instances which will become transactional upon
0739:             * the next transaction.
0740:             */
0741:            public Collection getPendingTransactionalObjects();
0742:
0743:            /**
0744:             * Return a set of current dirty instances.
0745:             */
0746:            public Collection getDirtyObjects();
0747:
0748:            /**
0749:             * Whether dirty objects will be returned in the order they were dirtied.
0750:             * Default is determined by the store manager.
0751:             */
0752:            public boolean getOrderDirtyObjects();
0753:
0754:            /**
0755:             * Whether dirty objects will be returned in the order they were dirtied.
0756:             * Default is determined by the store manager.
0757:             */
0758:            public void setOrderDirtyObjects(boolean order);
0759:
0760:            /**
0761:             * Mark the given class as dirty within the current transaction.
0762:             */
0763:            public void dirtyClass(Class cls);
0764:
0765:            /**
0766:             * Return the set of classes that have been made persistent in the current
0767:             * transaction.
0768:             */
0769:            public Collection<Class> getPersistedClasses();
0770:
0771:            /**
0772:             * Return the set of classes that have been deleted in the current
0773:             * transaction.
0774:             */
0775:            public Collection<Class> getRemovedClasses();
0776:
0777:            /**
0778:             * Return the set of classes for objects that have been modified
0779:             * in the current transaction.
0780:             */
0781:            public Collection<Class> getUpdatedClasses();
0782:
0783:            /**
0784:             * Create a new instance of type <code>cls</code>. If <code>cls</code> is
0785:             * an interface or an abstract class whose abstract methods follow the
0786:             * JavaBeans convention, this method will create a concrete implementation
0787:             * according to the metadata that defines the class. If <code>cls</code>
0788:             * is a non-final concrete type that has metadata but does not implement
0789:             * {@link org.apache.openjpa.enhance.PersistenceCapable}, this method will
0790:             * create a subclass of the type that does implement
0791:             * {@link org.apache.openjpa.enhance.PersistenceCapable}, and will attempt
0792:             * to redefine the methods in <code>cls</code> to enable persistent
0793:             * attribute tracking. Otherwise, if <code>cls</code> is a managed type,
0794:             * this will return an instance of the specified class.
0795:             *
0796:             * @throws IllegalArgumentException if <code>cls</code> is not a managed
0797:             * type or interface.
0798:             */
0799:            public <T> T createInstance(Class<T> cls);
0800:
0801:            /**
0802:             * Make the named field of the given object dirty.
0803:             */
0804:            public void dirty(Object o, String field);
0805:
0806:            /**
0807:             * Return the oid of the given instance.
0808:             */
0809:            public Object getObjectId(Object o);
0810:
0811:            /**
0812:             * Return whether the given object is dirty.
0813:             */
0814:            public boolean isDirty(Object o);
0815:
0816:            /**
0817:             * Return whether the given object is transactional.
0818:             */
0819:            public boolean isTransactional(Object o);
0820:
0821:            /**
0822:             * Return whether the given object is persistent.
0823:             */
0824:            public boolean isPersistent(Object o);
0825:
0826:            /**
0827:             * Return whether the given object was made persistent in the current
0828:             * transaction.
0829:             */
0830:            public boolean isNewlyPersistent(Object o);
0831:
0832:            /**
0833:             * Return whether the given object is deleted.
0834:             */
0835:            public boolean isRemoved(Object o);
0836:
0837:            /**
0838:             * Returns <code>true</code> if <code>pc</code> is a detached object
0839:             * (one that can be reattached to a {@link EntityManager} via a call
0840:             * to {@link EntityManager#merge}); otherwise returns
0841:             * <code>false</code>.
0842:             */
0843:            public boolean isDetached(Object o);
0844:
0845:            /**
0846:             * Returns the current version indicator for <code>o</code>.
0847:             */
0848:            public Object getVersion(Object o);
0849:
0850:            /**
0851:             * @deprecated use the {@link ConnectionRetainMode} enum instead.
0852:             */
0853:            public static final int CONN_RETAIN_DEMAND = ConnectionRetainModes.CONN_RETAIN_DEMAND;
0854:
0855:            /**
0856:             * @deprecated use the {@link ConnectionRetainMode} enum instead.
0857:             */
0858:            public static final int CONN_RETAIN_TRANS = ConnectionRetainModes.CONN_RETAIN_TRANS;
0859:
0860:            /**
0861:             * @deprecated use the {@link ConnectionRetainMode} enum instead.
0862:             */
0863:            public static final int CONN_RETAIN_ALWAYS = ConnectionRetainModes.CONN_RETAIN_ALWAYS;
0864:
0865:            /**
0866:             * @deprecated use the {@link DetachStateType} enum instead.
0867:             */
0868:            public static final int DETACH_FETCH_GROUPS = DetachState.DETACH_FETCH_GROUPS;
0869:
0870:            /**
0871:             * @deprecated use the {@link DetachStateType} enum instead.
0872:             */
0873:            public static final int DETACH_FGS = DetachState.DETACH_FGS;
0874:
0875:            /**
0876:             * @deprecated use the {@link DetachStateType} enum instead.
0877:             */
0878:            public static final int DETACH_LOADED = DetachState.DETACH_LOADED;
0879:
0880:            /**
0881:             * @deprecated use the {@link DetachStateType} enum instead.
0882:             */
0883:            public static final int DETACH_ALL = DetachState.DETACH_ALL;
0884:
0885:            /**
0886:             * @deprecated use the {@link RestoreStateType} enum instead.
0887:             */
0888:            public static final int RESTORE_NONE = RestoreState.RESTORE_NONE;
0889:
0890:            /**
0891:             * @deprecated use the {@link RestoreStateType} enum instead.
0892:             */
0893:            public static final int RESTORE_IMMUTABLE = RestoreState.RESTORE_IMMUTABLE;
0894:
0895:            /**
0896:             * @deprecated use the {@link RestoreStateType} enum instead.
0897:             */
0898:            public static final int RESTORE_ALL = RestoreState.RESTORE_ALL;
0899:
0900:            /**
0901:             * @deprecated use the {@link AutoDetachType} enum instead.
0902:             */
0903:            public static final int DETACH_CLOSE = AutoDetach.DETACH_CLOSE;
0904:
0905:            /**
0906:             * @deprecated use the {@link AutoDetachType} enum instead.
0907:             */
0908:            public static final int DETACH_COMMIT = AutoDetach.DETACH_COMMIT;
0909:
0910:            /**
0911:             * @deprecated use the {@link AutoDetachType} enum instead.
0912:             */
0913:            public static final int DETACH_NONTXREAD = AutoDetach.DETACH_NONTXREAD;
0914:
0915:            /**
0916:             * @deprecated use the {@link AutoDetachType} enum instead.
0917:             */
0918:            public static final int DETACH_ROLLBACK = AutoDetach.DETACH_ROLLBACK;
0919:
0920:            /**
0921:             * @deprecated use the {@link AutoClearType} enum instead.
0922:             */
0923:            public static final int CLEAR_DATASTORE = AutoClear.CLEAR_DATASTORE;
0924:
0925:            /**
0926:             * @deprecated use the {@link AutoClearType} enum instead.
0927:             */
0928:            public static final int CLEAR_ALL = AutoClear.CLEAR_ALL;
0929:
0930:            /**
0931:             * @deprecated use the {@link CallbackMode} enum instead.
0932:             */
0933:            public static final int CALLBACK_FAIL_FAST = CallbackModes.CALLBACK_FAIL_FAST;
0934:
0935:            /**
0936:             * @deprecated use the {@link CallbackMode} enum instead.
0937:             */
0938:            public static final int CALLBACK_IGNORE = CallbackModes.CALLBACK_IGNORE;
0939:
0940:            /**
0941:             * @deprecated use the {@link CallbackMode} enum instead.
0942:             */
0943:            public static final int CALLBACK_LOG = CallbackModes.CALLBACK_LOG;
0944:
0945:            /**
0946:             * @deprecated use the {@link CallbackMode} enum instead.
0947:             */
0948:            public static final int CALLBACK_RETHROW = CallbackModes.CALLBACK_RETHROW;
0949:
0950:            /**
0951:             * @deprecated use the {@link CallbackMode} enum instead.
0952:             */
0953:            public static final int CALLBACK_ROLLBACK = CallbackModes.CALLBACK_ROLLBACK;
0954:
0955:            /**
0956:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
0957:             * method pierces the published-API boundary, as does the SPI cast.
0958:             */
0959:            public org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration();
0960:
0961:            /**
0962:             * @deprecated use {@link #setRestoreState(RestoreStateType)} instead.
0963:             */
0964:            public void setRestoreState(int restore);
0965:
0966:            /**
0967:             * @deprecated use {@link #setDetachState(DetachStateType)} instead.
0968:             */
0969:            public void setDetachState(int detach);
0970:
0971:            /**
0972:             * @deprecated use {@link #setAutoClear(AutoClearType)} instead.
0973:             */
0974:            public void setAutoClear(int autoClear);
0975:
0976:            /**
0977:             * @deprecated use {@link #setAutoDetach(AutoDetachType)} or
0978:             * {@link #setAutoDetach(java.util.EnumSet)} instead.
0979:             */
0980:            public void setAutoDetach(int autoDetachFlags);
0981:
0982:            /**
0983:             * @deprecated use {@link #setAutoDetach(AutoDetachType, boolean)} instead.
0984:             */
0985:            public void setAutoDetach(int flag, boolean on);
0986:
0987:            /**
0988:             * @deprecated use {@link #isTrackChangesByType()} instead.
0989:             */
0990:            public boolean isLargeTransaction();
0991:
0992:            /**
0993:             * @deprecated use {@link #setTrackChangesByType(boolean)} instead.
0994:             */
0995:            public void setLargeTransaction(boolean value);
0996:
0997:            /**
0998:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
0999:             * method pierces the published-API boundary, as does the SPI cast.
1000:             */
1001:            public void addTransactionListener(Object listener);
1002:
1003:            /**
1004:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1005:             * method pierces the published-API boundary, as does the SPI cast.
1006:             */
1007:            public void removeTransactionListener(Object listener);
1008:
1009:            /**
1010:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1011:             * method pierces the published-API boundary, as does the SPI cast.
1012:             */
1013:            public int getTransactionListenerCallbackMode();
1014:
1015:            /**
1016:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1017:             * method pierces the published-API boundary, as does the SPI cast.
1018:             */
1019:            public void setTransactionListenerCallbackMode(int callbackMode);
1020:
1021:            /**
1022:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1023:             * method pierces the published-API boundary, as does the SPI cast.
1024:             */
1025:            public void addLifecycleListener(Object listener, Class... classes);
1026:
1027:            /**
1028:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1029:             * method pierces the published-API boundary, as does the SPI cast.
1030:             */
1031:            public void removeLifecycleListener(Object listener);
1032:
1033:            /**
1034:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1035:             * method pierces the published-API boundary, as does the SPI cast.
1036:             */
1037:            public int getLifecycleListenerCallbackMode();
1038:
1039:            /**
1040:             * @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
1041:             * method pierces the published-API boundary, as does the SPI cast.
1042:             */
1043:            public void setLifecycleListenerCallbackMode(int callbackMode);
1044:
1045:            /**
1046:             * @deprecated use {@link EntityTransaction#begin}
1047:             * instead: <code>em.getTransaction().begin()</code>
1048:             */
1049:            public void begin();
1050:
1051:            /**
1052:             * @deprecated use {@link EntityTransaction#commit}
1053:             * instead: <code>em.getTransaction().commit()</code>
1054:             */
1055:            public void commit();
1056:
1057:            /**
1058:             * @deprecated use {@link EntityTransaction#rollback}
1059:             * instead: <code>em.getTransaction().rollback()</code>
1060:             */
1061:            public void rollback();
1062:
1063:            /**
1064:             * @deprecated use {@link EntityTransaction#isActive}
1065:             * instead: <code>em.getTransaction().isActive()</code>
1066:             */
1067:            public boolean isActive();
1068:
1069:            /**
1070:             * @deprecated use {@link OpenJPAEntityTransaction#commitAndResume} instead:
1071:             * <code>em.getTransaction().commitAndResume()</code>
1072:             */
1073:            public void commitAndResume();
1074:
1075:            /**
1076:             * @deprecated use {@link OpenJPAEntityTransaction#rollbackAndResume}
1077:             * instead: <code>em.getTransaction().rollbackAndResume()</code>
1078:             */
1079:            public void rollbackAndResume();
1080:
1081:            /**
1082:             * @deprecated use {@link EntityTransaction#setRollbackOnly}
1083:             * instead: <code>em.getTransaction().setRollbackOnly()</code>
1084:             */
1085:            public void setRollbackOnly();
1086:
1087:            /**
1088:             * @deprecated use {@link OpenJPAEntityTransaction#setRollbackOnly}
1089:             * instead: <code>em.getTransaction().setRollbackOnly()</code>
1090:             */
1091:            public void setRollbackOnly(Throwable cause);
1092:
1093:            /**
1094:             * @deprecated use {@link OpenJPAEntityTransaction#getRollbackCause}
1095:             * instead: <code>em.getTransaction().getRollbackCause()</code>
1096:             */
1097:            public Throwable getRollbackCause();
1098:
1099:            /**
1100:             * @deprecated use {@link EntityTransaction#getRollbackOnly}
1101:             * instead: <code>em.getTransaction().getRollbackOnly()</code>
1102:             */
1103:            public boolean getRollbackOnly();
1104:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.