advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Review: Interview: Bruce Tate on the "Politics of Persistence":

Interview: Bruce Tate on the "Politics of Persistence"

by Barry Burd

Barry Burd interviewed Bruce Tate at the No Fluff, Just Stuff Java Symposium. Bruce is the author of several books, including Bitter Java, Bitter EJB (with Mike Clark, Bob Lee, and Patrick Linskey) and the Jolt-winning Better, Faster, Lighter Java (with Justin Gehtland). In this interview, Bruce compares some of the major Java persistence frameworks.

Barry Burd (BB): Please introduce yourself to the Java Boutique readers.
Bruce Tate (BT): I'm a father, kayaker, and mountain biker from Austin Texas. My business, J2Life, focuses on lightweight development in Java and Ruby. My core competencies include design reviews in which I talk to customers, read code, and interview developers. I help the customer understand what's working and what's not working.

I also teach symposiums with No Fluff, Just Stuff. These are weekend symposiums with a little bit less marketing than JavaOne, and a lot less cost. What do you tell a customer who's comparing persistence frameworks?

Comparing Persistence Frameworks

BB: What do you tell a customer who's comparing persistence frameworks?
BT: I typically tell a customer to start with the simplest possible solution. The simplest is JDBC, but there are a couple of frameworks that wrap JDBC. The most important of the JDBC-wrapping frameworks called iBATIS (created by Clinton Begin of ThoughtWorks, which is Martin Fowler's company). The iBATIS framework differs from the typical object relational mapping framework in that you're mapping to the results of an SQL query instead of a relational schema. So iBATIS is very good for stripping away a lot of the junk that you deal with in JDBC frameworks. The iBATIS framework is good for people who know a lot about SQL but not quite so much about Java.

If iBATIS isn't enough, I try Hibernate. I like Hibernate because it's free and it has strong mapping support and excellent support in the open source community.

If Hibernate isn't enough, I move to something like JDO. My favorite JDO implementation is the SolarMetric Kodo product. I like Kodo JDO because it has the best mapping in the industry and the best manageability of the major persistence frameworks in the industry that I've tried.

Now there's also the emerging EJB3 standard—JSR 220. EJB3 is a redefinition of persistence pretty much from the ground up. With EJB3, you're starting to see a meeting of the minds between the EJB expert group the JDO expert group. The JDO expert group has a head start, so they've got more specification together. Of course, JDO has had nowhere near the political clout that the EJB group has.

I think the JSR 220 long-term vision is a merger of EJB and JDO into a combined persistence specification. So you're likely to see a little bit of the strengths of both platforms but, frankly, some weaknesses of both.

BB: What weaknesses do you have in mind?
BT: For JDO, the weakness is clearly political. The JDO group has never had the political clout of the major EJB players. And JDO has never had the customer base that EJB containers have shared.

On the EJB side, the EJB specification doesn't have the full power of the JDO mapping framework. EJB doesn't have fetch groups and some of the finer details that define how to make a request be lazy or eager. With JDO fetch groups, you can package a strategy not just for an entire application, but also for individual scenarios.

BB: Is it possible to mix-and-match the features of say JDO, Hibernate, and EJB to get a sufficiently simple "Swiss Army Knife" persistence framework?
BT: That's the intent of some JDO persistence solution providers. I talked to Neelan Choksi after he presented at JavaOne (Neelan is the president of SolarMetric). He said that SolarMetric's intent is to offer a framework that supports both EJB and JDO persistence, so that you can execute an EJB query language query within a JDO persistence manager.

BB: Do you think the mix-and-match approach can succeed? Can we have a persistence framework that's all things to all people?
BT: With the Spring framework, you can share a data source and some caching across iBATIS and Hibernate. You can have an iBATIS query and a Hibernate Query Language (HQL) query run side-by-side within the same transaction. You also have the ability to run SQL queries against a JDO implementation, and some JDO vendors are making noise about supporting Hibernate HQL queries. Essentially, you're seeing a mix-and-match of features today.

Different Tools for Different Jobs

BB: You're a big fan of dynamic languages such as Ruby and SmallTalk. Are ActiveRecord and the dynamic-language persistence frameworks fundamentally incompatible with things like EJB and JDO?
BT: ActiveRecord is a different design pattern. The Java design pattern handles persistence completely transparently. In the Java space, you would say session.saveAllTheObjects in a particular bucket. In the ActiveRecord world, you would say personObjectNamed(BruceTate).saveYourself. It's a subtle difference but it's an important one.

The dynamic languages help the ActiveRecord design pattern (at least the ActiveRecord implementation within Ruby). You can say: "I want this empty wrapper to point to a class called Person and I want to point this class called Person to a table called people." Ruby can look at the name of the class through reflection, and map the Person string to a string called people. Then it can look at a database table called people and dynamically add each column in the database as a property in the object model. Then, through meta-programming, you can also add methods to do your CRUD operations—creates, reads, updates, and deletes.

BB: You mention meta-programming. How does meta-programming vary from one framework to another?
BT: Meta-programming is having programs write programs. When you deploy an EJB application, the container actually does a code generation step. JDO uses bytecode enhancement which is basically code generation after an object has already been compiled (either before runtime or after runtime).

You can also use reflective techniques. You can use proxies and interceptors. You can put some of those techniques together with aspect-oriented programming, and you can add annotations to that mix.

BB: Which of these techniques do you favor?
BT: They are different tools for different jobs, so you might mix-and-match the techniques. For example, consider the Java 5 feature called annotations. Java 5 uses reflection to look inside an object and see the annotation values. Java 5 uses bytecode enhancement to push the annotation's parameters into the object. Different techniques are used for different problems.

I think that annotations and aspect-oriented programming are great ideas. Annotations might be very useful to make something transactional. But annotations and aspect-oriented programming will be misused over time. With annotations often we mix database object relational mapping data in the annotations. Sometimes that's not the best of ideas, because you often want to separate the object and schema from the mapping. We accumulate technology before we accumulate the wisdom to use the technology.

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 DevX Skillbuilding from IBM developerWorks
 Avaya DevConnect Center
 Intel Go Parallel Portal
 Internet.com eBook Library
 Microsoft RIA Development Center
 Destination .NET
XML error: not well-formed (invalid token) at line 48
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Apple Details iPhone/Mac Developer Event
RIM Ups Ante With Mobile Software Push
Novell Readies Silverlight Clone for Linux
Yahoo Pitches The 'Next Generation of Search'
Alfresco's Latest ECM: Prying Open a Sector?
SaaS Tool Offers Custom Database Development
Microsoft’s Automated Agent: Can We Talk?
Borland Finally Sells CodeGear
Red Hat Heads for the JON 2.0
Out with the Old, in with the New at JavaOne

Create Secure Java Applications Productively, Part 1: Use Rational Application Developer and Data Studio
.NET Building Blocks: Custom User Control Fundamentals
Secure Internet File-Sharing with PHP, MySQL, and JavaScript
Getting Started with TBB on Windows
Moving to VoIP: Should You Go It Alone?
Introduction to the WPF Command Framework
7.0, Microsoft's Lucky Version?
Will Hyper-V Make VMware This Decade's Netscape?
Eliminate Fragmentation Frustration with Netbiscuits
Taming Trees: Building Branching Structures

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES