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.

 Avaya DevConnect Center
 Service Component Architecture/Service Data Objects Solution Center
 Intel Go Parallel Portal
 Internet.com eBook Library
 IBM Software Construction Toolbox
 Microsoft RIA Development Center
 Destination .NET
XML error: not well-formed (invalid token) at line 53
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%.

Is .NET on Linux Finally Ready?
Red Hat Takes on HPC Market, Microsoft
Python's New Release Bridges the Gap
No Flash Seen on iPhone Horizon
Apple Yields to Complaints Over iPhone NDA
Microsoft Shows Some Ankle With Visual Studio
Gentoo Linux Cancels Distribution
It's Official: Windows 7 at PDC, WinHEC
Oracle Keeps Building on Spoils From BEA
Intel, Oracle Head For 'The Cloud'

C++Ox: The Dawning of a New Standard
Getting Started with Virtualization
Master Complex Builds with MSBuild
eCryptfs: Single-File Encryption in Linux
CCXML in Action: A CCXML Auto Attendant
Ballmer: Current Woes Won't Halt Tech, Microsoft
Microsoft Uses VMworld to Hype Its Hypervisor
Microsoft Charges Ahead in Virtualization
Microsoft Shows Some Ankle With Visual Studio
Top 5 Reasons to Adopt SQL Server 2008

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
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES