Java Data Objects
Craig Russell, at Sun Microsystems, is the specification lead for JDO and David Jordan, at Object Identity, has been an active member of the JDO expert group since its inception.
Java Data Objects provides a thorough coverage of JDO and explains how it can be used in various architectures. The reader is expected to be familiar with Java but needs only a limited knowledge of databases. In brief, Java Data Objects (JDO) insulates you from needing to know a lot about databases. JDO permits you to develop applications using your preferred Java object-oriented model, without you having to write code to translate between Java objects and how the data is stored in the database--JDO takes care of all of that for you.
The first three chapters provide a high level overview of JDO by walking through a small application, exploring each of its interfaces at a high level, and introducing the architectures it might be used in. Even if you have been away from code for a while you will be able to follow most of the code example. You can stop here if you just want to understand what JDO is all about and where it can be used. These are recommended reading for a manager.
Chapters 4 through 9 are required reading if you want to start developing JDO applications. They really get you into JDO, so you can understand it and start using it. The first three of these cover how to define persistent classes and fields, how they can be mapped to various databases (done for you) and the class enhancement process (which makes a lot of JDO transparent to you). The next three (chapter 7 through 9) bring home the power of JDO. These cover how to connect with a database, establish a transaction context and create, read, query, update and delete database objects. The material is made concrete by illustrating it with a detailed and intuitive example application. This example is carried throughout the book with sections of it explained as the concepts are covered.
Each remaining chapter covers a different JDO concept or feature (including optional features) that were introduced earlier but not covered in detail to keep the earlier chapters more understandable. These remaining topics are identity, lifecycle states & transitions, field management, cache management, nontransactional access and optimistic transactions. You can read these chapters as you feel the need for a more in-depth understanding of these concepts.
The last two chapters explain how to use JDO in an application-server environment and an Enterprise Java Beans environment. These two chapters assume you are already familiar with these environments, but I think a lot of it is understandable even if you are not.
There are five appendices with everything from the lifecycle state transitions to the collected source code for many of the classes used in the example application.
You can purchase Java Data Objects from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Would it be possible to add the suggested retail price (MSRP) of a book in a review? :-)
Yes, it can be found by searching the web, but it's just extra comfort brought by a small database tweak.
The ENIAC Demo Competition
I've heard that JDO is much better, tighter solution to O/R mapping than EJB Entity Beans, that the latter are designed to be SO flexible that you can use them as a wrapper to your legacy mainframes, but the former is a lot closer to the problem most Java folks need to solve. Anyone know if that's a reasonable viewpoint?
(For the record, at this point I hate, hate EJBs. I think they're speficially responsible for the failure of multitudinous Java server projects, way to much overhead for 95% of all things you'd want to do in Java on the server, and the bad apple that risks spoiling the whole J2EE barrel.)
SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
First of all, I wouldn't want to hire that developer. Secondly, that is not entirely correct. O/R frameworks are useful in that they provide a consistent interface
I looked into JDO and was excited. Here was a much simpler alternative to EJB. In EJB there are many many things that can go wrong during deployment of beans which leads and quite a bit of replication. YOu define your object once in the bean, once in the remote interface, once in the local interface, etc. It seems to take a while to debug. JDO is better but it requires a class file enhancer. Hibernate is a lot better. There is 1 config file that defines your whole object model and it requires no special class file enhancer. That and unlike EJB it supports inheritance in object models well.
I know that sounds like a harsh statement to the uninitiated. I'll admit, the idea sounds good. But the implementation is a headache and maintenance nightmare.
I've worked with Java Data Objects for 3 years now, and everyone I know who has experience with it feels the same.
I read the title as "Java Android Complains".
according to slashdot, the user 'java1dev' doesn't exist. What does this mean?
it's not going to stop until you wise up, no it's not going to stop. so just give up.
I read this and thought that it was very much a downer on C++. In fact the authors even go so far as to suggest that Java is simply better in all but the rarest of cases. There is also a brief mention of JDK availability and also VMs in Red Hat, but I really didn't see how this was relevant.
I agree - anyone looking for a Java solution for database access that makes sense, instead of just following the latest corporate craze for cookie-cutter coding, should check out Hibernate.
Let's clear this up early.
Is it pronounced: JAY DUE
or: JAY DEE OH
I am concerned about learning another query language. Each has its limitations and that is why I was slow to adopt EJB-QL. EJB-QL is odd to learn and still not as feature rich as pure SQL. Now there's JDO-QL... yet another query language to learn. I found that in my previous projects, it is not that bad to embed SQL into DAO objects. You have complete power and control that way. You don't have to learn another QL, and you have the benefits of SQL.
I've said it once, and i'll say it again.
These book reviews on Slashdot, at times informative, really just are letting people know about the book and not as much reviewing that.
This demonstrated is that in the last two months, no book has received less than a 80% approval rating by the author (unless you rate a 'very good' as < 8). It's like Homer Simpson is writing these reviews, "This (book) gets my lowest rating ever, seven thumbs up."
I mean honestly, a review needs to have a few lemons on its record. I think someone should review a Wrox book on Linux and have it summarized with, "This book really gobbled the cob. it wouldn't be fit to line the kitchen floor for my puppy to soil in the evenings."
Instead of calling it 'Slashdot Book Review', it should just be called 'Slashdots list of books that rule'.
That's just my opinion though, I could be wrong.
Before you commit to JDO or entity beans, do yourself a favor and also look at OJB and Hibernate. Both of these object-relational mapping (ORM) tools offer unintrusive presistence to your existing beans (unlike Toplink and Cocobase which require you use their collection types) and don't require you to run a byte-code mangler like JDO.
Tell it which objects are mapped to which tables? And what about objects that map to multiple tables? Seems like you'd still have to have SOMEONE who knew how to do a proper database schema to set up your object structures and mappings, and make the database itself. :)
That said, this would free your developers from having to be intimately knowledgable about your database schema, which, if you have done any outsourcing, you would recognize the benefits of right away.
That is precisely the problem with the majority of non-JDO persistence architectures that use standard reflection (Toplink, Hibernate, CocoBase, Castor). While people tend to get nervous about bytecode enhancement, it is just an additional step in the compilation process.
Bytecode enhancement allows JDO to perform change tracking without intruding on the application. Reading 1000 objects in a transaction and changing a single one, a reflection based framework will need to perform comparisons on each and every field of each of the instances. JDO will just need to do a single one. Reflection-based persistence frameworks are fine for "hello world" applications, or if you do not mind intruding persistence details into the application, but for true transparent and scalable persistence, JDO is the way to go.
Of course, there are many other comparison points between persistence frameworks, such as the degree to which JDO is datastore-agnostic, the number of JDO vendors vs. non-JDO vendors, the issue of JDO being based on an increasingly important standard, the lack of vendor lock-in, etc. Many of these issues are discussed on JDOcentral.com
What has happened to anonymous coward? Also, why am I being nagged about a subscription at the top of all the stories?
this sig limit is too small to put anything good h
Is it me or do practically all the reviews posted come to the conclusion that the reviewed book was good/interesting/worth buying?
I guess it could be accounted for if the reviewers are paying for the book themselves - even if you do buy a book with the intention of reviewing it, you aren't likely to buy it if you think it isn't worthwhile. Unfortunately, while this might not always result in a biased review, it does make it harder to be negative, as well as cutting out on books that the reviewer doesn't like the look of to start with.
There are several Object-Relational mapping packages for Java out there. Hibernate is another one.
However, I have to say, that I have not found any complete O/R mapping package that implements everything transparently. In specific, I'm talking about recursive map structures, and "long transactions". Most of these packages are aimed towards short lived transactions on one object, or on a unidirectional tree of relationships.
I sunk absolutely OBSCENE amounts of time and effort into trying to make various packages work with a many-to-many self-recursive database structure only to realize it cannot currently be done with the packages out there. I would be glad to be proven wrong.
I would love to be able to keep a cache of a recursive map structure in memory (indefinately!) and have modifications automatically cascade the required updates to all nodes and revoke/expire any checked out nodes.
Finally I gave up trying to cache the actual structure in memory and now I just cache data, descend over the structure in the database for each request (it's not so bad, it turns out to be rather fast anyway).
It's 10 PM. Do you know if you're un-American?
Object-Relations Mapping isn't very new, even in the realm of Java. Apple, TopLink, CocoBase, have been there for years without JDO. I haven't had much time to evaluate JDO but I'd be surprised if it's as well designed or as comprehensive as Apple's Enterprise Objects Framework and EOModeler.
EOF is available with WebObjects which is a much easier way to build 100% Java web applications than any jsp/ejb solution.
in summary:
Object-relational mapping - good.
WebObjects/EOF - good.
JDO - undecided.
here here... ever see a shrink wrapped Java application which sells...? Ever see one on the shelves of Best Buy or Comp USA...? Ever see one that wasn't slower than molasses...?
Want to dedicate your valuable life learning a language totally controlled by Sun Microsystems...?
Java is a solution waiting for a problem... and not a very good solution at that!
Not a flame... just the truth.
I tried putting JDO in an app I was using. Seemed pretty cool initially. The OQL through me off at first. Despite being around for a really long time (10+ years), there was little documentation on the Object Query Language.
This got me into what I thought was the biggest problem. Too much abstration. JDO ran too slow for me. And rather than making things simple, it made them more complex.
Bottom line: Object databased and query languages have been around for a long time. Few people use the, prefering the relational model. Despite the fact that Object databases are sexy. There is a reason for the fact there are few apps built this way.
Well well well, you don't see shrinkwrapped Java applications because the focus of Java in the past few years has been in the server-side arena, where in Mid-Enterprise scale businesses it dominates.
I use several Java applications on the desktop that are NOT slower than molasses, IDEA from IntelliJ would be a perfect example. Maybe not a flame, definitely not the truth, but most likely a troll
While JDO is interesting, the Apache OJB (Object Relational Bridge) project is even better. It provides a JDO implementation as well as an ODMG impelemtation and a low level PersistenceBroker API. Lots of choice. More than one way to do things, allowing the developer to trade-off make trade-off when they are appropriate. It is fully transactional and supports the latest JDO as well as ODMG specs.
And it can be used to persist objects transparently...you can set it up to persist objects you already have and completely control how the object relation mapping takes place in a few config files.
We've used it on projects since November, and I don't think we'll ever go back to Entity Beans. This project allows you to choose when you would like to use byte code enhancment techniques (JDO) or reflection techniques(ODMG) or even combine the two.
Best of both worlds.
Never by hatred has hatred been appeased, only by kindness - the Buddha
Comparing is not the best way to go.
From what I've heard, Toplink is due to implement somehow the JDO specs in a few months.
Seems they are trying to change the spec (making the "code enhancement" feature optional), since enhancement is not the way they have chosen. And since they are backed by Oracle, their voice has become louder.
Probably there will be two levels of JDO spec : level one for Toplink, level 2 corresponding to JDO as we now know it.
Anyway JDO is the thing all Java developpers have been waiting for, especially those who have tried EJBs : a well designed framework. And the transactionnal cache feature (in some products, like Lido) may lead to excellent perfs for most apps.
Is Jdo a clone of Ado?
It seems to provide the same kind of functionality.
If sun was smart they would release newer libraries to compete with C#.net as well. You can create apps with similiar functionality like Microsofts petshop demo with 1/4th the code compared to java. Bussiness customers notice this. Especially if project deadlines are always a problem. The quicker something is done the better.
http://saveie6.com/
"Want to dedicate your valuable life learning a language totally controlled by Sun Microsystems...?"
.NET? The "write in any language we give you, but it's all the same and only runs on Windows" framework. Even C++ is basically controlled by MS now.
Ever heard of
From my experience, Java is much nicer for enterprise-level web applications than anything MS offers. As for desktop apps, it's fruitless to write desktop apps in Java when 95% of your customers are running Windows and MS has meager support for Java, at best. So you may not find Java apps on store shelves, but you don't have to look very hard to find desktop Java in the open source community.
Almost every program I run at work is Java-based and smokes the Windows-only counterparts most people use. So please don't go spouting your "truth" on something you know nothing about.
Personally I am in favor of (3). This allows to solve a problem mentioned by the parent - tracking object changes - with as little overhead as possible, and still keep your system clean OO. This is how Cayenne O/R Framework works:
http://objectstyle.org/cayenne/
This allows to track changes to objects as they occur, instead of doing a blanket analysis of all objects on commit. And in general this allows a better control of objects persistence behavior by the framework. There is another (commercial) product that uses the same approach: NeXT/Apple's WebObjects. The downside of (3) is that you must have a common superclass for all your business objects, but I still have to see the case when this is undesirable.
Andrus
Disclaimer: I am personally involved with Cayenne and therefore not impartial :-)
http://www.allianceonline.jp/productimgall/weblogi c.jpg
JDO is patterned after the very successful Microsoft ADO. Read the specs - every ADO function has an eerily similarly named JDO equivalent. Sun - the true innovators! (ha).
I've been working with JDO essentially since it was released, and have found it to be a very effective tool. As with any technology, it takes some time to learn, and it has areas which aren't as transparent as you'd like them to be.
I have always been the "JDO-guru" for my development team. As such, I've spent a lot of time trying to smooth out the various issues we've run into, so that other members of the team can work with this technology as transparently as possible. The main thrust of this work has been to make transaction handling easier, and to deal with PersistenceManagers. My company has been generous enough to allow me to open-source this work (which I've named "Stomp"), so if you are serious about using JDO, you may want to check it out. Even if you don't use the code here, there is a page explaining how Stomp works which describes the motivation behind this toolkit, the problems we ran into, and how we solved them. You'll have to solve similar issues yourself if you use JDO, so this might be a good way to get a handle on what you'll face when you use JDO.
This stuff works very well for us, but of course has the risk of being non-standard. Even if you don't use Stomp, the ideas presented may help you use JDO more effectively.
PS Stomp is written to work with Kodo (from Solarmetric) but could easily be made to work with other JDO vendors. Write to me if you are interested.
In EJB there are many many things that can go wrong during deployment of beans ... It seems to take a while to debug.
EJB development doesn't have to be that way. I agree, without the right tools, EJB development can be a painfully laborious exercise in bitter profanity - and that's just the "hello world" EJB.
There's generally two reasons for this - firstly, there's a lot of classes to create (and more importantly maintain). This is where XDoclet comes into its own. XDoclet is a real labour-saver and I recommend every EJB developer add this tool to their bag of tricks.
The second thing that can be painful about the EJB development process is that the edit-compile-test loop can be maddeningly slow. To run your application you generally need to set up an EJB container, configure it and then ou have to package the app in an EAR and then deploy your app to the container and... you get the idea. Some vendors have integrated EJB containers with their IDEs, but they still run at the speed of diseased livestock.
There's a couple of solutons to this - the free solution is to run JBoss and deploy your app to it (JBoss's hot deploy feature is nice for this sort of thing). I am one of the developers working on a better, albeit - commercial (but fairly inexpensive) - solution, Glider. The key thing about Glider is that it has an EJB container simulator so there's no separate deployment step, so you can compile and run/debug your code very quickly. Obviously, I'm biased, but I can honestly say I would use it even if I wasn't one of the developers who has worked on it.
Rob
here we go with the FUD again. "Mangler"??? I suppose you consider javac a "mangler" or aspectj a "mangler". I think the "mangler" you refer to is the bytecode enhancer. What you forgot to mention is what the "mangler" does. Rather than scare people off, I'd like to explain the clear advantage to bytecode enhancement over reflection for dirty detection. Let's say you do a query which returns a single object. Your application then modifies a single field of the object and commits the transaction. Before commit you have to perform "dirty detection" to find out what fields have been dirtied, and need to be updated in the DB. If you don't use an enhancer you have to compare the object, field by field, with either a cached copy of the object, or worse, issue a select into the database to get the old values. The latter is particlularly bad not just for the obvious performance hit, but because it forces the table or rows to be locked for the duration of the transaction, thus making optimistic transactions impossible. Now imaging your select returned 100 objects, or 1000 objects. With an enhancer, the bytecodes for 'putfield' and 'getfield' are replaced with calls to the bvendor provided state manager. The JDO driver knows instantly what fields were dirtied, needs to keep no cached copies and never hits the database with a select before update. Furthermore, with enhancement you don't force the user to extend any classes. There is zero intrusion on the domain model. I understand that Castor, Hibernate, etc. are good open source projects, and very viable. I do, however, think that JDO is elegant and has advantages, on paper at least, over other methods.
There is no java1dev user to be found on /.
This is probably just David Jordan (the author) reviewing his own work...
I don't understand why the the slashdot editors would allow a review that is so low on details to make it to the front page. I mean, this review sounds like it came straight from the book jacket.
Shrink wrapped, try Weblogic, websphere, JBuilder.
Speed, try JBuilder (every C++ user complains about how horrible java is, then they code in JBuilder, and bitch again. Then you tell them JBuilder is built COMPLETELY with java, not C++, and they don't believe you).
And Java is enormous in the enterprise setting (online banking systems, etc...). It wasn't meant to be something you sell in a store. Why? Too easy to decompile. Its mostly used in internal only or backend websites.
If you truely care to argue about this (instead of a blatant troll), I'd be happy to argue back.
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
Hibernate
It uses XML files to map between databases and Java. Good support for transactions, and more complicated cases.
A good overview can be found here...
From my experience, Java is much nicer for enterprise-level web applications than anything MS offers. As for desktop apps, it's fruitless to write desktop apps in Java when 95% of your customers are running Windows and MS has meager support for Java, at best.
Dude, you should see Java on MacOS X. It makes Java apps running on the Windows JVM look like native code. Even the SWT libraries of Eclipse run like molasses.
"First you gotta do the truffle shuffle."
When you can wait 14 years and get it for free?
Powered by onion juice.
The real solution is to use (1) ant (2) jboss. Ant can run thru all the steps from rebuild to deploy automagically, and jboss will sense the changed file and expand it into place. Tada! Your EJBs and servlets are ready to test. Try it.
Take a look at Project Colle.
I don't have any direct experience with JDO but it sounds similar. Project Colle (Colle-SQL) focuses on building, loading, indexing and accessing databases from an XML scheme.
If you want to get a technical feel for JDO, Solarmetric has an online document that covers all the spec basics here. It's not as in-depth as a full JDO book, but it covers JDO concepts pretty nicely in about 40 pages (if it were printed).
I was not trolling... why is java enormous in the enterprise and middleware setting..? Problems in this space can be solved in C++. Good C++ compilers are free. And the resultant product is invariably faster.
Why use another language if one already exists which can solve the problem..?
If C++ can get you in srinkwrap, on the shelf AND solve your problems in the middleware space AND in firmware AND... AND..., why turn to Java...?
In my opinion, there is no reason to turn to Java... I can solve any problem I am presented with in C++... or PERL (JCL in VM)... or the shell. These three tools work everywhere and can do anything. One of these three tools, or a combination of these three tools is the answer to any problem.
My time is valuable, I don't need another language...
The negatives I've heard from people in coversation are "they're not as fast", "there ae no tools", etc. BUt each of these are either false, not entirely true, or jyst due to immaturity:
Too slow Actually, because there is no impedance mismatch (converting from related rows into an Object, and converting the data types between disparate systems), they can be faster than an RDBMS. Where you might have to pull up a person record, and then their home address record, convert their homepage into a URL object, etc... in an OODBMS, your data is (can be) already in the proper Object format. You wouldn't needs things like JDO.
Tools no available Well, the haven't been around for as many decades as RDBMSs either. And, one of the other things that makes RDBMS tools so numerous is that they have a standard language, SQL. However, you must still rebuild what the data means in your reporting system separately from your online system. In an OODBMS, you would theoretically only build the Classes for the Objects once, and they would have with them the business rules.
Any thoughts? I'm not an OODBMS bigot, but I'm trying to be an advocate in the hopes that it will have some truly educational dialogue.
Because C++ doesn't solve the problem of writing your application on one platform, and running it on several others. I have an app that I write & maintain on w2k. It deploys on windows 95, 98, NT, etc, and Solaris, Linux, and AS/400. Is it possible to do that with C++? Not in the same way. I'm tried of coding a bunch of #ifdef WINDOWS in order to have portable code. Oh, and the COBOL jockeys never believed they would ever need another language either.
This isn't any ordinary darkness. It's advanced darkness.
Because C++ doesn't solve the problem of writing your application on one platform
That, again, is a matter of *SKILLS*
(see parent)
But, why not do without both EJB and JDO? I find JDBC is a fine interface. You don't really need an object-relational mapping. And for real applications you need to design the database by hand, and design the SQL transactions by hand. You can't get enough speed otherwise.
-- http://matteo.vaccari.name/
Right...
Doing things in a harder way than necessary shows how skillful you are.
This isn't any ordinary darkness. It's advanced darkness.
I guess we have different experiences... I, kind of, see the value in "compile once, run anywhere". If java can live up to this, perhaps it does have a place. I shall ponder this more.
But I still dread mastering another language. I'd like to have a personal life at some point.
Yes I believe you, because i have the misfortune of coding in Jbuilder - Yes in java - and i hunger for an ide that is a little more responsible to my commands
These days i make do with textpad when i can help it.
Before talking about jbuilder's speed, run the visual c++ 6 ide, or the visual java ide (now defunct but still gives you a feel of how responsive an ide can be), and see the difference (I dont know what happened for the VS.net because it is again painfully slow.)
another point, i am not sure how many people actualy use JBuilder for coding in c++ There are so many better IDE's available for c++? And who does not understand that it is not native :P i mean the difference is there for all to see - at least in windows platforms, the absence of native widgets is a dead give away,
I do my coding in a p3 in office and the p2 i have at home, recently i had the chance to try out one of the p4s. Even in these the response of this IDE is nothing to romp home about , It has become bareable that is all.
Perhaps you are fortunate to code in the latest p4's but not every one does it that way.
~561
I Don't blame you there... I've always considered java to be a subset of C++ anyway...
This isn't any ordinary darkness. It's advanced darkness.
Keep that than necessary out of it. It applies only to people who dare to invent the wheel again and again while writing C code. then necessary is "covered by" *SKILLS* either.
Are you confusing JBuilder with Eclipse? Eclipse can run slow as balls, no question, but JBuilder 8 (I started with 6 and worked my way up) is a dream to code in. With integration with everything from CVS to Sourcesafe (and you can code your own plugins, easily), it is the only way I like to code java.
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
Eclipse was one of the IDE's i tried and i liked its ability to manage the ant files. It is slower than JBuilder , but as i said I was not comparing JBuilder with other Java IDE's but with the IDEs that are implemented natively.
I had to start with JBuilder 5 and now on 8 but i prefer the faster native text editors to do the coding any time.
~561
More and more often these days, desktop and web applications need to display and interact with rich graphics. The Scalable Vector Graphics (SVG) format published as a World Wide Web Consortium (W3C) Recommendation in September 2001 is part of the response to that need. SVG allows you to describe two-dimensional graphics -- such as generic shapes, images, and text -- with an eXtensible Markup Language (XML) grammar. These graphics can be styled through Cascading Style Sheets (CSS) or XML, using advanced styling functionalities such as color gradients and filter effects. SVG is the W3C-recommended, XML-based, standards-based alternative to similar proprietary formats.
Link it to addall.
They even show how to link right to a book price search with ISBN, etc.. how to link.
Ryan