Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Java Data Objects (JDO): An Object-based Approach to Transparent Persistence : Page 4

For persistence storages, JDO provides a better and more efficient approach to application development.


advertisement

WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

JDO Query Example (cont'd)
PropertySearch was developed, debugged, deployed, and tested using Sun's Forte for Java 4.0 Enterprise Edition Early Access IDE environment. The Forte for Java 3.0 Enterprise Edition was used during the initial development steps. Hence, to compile, deploy, and run this application, you must use three tag libraries (dbtags.jar, ietags.jar, tptags.jar) shipped with Forte for Java. I used the PointBase database (the evaluation version is bundled with Forte for Java) to test PropertySearch (the database creation scripts are provided with the source code).

 
Figure 4 | Price-based query results from PropertySearch

Listing 1 illustrates how PropertySearch's queries work. The featured code snippet is from SearchPropertiesBean.java. It creates the database connection, constructs the query criteria, executes the queries, and sends the results back to the JSP page. To keep the listings short, only the relevant and interesting portion is listed.

As you can see, JDOQL enables you to dynamically build and execute complex queries using Java-like syntaxes. The readme file included with the source code has more detail on how to compile, build, deploy, and execute PropertySearch in a development environment. Figure 4 shows a typical PropertySearch query result where the user has specified the maximum price of the desired property.



With the JDO specification's easy integration with EJBs in a managed environment and effective use with servlets, JSP, and other J2EE server technologies, more and more J2EE container providers are going to adopt JDO to make their offerings feature-rich and standardized. The days of complete data "transparency" may come sooner than we think.



Shakil Ahmed is a senior software engineer at Sun Microsystems, Inc. He has a MS and BS degree in Computer Engineering from California State University and several years of software development experience in firmware, kernel, device drivers, mainframe, and enterprise software.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date