Aspects without AspectJby Daniel H. Steinberg
ONJava Newsletter for 01/15/2004
Most of the recent articles about Aspects have used AspectJ as the implementation. Aspects involve weaving new functionality into existing code without touching the original code. Graham O'Regan has chosen to explain aspect-oriented programming (AOP) "using Aspectwerkz because it is probably the easiest framework to learn and integrate into your existing projects." Unlike AspectJ, you will create an XML file that contains the advice instead of a file that looks like a standard Java class file. You will find his point cuts in his AOPServlet and what you do at that point cuts in the XML file. Graham gets you up and running quickly with a simple example in his "Introduction to Aspect-Oriented Programming".
In "Hibernate Your Data", Davor Cengija shows you how to use Hibernate "to persist any kind of Java object, to manipulate a hierarchy of objects, handle collections, and work with transactions.[...] It handles full transactions with commit and rollback, inheritance, a few types of collections, and it offers a very powerful object-oriented query language, HQL, which supports associations and joins, polymorphism, [and] subqueries".
The author leads you through a very complete introductory example. One nice feature of his style is that he shows you what can go wrong and how to fix these common beginning problems. Another thing I like that Davor does, which has nothing specifically to do with Hibernate, is he overrides the toString() method. This is such a simple, yet underused technique, even though it is often recommended. Download Hibernate and follow along at home.
This week's java.net article is the second in Joshua Marinacci's series on how to "Make Your Swing App Go Native." He shows you how to use Ant build files to "create native executables for Mac OS X and Windows, then add another native feature: file type associations." The associations allow you to double-click on a document and have the associated Java application start up.
The latest sponsored content from BEA Systems is Steve Hanson's "Returning XMLBeans from a Database Control". He notes that "not every consumer of a database control can consume every data type." He concludes that Java Arrays and XMLBeans "are universally consumable by both Web services, page flows, and other Workshop components". He then argues in favor of casting database data as XMLBeans because "(1) XMLBeans are consumable by all Workshop components, and (2) data in XMLBean form is very flexible and easy to work with."
To subscribe to the ONJava.com newsletter (or any O'Reilly Network newsletters), visit https://epoch.oreilly.com/account/default.orm and select the newsletters you wish to receive in your user profile (you'll need to log in with your existing O'Reilly Network account -- if you don't yet have an account, you'll need to create one).
To change your newsletter subscription options, please visit https://epoch.oreilly.com/account/default.orm and click the"Manage My Newsletters" link. For assistance, send help to
I'll be shoveling snow 'til we talk again,
Daniel H Steinberg, editor
ONJava.com and java.net