Java Doc for Ammentos.java in  » Database-ORM » Ammentos » it » biobytes » ammentos » 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 » Ammentos » it.biobytes.ammentos 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   it.biobytes.ammentos.Ammentos

Ammentos
public class Ammentos (Code)
This class represents the persistence framework itself. Provides all methods for managing objects persistence: save, load, lookup by primary key and delete operations. These operations can be atomic or can be performed into a transaction by using the transaction related methods such as openTransaction(), commitTransaction() and rollbackTransaction(). An internal caching mechanism dramatically optimizes direct lookup() calls. Furthermore is possible to receive persistence events by registering PersistenceListeners objects to the Framework.
author:
   Davide Deidda




Method Summary
public static  voidaddPersistenceListener(PersistenceListener listener)
     Adds a PersistenceListener to the framework.
protected static  voidcloseContext()
    
public static  voidcloseIteration()
    
public static  voidcommitTransaction()
     Commits the current transaction.
public static  intcount(Class<T> c, Query qry)
     Counts the objects which match the provided query.
public static  intcount(Class<T> c, QueryFilter filter)
     Counts the objects which match the provided queryfilter.
public static  PersistenceContextcreateContext(DataSource source)
    
public static  TcreateInstance(Class<T> c)
     Creates a new instance of the provided object.
public static  PersistenceContextcurrentContext()
    
public static  TransactioncurrentTransaction()
    
public static  voiddelete(T obj)
     Deletes the object.
public static  voiddelete(Class<T> c, QueryFilter filter)
     Deletes all the objects of class c matching the provided QueryFilter.
public static  List<Field>diff(T obj1, T obj2)
    
public static  DataSourcegetDataSource()
    
public static  ConnectiongetDbConnection()
     Returns a connection to the underlying database.
public static  MetadatagetMetadata(Class c)
     Returns the metadata for the objects that belong to the provided class.
public static  FieldgetPrimaryKeyField(Class c)
    
public static  Tintern(T obj)
     Similarly to java.lang.String.intern() method, returns the internal, cached version of the provided object, if present; otherwise returns the same object and puts the provided one into the cache.
public static  Iterable<T>iterate(Class<T> c, Query qry)
    
public static  Tload(Class<T> c, Object primaryKey)
    
public static  Tload(Class<T> c, Object... primaryKeys)
     Loads the object with the provided composite primary key.
public static  List<T>load(Class<T> c, Query qry)
     Loads the objects which match the provided query.
public static  List<T>load(Class<T> c, QueryFilter filter)
     Loads the objects which match the provided query.
protected static  booleanloadDeeply(Class<T> c, T obj, Object primaryKey)
    
public static  TloadUnique(Class<T> c, Query query)
     This method represents a shortcut for loading objects with queries when the expected return value is only one object.
public static  TloadUnique(Class<T> c, QueryFilter filter)
     This method represents a shortcut for loading objects with queries when the expected return value is only one object.
public static  List<T>loadUpdatable(Class<T> c, Query qry)
     Returns an updatable list of objects which match the provided query.
public static  Tlookup(Class<T> c, Object primaryKey)
     Lookup the object of the provided class whith the specified primary key.
protected static  voidopenContext(PersistenceContext context)
    
public static  voidopenTransaction()
     Opens a transaction to the datatabse.
public static  voidopenTransaction(int isolationLevel)
     Opens a transaction to the datatabse.
public static  voidoverride(T obj)
     Saves the provided object instance, regardless the object is already present into the target domain.
public static  voidremovePersistenceListener(PersistenceListener listener)
    
public static  voidrollbackTransaction()
     Rolls back the current transaction.
public static  voidsave(T obj)
     Saves the provided object instance.
public static  voidsetDataSource(DataSource source)
    
public static  voidvalidate(Class<T> c, T obj)
    



Method Detail
addPersistenceListener
public static void addPersistenceListener(PersistenceListener listener)(Code)
Adds a PersistenceListener to the framework.
Parameters:
  listener -



closeContext
protected static void closeContext()(Code)



closeIteration
public static void closeIteration()(Code)



commitTransaction
public static void commitTransaction() throws PersistenceException(Code)
Commits the current transaction. If the commit ends successfully all the objects involved in the transaction are removed from the cache.



count
public static int count(Class<T> c, Query qry) throws PersistenceException(Code)
Counts the objects which match the provided query.
Parameters:
  c -
Parameters:
  qry -
throws:
  it.biobytes.ammentos.PersistenceException -



count
public static int count(Class<T> c, QueryFilter filter) throws PersistenceException(Code)
Counts the objects which match the provided queryfilter.
Parameters:
  c -
Parameters:
  filter -
throws:
  it.biobytes.ammentos.PersistenceException -



createContext
public static PersistenceContext createContext(DataSource source)(Code)



createInstance
public static T createInstance(Class<T> c) throws PersistenceException(Code)
Creates a new instance of the provided object.
Parameters:
  c - The class of the object to create
throws:
  it.biobytes.ammentos.PersistenceException - If any errors occurred while trying to create the instance An instance of the provided class



currentContext
public static PersistenceContext currentContext()(Code)



currentTransaction
public static Transaction currentTransaction()(Code)



delete
public static void delete(T obj) throws PersistenceException(Code)
Deletes the object. If a transaction is opened this operation will be actually performed when the commitTransaction() method will be called
Parameters:
  obj - The object to delete
throws:
  it.biobytes.ammentos.PersistenceException -



delete
public static void delete(Class<T> c, QueryFilter filter) throws PersistenceException(Code)
Deletes all the objects of class c matching the provided QueryFilter. If a transaction is opened this operation will be actually performed when the commitTransaction() method will be called



diff
public static List<Field> diff(T obj1, T obj2) throws PersistenceException(Code)
Returns a "diff" report for the provided objects



getDataSource
public static DataSource getDataSource()(Code)
Returns the default datasource for this framework The default datasource



getDbConnection
public static Connection getDbConnection() throws PersistenceException(Code)
Returns a connection to the underlying database. The connection will belong to the currently used persistence context
throws:
  it.biobytes.ammentos.PersistenceException -



getMetadata
public static Metadata getMetadata(Class c) throws PersistenceException(Code)
Returns the metadata for the objects that belong to the provided class.
Parameters:
  c - The class to get metadata for
throws:
  it.biobytes.ammentos.PersistenceException - If the provided class does not contain valid metadatainformation The metadata for the provided class



getPrimaryKeyField
public static Field getPrimaryKeyField(Class c) throws PersistenceException(Code)
Gets the primary key field for the objects of the provided class
Parameters:
  c -
throws:
  it.biobytes.ammentos.PersistenceException -



intern
public static T intern(T obj) throws PersistenceException(Code)
Similarly to java.lang.String.intern() method, returns the internal, cached version of the provided object, if present; otherwise returns the same object and puts the provided one into the cache.



iterate
public static Iterable<T> iterate(Class<T> c, Query qry) throws PersistenceException(Code)



load
public static T load(Class<T> c, Object primaryKey) throws PersistenceException(Code)
Loads the object whith the provided primary key
Parameters:
  c -
Parameters:
  primaryKey -
throws:
  it.biobytes.ammentos.PersistenceException -



load
public static T load(Class<T> c, Object... primaryKeys) throws PersistenceException(Code)
Loads the object with the provided composite primary key. Values must be passed in the same order as in PersistentEntity declaration.



load
public static List<T> load(Class<T> c, Query qry) throws PersistenceException(Code)
Loads the objects which match the provided query. The returned list is unmodifiabale.
Parameters:
  c -
Parameters:
  qry -
throws:
  it.biobytes.ammentos.PersistenceException -



load
public static List<T> load(Class<T> c, QueryFilter filter) throws PersistenceException(Code)
Loads the objects which match the provided query.
Parameters:
  c -
Parameters:
  filter -
throws:
  it.biobytes.ammentos.PersistenceException -



loadDeeply
protected static boolean loadDeeply(Class<T> c, T obj, Object primaryKey) throws PersistenceException(Code)



loadUnique
public static T loadUnique(Class<T> c, Query query) throws PersistenceException(Code)
This method represents a shortcut for loading objects with queries when the expected return value is only one object. A persistenceException will be thrown if the query returns more than one value.
Parameters:
  c -
Parameters:
  query -
throws:
  it.biobytes.ammentos.PersistenceException -



loadUnique
public static T loadUnique(Class<T> c, QueryFilter filter) throws PersistenceException(Code)
This method represents a shortcut for loading objects with queries when the expected return value is only one object. A persistenceException will be thrown if the query returns more than one value.
Parameters:
  c -
Parameters:
  query -
throws:
  it.biobytes.ammentos.PersistenceException -



loadUpdatable
public static List<T> loadUpdatable(Class<T> c, Query qry) throws PersistenceException(Code)
Returns an updatable list of objects which match the provided query. By calling add() and remove() method on this list the objects will be respectively saved or removed from their persistor.



lookup
public static T lookup(Class<T> c, Object primaryKey) throws PersistenceException(Code)
Lookup the object of the provided class whith the specified primary key. This methods uses an internal caching mechanism which dramatically increases the performance, so use this method instead of load(Class,String) whenever is possible to obtain the best performance in retrieving objects.
Parameters:
  c -
Parameters:
  primaryKey -
throws:
  it.biobytes.ammentos.PersistenceException -



openContext
protected static void openContext(PersistenceContext context) throws PersistenceException(Code)



openTransaction
public static void openTransaction() throws PersistenceException(Code)
Opens a transaction to the datatabse. Each next call to save() method in the same thread will save objects into this transaction, until one between commitTransaction() or rollbackTransaction() is called. The isolation level for the created transaction is TRANSACTION_READ_UNCOMMITTED, what means that dirty reads are allowed.



openTransaction
public static void openTransaction(int isolationLevel) throws PersistenceException(Code)
Opens a transaction to the datatabse. Each next call to save() method in the same thread will save objects into this transaction, until one between commitTransaction() or rollbackTransaction() is called. The isolation level for the created transaction must be one between the constants defined for java.sql.Connection.



override
public static void override(T obj) throws PersistenceException(Code)
Saves the provided object instance, regardless the object is already present into the target domain. If the object is already present the call corresponds to a normale save() method, otherwise a delete() method followed by a new save() method is called.
Parameters:
  obj - The object to override
throws:
  it.biobytes.ammentos.PersistenceException - If any errors occurr while saving the object



removePersistenceListener
public static void removePersistenceListener(PersistenceListener listener)(Code)



rollbackTransaction
public static void rollbackTransaction() throws PersistenceException(Code)
Rolls back the current transaction. The cache of the objects involved in the transaction will not be removed.



save
public static void save(T obj) throws PersistenceException(Code)
Saves the provided object instance. If a transaction is opened this operation will be actually performed when the commitTransaction() method will be called
Parameters:
  obj - The object to save
throws:
  it.biobytes.ammentos.PersistenceException - If any errors occurr while saving the object



setDataSource
public static void setDataSource(DataSource source)(Code)
Sets the default datasource for this framework
Parameters:
  source -



validate
public static void validate(Class<T> c, T obj) throws PersistenceException(Code)
Validates the provided Object using its related validator
Parameters:
  obj -
throws:
  it.biobytes.ammentos.PersistenceException -



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.