net.sf.jmoney.jdbcdatastore

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 » ERP CRM Financial » jmoney » net.sf.jmoney.jdbcdatastore 
net.sf.jmoney.jdbcdatastore
This plug-in is complicated by the fact that it uses a mixture of cached and uncached lists. Even if a list is cached, the list is not read from the database until required. I.e. it is lazily read. But once read a cached list is maintained in a Collection object for as long as the parent object exists.

A weak map is maintained of all objects to ensure that only a single instance of a given object is constructed.

This plug-in caches everthing except the list of transactions in the session object. Note that it is the list, not the object class, that is cached or uncached. Though as the only list of transactions is in the session, this distinction is academic.

Entries are cached, but only while the transaction is in a materialized state. I.e. The entries are first read when the transaction is materialized AND the entries are iterated. The list is maintained in memory from then on. If there are no references left to the transaction then the entire transaction, including the entry list, is garbage collected and is removed from the weak reference map. As all updates (including new or deleted entries) to committed to the database when made, the transaction can be re-materialized correctly.

If a list is uncached then a query will be sent to the database each time the list is iterated. The weak reference map only prevents us from instantiating duplicate objects but does not save any database access as the required data has already been fetched in the query result set.

An uncached list MUST look to the weak reference map before materializing each object. A cached list keeps a list of all objects in the list (and therefore we do not need to look at the weak reference map, although all the objects will be in the map).

Scanning the transactions for entries that match a given criteria is not going to be the most efficient. The reason is that first a fetch of all transactions is required, then a fetch of all entries in that transaction. It may be more efficient to fetch both in a join, but to keep things simple this is not done. A special method is provided for fetching all entries in a given account. Other such methods may need to be added.

Java Source File NameTypeComment
AccountEntriesList.javaClass This class is used to get the list of entries in a given account.
IDatabaseRowKey.javaInterface An interface which all object keys in this plug-in implement. JMoney specifies that object keys must implement the IObjectKey interface.
JDBCDatastorePlugin.javaClass The main plugin class to be used in the desktop.
ListManagerCached.javaClass Every datastore implementation must provide an implementation of the IListManager interface.
ListManagerUncached.javaClass Every datastore implementation must provide an implementation of the IListManager interface.
ObjectKey.javaClass This class provides an IObjectKey implementation for objects that are persisted in a JDBC database. There are three constructors, one is used when iterating a list and a result set with all the required columns is available.
PreferenceInitializer.javaClass Initializes a preference store with default preference values for this plug-in.
PreferencePage.javaClass This class represents a preference page that is contributed to the Preferences dialog.
SessionFactory.javaClass This factory restores an open session by opening a JDBC database.
SessionManager.javaClass Manages a session that is held in a JDBC database.
UncachedObjectIterator.javaClass Class that iterates over a set of objects when the objects are not cached and thus must be read from the database.

Objects of this class are constructed from a result set that contains the properties for a set of objects to be iterated. This class implements the Iterator interface and will return the set of ExtendableObject objects.

Derivable property sets are not supported by this class; the property set must be a final property set.

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