Source Code Cross Referenced for DBQuery.java in  » J2EE » Enhydra-Application-Framework » com » lutris » appserver » server » sql » 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 » Enhydra Application Framework » com.lutris.appserver.server.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         * 
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site ( http://www.enhydra.org/ ).
008:         * 
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         * 
014:         * The Initial Developer of the Enhydra Application Server is Lutris
015:         * Technologies, Inc. The Enhydra Application Server and portions created
016:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017:         * All Rights Reserved.
018:         * 
019:         * Contributor(s):
020:         * 
021:         * $Id: DBQuery.java,v 1.1 2007-01-24 16:59:09 sinisa Exp $
022:         */
023:        package com.lutris.appserver.server.sql;
024:
025:        import java.sql.SQLException;
026:
027:        /**
028:         * Utility for querying object from a database.  Allocates connections from
029:         * the database connection pool, ensures the integrity of those
030:         * connections, and manages result sets after a
031:         * <A HREF=#query>query</A> is performed.  Returns objects representing
032:         * data in the database.
033:         *
034:         * <P>Example - querying a user:
035:         * <PRE>
036:         * 
037:         * 	import org.enhydra.dods.DODS;
038:         * 	import com.lutris.appserver.server.sql.*;
039:         *
040:         *      DBQuery dbQuery =
041:         *      	DODS.getDatabaseManager().createQuery(DATABASE_NAME);
042:         *      	
043:         *      // NOTE: class CustomerQuery implements Query { ... }
044:         *      CustomerQuery
045:         *          customerQuery = new CustomerQuery();
046:         *      String [] loginIds = { "customer1", "customer2" };
047:         *
048:         *      try {
049:         *          for (int idx=0; idx &lt loginIds.length; idx++) {
050:         *
051:         *              customerQuery.setQueryLoginId(loginIds[idx]);
052:         *              dbQuery.query(customerQuery); // query the database
053:         *
054:         *              // Print all query results.
055:         *              CustomerDO customerResult;
056:         *              while ((customerResult =
057:         *                     (CustomerDO)dbQuery.next()) != null) {
058:         *                  System.out.println("Customer name for " + 
059:         *                                      loginIds[idx] + 
060:         *                                     " is " + customerResult.getName());
061:         *              }
062:         *
063:         *          }
064:         *      }
065:         *      finally {
066:         *          // 
067:         *          // Return database connections used by
068:         *          // this object back to the connection pool
069:         *          // and free any other resources consumed
070:         *          // by this object.
071:         *          // 
072:         *          dbQuery.release();
073:         *      }
074:         *
075:         * </PRE>
076:         *
077:         * @author	Kyle Clark
078:         * @since	LBS1.8
079:         * @version	$Revision: 1.1 $
080:         */
081:        public interface DBQuery {
082:
083:            /**
084:             * Query the database.
085:             *
086:             * @param q
087:             *   Query interface via which the query will be executed.
088:             * @exception SQLException
089:             *   If a database access error occurs. 
090:             */
091:            public void query(Query q) throws SQLException;
092:
093:            /**
094:             * Returns a new object representing the next result form
095:             * the query.  
096:             *
097:             * @return
098:             *   New instance of object representing query results.
099:             *   <I>null</I> is returned when there are no more results.
100:             * @exception SQLException
101:             *   If a database access error occurs. 
102:             * @exception ObjectIdException
103:             *   If ObjectId was not found.
104:             */
105:            public Object next() throws SQLException, ObjectIdException;
106:
107:            /**
108:             * Frees all resources consumed by this query.
109:             * Connections are returned to the connection pool.
110:             * Subsequent queries via this object,
111:             * will throw an exception.
112:             */
113:            public void release();
114:
115:            /**
116:             * Exception handler.  This object is should not be
117:             * used for subsequent queries if this method returns
118:             * false.
119:             *
120:             * @return
121:             *   True if the exception can be handled and the object is
122:             *   still valid, false otherwise.
123:             */
124:            public boolean handleException(SQLException e);
125:
126:            /**
127:             * Method to ensure this object is still valid.
128:             * Once this object has been released it cannot be
129:             * used any more.
130:             * 
131:             * @exception SQLException
132:             *   If a database access error occurs. 
133:             */
134:            public void validate() throws SQLException;
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.