Java Doc for TxEntityManager.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.persistence 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.ow2.easybeans.persistence.TxEntityManager

TxEntityManager
public class TxEntityManager implements EntityManager(Code)
This class represents an EntityManager that will be used as a container managed transaction scoped persistence context. The lifetime of this context is a single transaction. When the transaction is committed or rollbacked, the persistence context ends.
author:
   Florent Benoit



Constructor Summary
public  TxEntityManager(TxEntityManagerHandler handler)
     Build a new entity manager which have TransactionScoped type.

Method Summary
public  voidclear()
     Clear the persistence context, causing all managed entities to become detached.
public  voidclose()
     Close an application-managed EntityManager.
public  booleancontains(Object entity)
     Check if the instance belongs to the current persistence context.
public  QuerycreateNamedQuery(String name)
     Create an instance of Query for executing a named query (in EJB QL or native SQL).
public  QuerycreateNativeQuery(String sqlString)
     Create an instance of Query for executing a native SQL statement, e.g., for update or delete.
public  QuerycreateNativeQuery(String sqlString, Class resultClass)
     Create an instance of Query for executing a native SQL query.
public  QuerycreateNativeQuery(String sqlString, String resultSetMapping)
     Create an instance of Query for executing a native SQL query.
public  QuerycreateQuery(String ejbqlString)
     Create an instance of Query for executing an EJB QL statement.
public  Tfind(Class<T> entityClass, Object primaryKey)
     Find by primary key.
public  voidflush()
     Synchronize the persistence context to the underlying database.
public  EntityManagergetCurrentEntityManager()
     Gets (or create) a new EntityManager for the current tx (if any).
public  ObjectgetDelegate()
    
public  FlushModeTypegetFlushMode()
     Get the flush mode that applies to all objects contained in the persistence context.
public  TgetReference(Class<T> entityClass, Object primaryKey)
     Get an instance, whose state may be lazily fetched.
public  EntityTransactiongetTransaction()
     Return the resource-level transaction object.
public  booleanisOpen()
     Determine whether the EntityManager is open.
public  voidjoinTransaction()
     TODO: document this.
public  voidlock(Object entity, LockModeType lockMode)
     Set the lock mode for an entity object contained in the persistence context.
public  Tmerge(T entity)
     Merge the state of the given entity into the current persistence context.
Parameters:
  entity - entity bean<
Parameters:
  T - > entity object's class.
public  voidpersist(Object entity)
     Make an instance managed and persistent.
public  voidrefresh(Object entity)
     Refresh the state of the instance from the database, overwriting changes made to the entity, if any.
public  voidremove(Object entity)
     Remove the entity instance.
public  voidsetFlushMode(FlushModeType flushMode)
     Set the flush mode that applies to all objects contained in the persistence context.


Constructor Detail
TxEntityManager
public TxEntityManager(TxEntityManagerHandler handler)(Code)
Build a new entity manager which have TransactionScoped type.
Parameters:
  handler - object managing the transaction's EntityManager.




Method Detail
clear
public void clear()(Code)
Clear the persistence context, causing all managed entities to become detached. Changes made to entities that have not been flushed to the database will not be persisted.



close
public void close() throws IllegalStateException(Code)
Close an application-managed EntityManager. After an EntityManager has been closed, all methods on the EntityManager instance will throw the IllegalStateException except for isOpen, which will return false. This method can only be called when the EntityManager is not associated with an active transaction.
throws:
  IllegalStateException - if the EntityManager is associated with anactive transaction or if the EntityManager is container-managed.



contains
public boolean contains(Object entity) throws IllegalArgumentException(Code)
Check if the instance belongs to the current persistence context.
Parameters:
  entity - the entity bean true/false
throws:
  IllegalArgumentException - if not an entity



createNamedQuery
public Query createNamedQuery(String name) throws IllegalArgumentException(Code)
Create an instance of Query for executing a named query (in EJB QL or native SQL).
Parameters:
  name - the name of a query defined in metadata the new query instance
throws:
  IllegalArgumentException - if a query has not been defined with thegiven name



createNativeQuery
public Query createNativeQuery(String sqlString)(Code)
Create an instance of Query for executing a native SQL statement, e.g., for update or delete.
Parameters:
  sqlString - a native SQL query string the new query instance



createNativeQuery
public Query createNativeQuery(String sqlString, Class resultClass)(Code)
Create an instance of Query for executing a native SQL query.
Parameters:
  sqlString - a native SQL query string
Parameters:
  resultClass - the class of the resulting instance(s) the new query instance



createNativeQuery
public Query createNativeQuery(String sqlString, String resultSetMapping)(Code)
Create an instance of Query for executing a native SQL query.
Parameters:
  sqlString - a native SQL query string
Parameters:
  resultSetMapping - the name of the result set mapping the new query instance



createQuery
public Query createQuery(String ejbqlString) throws IllegalArgumentException(Code)
Create an instance of Query for executing an EJB QL statement.
Parameters:
  ejbqlString - an EJB QL query string the new query instance
throws:
  IllegalArgumentException - if query string is not valid



find
public T find(Class<T> entityClass, Object primaryKey) throws IllegalArgumentException(Code)
Find by primary key. <
Parameters:
  T - > entity object's class.
Parameters:
  entityClass - the class of the entity
Parameters:
  primaryKey - the primary key the found entity instance or null if the entity does not exist
throws:
  IllegalArgumentException - if the first argument does not denote anentity type or the second argument is not a valid type for thatentity?s primary key



flush
public void flush() throws TransactionRequiredException, PersistenceException(Code)
Synchronize the persistence context to the underlying database.
throws:
  TransactionRequiredException - if there is no transaction
throws:
  PersistenceException - if the flush fails



getCurrentEntityManager
public EntityManager getCurrentEntityManager()(Code)
Gets (or create) a new EntityManager for the current tx (if any). an entity manager.



getDelegate
public Object getDelegate()(Code)
TODO: document this.



getFlushMode
public FlushModeType getFlushMode()(Code)
Get the flush mode that applies to all objects contained in the persistence context. flushMode



getReference
public T getReference(Class<T> entityClass, Object primaryKey) throws IllegalArgumentException, EntityNotFoundException(Code)
Get an instance, whose state may be lazily fetched. If the requested instance does not exist in the database, throws EntityNotFoundException when the instance state is first accessed. (The persistence provider runtime is permitted to throw the EntityNotFoundException when getReference is called.) The application should not expect that the instance state will be available upon detachment, unless it was accessed by the application while the entity manager was open. <
Parameters:
  T - > entity object's class.
Parameters:
  entityClass - the class of the entity
Parameters:
  primaryKey - the primary key the found entity instance
throws:
  IllegalArgumentException - if the first argument does not denote anentity type or the second argument is not a valid type for thatentity?s primary key
throws:
  EntityNotFoundException - if the entity state cannot be accessed



getTransaction
public EntityTransaction getTransaction() throws IllegalStateException(Code)
Return the resource-level transaction object. The EntityTransaction instance may be used serially to begin and commit multiple transactions. EntityTransaction instance
throws:
  IllegalStateException - if invoked on a JTA EntityManager or anEntityManager that has been closed.



isOpen
public boolean isOpen()(Code)
Determine whether the EntityManager is open. true until the EntityManager has been closed.



joinTransaction
public void joinTransaction()(Code)
TODO: document this.



lock
public void lock(Object entity, LockModeType lockMode) throws PersistenceException, IllegalArgumentException, TransactionRequiredException(Code)
Set the lock mode for an entity object contained in the persistence context.
Parameters:
  entity - entity bean
Parameters:
  lockMode - mode for locking
throws:
  PersistenceException - if an unsupported lock call is made
throws:
  IllegalArgumentException - if the instance is not an entity or is adetached entity
throws:
  TransactionRequiredException - if there is no transaction



merge
public T merge(T entity) throws IllegalArgumentException, TransactionRequiredException(Code)
Merge the state of the given entity into the current persistence context.
Parameters:
  entity - entity bean<
Parameters:
  T - > entity object's class. the instance that the state was merged to
throws:
  IllegalArgumentException - if instance is not an entity or is aremoved entity
throws:
  TransactionRequiredException - if there is no transaction and thepersistence context is of type PersistenceContextType.TRANSACTION



persist
public void persist(Object entity) throws IllegalArgumentException, TransactionRequiredException(Code)
Make an instance managed and persistent.
Parameters:
  entity - entity bean.
throws:
  IllegalArgumentException - if not an entity or entity is detached
throws:
  TransactionRequiredException - if there is no transaction and thepersistence context is of type PersistenceContextType.TRANSACTION



refresh
public void refresh(Object entity) throws IllegalArgumentException, TransactionRequiredException, EntityNotFoundException(Code)
Refresh the state of the instance from the database, overwriting changes made to the entity, if any.
Parameters:
  entity - entity bean
throws:
  IllegalArgumentException - if not an entity or entity is notmanaged
throws:
  TransactionRequiredException - if there is no transaction and thepersistence context is of type PersistenceContextType.TRANSACTION
throws:
  EntityNotFoundException - if the entity no longer exists in thedatabase



remove
public void remove(Object entity) throws IllegalArgumentException, TransactionRequiredException(Code)
Remove the entity instance.
Parameters:
  entity - entity bean
throws:
  IllegalArgumentException - if not an entity or if a detached entity
throws:
  TransactionRequiredException - if there is no transaction and thepersistence context is of type PersistenceContextType.TRANSACTION



setFlushMode
public void setFlushMode(FlushModeType flushMode)(Code)
Set the flush mode that applies to all objects contained in the persistence context.
Parameters:
  flushMode - the mode of flushing



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.