Slashdot Mirror


Hibernate - A J2EE Developers Guide

Simon P. Chappell writes with a review of the Addison Wesley-published Hibernate - A J2EE Developers Guide. "To quote the project website: 'Hibernate is a powerful, ultra-high performance object/relational persistence and query service for Java.' To quote the back cover of the book: 'Now there's a practical, hands-on guide to using Hibernate's flexible, fast object/relational persistence and query services.' Phew! What a lot of spin packed into two sentences. Let's take a look and see if it delivers." Read on for the rest of Chappell's review. Hibernate - A J2EE Developers Guide author Will Iverson pages 351 (13 page index) publisher Addison Wesley rating 7 reviewer Simon P. Chappell ISBN 0321268199 summary Overall a solid work

What's To Like

The first thing that I liked is the way the book is written. Mr. Iverson has a very pleasant writing style that I found engaging. Not too formal and not too light. Naturally, there is a certain amount of Hibernate evangelism, but hey, if the author doesn't like the tool, then how am I supposed to feel good about it either? The evangelism does not feel like it strays from the bounds of truth, and there is much honesty in his first and last chapters where he discusses reasons for using a tool like Hibernate, and how Hibernate has influenced the design of the soon-coming version 3 of the EJB standard from Sun.

Chapters two, three and four cover the basics of using Hibernate. Each covers a different aspect, and each is independent of the other. Chapter two covers the use of the Hibernate mapping file as the reference that everything else is built from. This is the recommended mode of operation, where the database schema and data access objects are built for you. Chapters three and four are for those of us in the corporate world where the code or the database schema comes first and we have to adapt to and accommodate it.

Chapters seven and nine give the database theory-challenged amongst us a useful refresher in database relationships and transactions. The information, while provided in the context of Hibernate, serves as a useful refresher for the rest of us.

Hibernate has three query mechanisms. Given its relational database capabilities, one of the options is the use of plain old SQL, naturally. The two remaining options are the Hibernate Query Language (HQL) and the Criteria API. The HQL gets a fairly decent amount of coverage and left me to infer that it is the preferred means of expressing queries. The Criteria API gets only four and a half pages of explanation, which is still more than the single page dedicated to SQL.

The next to last chapter is a collection of real-world advice and tips for getting the best from Hibernate. This is a very useful chapter and looks like it contains good advice. The only thing I would suggest is that it's a little slim for a chapter of its own. Either the information could have been tucked in an appendix, or it could have been spread through the book in the form of embedded tips.

Naturally, the book has a website to accompany it.

What's To Consider

The book carries a copyright date of 2005 and a first printing date of November 2004. That being said, it should come as no surprise that the version of Hibernate covered is 2.1.2, but at the writing of this review (early April 2005) Hibernate 3 went final. I feel that the majority of the concepts and basic operations will be unchanged, but take this into account when deciding upon a purchase. While it is difficult to write books against the constantly moving target of an open-source or free software project, it is possible. I was involved in the technical review of a number of Struts books and they were challenged with the task of being available as version 1.1 was released. A massive undertaking, but one that they proved doable.

The typesetting seems crowded in this book. I'm not a white-space extremist, but I sure recognise when there's too little. The listings are often multi-page and have a slightly squashed feel to them.

Depending upon your point of view, chapter five is either a very useful annotated explanation of all of the available mappings within Hibernate, or it's a bad case of using available online documentation as filler (53 pages). Personally, I dislike this, but if you're in the market for an "all-in-one" style of book, this might work for you.

Summary

This is a solid work that will take you from novice to a good working knowledge of Hibernate. If you can live with the fact that the book targets Hibernate 2.1.2 while the current production version available from the website is 3.0, then give this book a try.

You can purchase Hibernate - A J2EE Developers Guide from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

244 comments

  1. Chapelle? by blackmonday · · Score: 2, Funny

    I'm programming Java, bitch!

    1. Re:Chapelle? by Anonymous Coward · · Score: 0

      that's two Ps :)

    2. Re:Chapelle? by hao2lian · · Score: 1

      Is C++ going to have to choke a bitch?

      --
      Pelé!
  2. A few things... by FortKnox · · Score: 5, Informative

    Hibernate, first of all, is becoming the de facto persistance layer for all modern java webapps. Tied up with the Spring Framework for transactions and either Struts or Tapestry on the front end, it is becoming a commonplace for tons of Java work.

    This book, however, I found extremely lacking. It didn't really teach me anything new that I didn't already learn from the webpages. Granted, I've been using hibernate for over a year now and have kept up with the technology, so perhaps this is still a book for someone new to the technology.

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
    1. Re:A few things... by ChuckSchwab · · Score: 1

      A valid point. When we look at the relationship to the Windows/Linux debate, we see a lot of parallels though. For example, in both cases, one offers solid performance, while the other offers a high-quality paradigm. Regarding the book, I thought it had a lot of insights to offer about using Hibernate and Java.

    2. Re:A few things... by ChuckSchwab · · Score: 0, Offtopic

      I just want attention, man, can't you see? Normally I only post on topics in which I can contribute something, but this time I thought I could fake it well enough. Guess not.

    3. Re:A few things... by lewp · · Score: 1

      Man, you are one convincing bot.

      --
      Game... blouses.
    4. Re:A few things... by rossifer · · Score: 2, Insightful

      What I didn't like is the assumption that generating business objects from your mappings works well (or at all, in larger systems). I understand the argument for putting the business rules in the UI layer (Spring's controller objects, Struts actions) and letting the domain objects be simple DAO's, and I don't buy it for anything more complex than PetShop applications.

      If you're writing a toy application or a simple database report generator, sure. You don't need complex business rules and it's probably easier to let someone generate DAO's and push what limited business rules there are into the UI layer.

      If, however, you're writing a substantial business application, you've got four or five interfaces per deployment (UI, scheduler, import data API, erp interface, etc.). If all of those interfaces don't act against the same business rules enforced upon them, your customer's data is hosed and quickly. Anecdotally, all but one of the "data corruption" bugs in my last big project were from business rules that someone thought should go into the UI layer, and didn't get enforced for other interfaces, allowing usage of those interfaces to wreak havoc.

      The other approach I've seen for generated DAO's is to hang business rule implementations off of the DAO's via inheritance. Not only is this approach contrary to the goal of inheritance, it prevents you from actually having object oriented classes. You'd better not try to have polymorphic behavior in those classes. The kicker with this approach is that your business rule classes are just as complex as if you'd simply written good domain objects in the first place, meaning that the generation has bought you no reduction of effort.

      "The overhead of maintaining separate artifacts." is wildly inflated. The system details are there, whether conflated into the same files or separated into different files. You also have fewer artifacts if you don't separate interface from implementation. You also have fewer artifacts if you combine several classes into the same .java file. Fewer artifacts != lower cost of development/maintenance.

      Regards,
      Ross

    5. Re:A few things... by dnoyeb · · Score: 1

      I have such a complex applicaiton. I recently refactored to make my DAOs stateless. I already had my logic in other objects where it shoudl be.

      dividing the responsibility of an object is fundamental to OO programming.

      Just because the rules are not in the dAO does not mean the end up in the UI. Add another layer.

    6. Re:A few things... by LoztInSpace · · Score: 1

      A lot of good points. To pick up one one - the whole "data corruption" problem - that, IMO, stems from a blinkered approach to systems design. Enforcing business, data rules & integrity in the database seems to have been forgotten. This is a shame because it is far an away the best place for them providing virtually all the functionality of the shiny new application servers we're using today. Tools for the job! Applications and interfaces come & go. Data is for life. Look after it properly.

    7. Re:A few things... by akookieone · · Score: 1

      absolutely.

      A DAO hould not have business rules, and neither should the UI, the previous post was just rididulous to suggest otherwise - clearly, they don't understand the DAO pattern. Here's a decent reference from the much maligned java blueprints: http://java.sun.com/blueprints/corej2eepatterns/Pa tterns/DataAccessObject.html

      BTW - I read and use Hibernate in Action, and that is a book worth buying.

    8. Re:A few things... by danharan · · Score: 1

      Business rules in the UI layer? WHAT? That's a recipe for disaster. Add another layer. Spring controllers and Struts actions should *NOT* contain business logic, but call objects that do. They in turn can talk to the db.

      --
      Information: "I want to be anthropomorphized"
    9. Re:A few things... by rossifer · · Score: 1

      From memory, and from the link you posted, the DAO pattern is a way around the limitations of JDBC by placing the work of keeping the objects and database synchronized. Which is what Hibernate does. Once you have Hibernate doing the heavy lifting of getting the data in and out of your business objects, why in the world would you want to deal with the forced compromises of the DAO pattern any more?

      DAO's aren't objects, or are at best, badly designed objects. You can't use encapsulation with them, the utility of inheritance (polymorphism) is either lost or becomes very difficult (since your business methods are elsewhere), et-cetera.

      Rather than have DAO's and a separate business rule layer, just design good domain objects and forget all about DAO's. Polymorphic behavior returns! Encapsulation of data! The option to separate your interface from your implementation!

      DAO is one pattern whose time has come and gone.

      DAO does have one advantage. And for some teams, it appears to be critical: the "non-OO" approach to class design means that mediocre/poor programmers don't need mentoring to assist with the development and to keep maintaining the system.

      One of my clients insisted that they had to be able to hire an army of VB-coders to extend their application. I tried to talk them into a smaller team of skilled developers but they were adamant with their desires. So we found a Perl codegen system, whipped up a framework with some C# DAO's for them and off they went. It was one of the most lavishly expensive processes I have ever been witness to.

      Their competitor with five A-players on the team absolutely trounced their product in the market. Though it's hard to entirely fault the "hire an army" mentality for their failure, I can't see that their goal of making it easy for crappy developers to add code helped them at all.

      Regards,
      Ross

    10. Re:A few things... by rossifer · · Score: 1

      Business rules in the UI layer? WHAT? That's a recipe for disaster.

      Exactly.

      Domain objects with business rules, Hibernate builds the DAO's behind the scenes, UI presents the data from the domain objects to the world.

      I'm objecting to going through the effort of describing DAO's for Hibernate to synchronize with the db and then having another place for your business rules. Hibernate takes care of the same problem that DAO's purport to solve and does without me needing to do anything other than maintain an xml file.

      Spring controllers and Struts actions should *NOT* contain business logic, but call objects that do. They in turn can talk to the db.

      Sounds right to me.

      Regards,
      Ross

    11. Re:A few things... by rossifer · · Score: 1

      dividing the responsibility of an object is fundamental to OO programming.

      Exactly. Let Hibernate build the DAO's for you behind the scenes. Those will manage the data in and out of your domain objects (that can then focus on enforcing all of the business rules) and all you have to do is maintain an .xml file (if that).

      Don't build yet another DAO layer for Hibernate to manage with Hibernate's automatically generated DAO classes. The DAO pattern doesn't let you use encapsulation, effective inheritance, or a host of other central design tenets of object-oriented programming. Your domain objects should have the benefit of object-oriented design and you shouldn't trade that off because someone told you the DAO pattern was still relevant.

      Hibernate does what the DAO pattern claims to do and does it better. Having Hibernate manage your own DAO types is adding layers for the sake of adding layers.

      Regards,
      Ross

    12. Re:A few things... by carnivore302 · · Score: 1

      This book, however, I found extremely lacking.

      Then try Hibernate in action (but if amazon prompts you to buy Hibernate : A Developer's Notebook as well, skip it. The latter is a typical beginners book. I had the misfortune to buy them both AND read Hibernate in Action first, only to find out that reading the other is useless after that)

      --
      Please login to access my lawn
    13. Re:A few things... by broward · · Score: 1

      Hibernate is a meme rocket.

      ahref=http://realmeme.com/miner/java.php?startup=/ miner/java/databaseDejanews.pnghttp://realmeme.com /miner/java.php?startup=/miner/java/databaseDejane ws.png>

      As near as I can tell, it has no competition.

    14. Re:A few things... by MemoryDragon · · Score: 1

      It has not been forgotten, but people moved away from it due to vendor lock in problems. If you have to pay the annual (fee free to add whatever really expensive database system exists here) fee and you can get cheaper alternatives which meet your needs as well, then you are in a real mess with putting lots of application code onto the database server. The movement away from this has been going on since the early ninenties, and DB vendors fought left and right to keep the lockin by not implenting newer SQL standards, but after 10 years much of this torpedoing has been nullified by abstraction libraries moved into the db mapping domain of things. But as you said there is a problem with the current approach as well, the whole integrity checking is now in the application domain (often even casacded deletes) so you really have to be careful.

    15. Re:A few things... by Anonymous Coward · · Score: 0

      I like the DAO pattern.

      For me DAOs are just an access level for the database that are very well organized, and simple, thus very easy to maintain and replace (especially when used with Spring's dependency injection and programming to interfaces).

      The DAOs are all in one package, and use hibernate as a backend. The package acts like a limiting wrapper around hibernate. It keeps objects from accessing actions that they don't need. Due to hibernate, more than half the methods are like 1-2 liners.

      So, the layer is simple, small, easy to maintain, replacable, and independent enough from the other layers that I don't need to go line hunting when I change a DAO.

      The business layer takes care of all business logic like validation, and such. The presentation layer takes care of presenting the data. The only thing tying these layers are value objects and interfaces. The part I really like is I can make a new presentation layer to present to the web or cell phones and not have to touch the other two layers!

    16. Re:A few things... by rossifer · · Score: 1

      The DAOs are all in one package, and use hibernate as a backend. The package acts like a limiting wrapper around hibernate. It keeps objects from accessing actions that they don't need. Due to hibernate, more than half the methods are like 1-2 liners.

      So, the layer is simple, small, easy to maintain, replacable, and independent enough from the other layers that I don't need to go line hunting when I change a DAO.


      Well, in this case, it sounds like your domain layer is simple enough that the trade-offs between the various persistence patterns lose a lot of significance. I don't mean to belittle your project, here. In my experience, different things are significant for a 20 class domain layer than for a 200 class domain layer and that shouldn't suprise anyone.

      In the application I'm currently working on, there are already 240 distinct persisted types in the system, (role-based access control, personal information, financial information, admin logic, document management interface, core application, extension #1, extension #2, etc.). An approach to business rule management that makes it easier to maintain highly disparate business rules across 15-20 packages becomes critical. When the domain objects (what Hibernate manages) are "safe", as in, they don't allow illegal states to appear, the rest of the app can do a whole lot of relaxing and focus on making the system look good.

      Regards,
      Ross

  3. Re:Hibernate by BarryNorton · · Score: 0, Offtopic
    It's what you do while your Java program runs.
    It's an interpreted language? OMG, where have I been the past decade? Thanks for the heads up...
  4. Not Interested by KidSock · · Score: 0, Redundant

    Whenever I see "is a powerful, ultra-high performance" I just stop reading right there. Excess positive adjectives are a sure-fire sign of misrepresentation.

    1. Re:Not Interested by That's+Unpossible! · · Score: 3, Funny

      Yours was a powerful, extremely engaging post that I found chock-full of interesting and insightful commentary!!!

      --
      Ironically, the word ironically is often used incorrectly.
    2. Re:Not Interested by Shadow+Wrought · · Score: 1
      Excess positive adjectives are a sure-fire sign of misrepresentation.

      They are ultra-double-plus-ungood.

      --
      If brevity is the soul of wit, then how does one explain Twitter?
    3. Re:Not Interested by FortKnox · · Score: 2, Informative

      Actually, this is one technology that kinda lives up to the hype. Its an ORM that performs (in most cases) as fast as hand-written sql statements. I call that powerful and ultra high performance...

      --
      Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
    4. Re:Not Interested by dubl-u · · Score: 1

      Whenever I see "is a powerful, ultra-high performance" I just stop reading right there. Excess positive adjectives are a sure-fire sign of misrepresentation.

      Excess knee-jerk negativity, however, is usually perfectly accurate.

    5. Re:Not Interested by espressojim · · Score: 2, Interesting

      High performance? I'm curious, as I'm heavily thinking about shifting from handwritten SQL and the Spring framework to hibernate. I do scientific research, and pull large data sets (.1 - 5M rows) out of a database to operate on.

      Often, without carefully tuning these querries, I'm getting horrible performance. With well tuned querries (and appropriate indexing), performace is acceptable. If hibernate was smart enough to say - build anonymous views then join on them when it was a benefit to performance - then I'd be interested. If hibernate was smart enough to aggregate multiple rows of data down to a single row to map onto my summary data objects, I'd be interested. If I'm simply pushing the problem off to another framework, then I'm not sure if it buys me anything over my current methodology.

      So, how well does hibernate handle the really complex query work?

    6. Re:Not Interested by Jonny_eh · · Score: 1

      Why punish the hard working engineers who make these products for having overzealous marketing dweebs go over the top?

      You might be punishing yourself too by missing out on a potentially useful product. I personally just filter that marketing garbage out.

    7. Re:Not Interested by scrotch · · Score: 3, Insightful

      Well, Hibernate isn't an SQL writer. It's for translating between RDBMS and Objects. It's very good at persisting objects and getting objects from a database. It's very good at pulling large graphs of associated objects, which is a pain in the ass to do manually and difficult to do well (for me anyway).

      Although it's possible to do summaries, it's not what it's for primarily. I think you'd be better off polishing up your SQL rather than learn Hibernate if that's what you're doing. Not that it would be any worse than what you're doing now (you could run the same SQL through it), it just seems like you could get bigger improvements from the time you'd spend learning it.

    8. Re:Not Interested by hexghost · · Score: 1

      Hibernate can, but not for you "out of the box". Since its easily expandeable though, you can write custom hibernate types that might handle what you need to do.

    9. Re:Not Interested by Java+Realist · · Score: 1, Flamebait

      As fast? Ha! Simple queries by an organization that I work with developed some hibernate applications. These queries run generally 2-3 seconds slower than hand-written SQL statements. By the way these hand-written queries were finished within 2 seconds. Does anyone know if Hibernate can still ONLY JOIN two tables? They should have MEGA ultra high performance if they can finally do more than that. What kiddy applications are you all developing in which you only join two tables? And HQL? Wow that's a great feature. Having to learn a mini language that looks almost like SQL and does the job of SQL. Anyone ever heard of DAOs and how they can abstract away the native SQL code and yet still maintain performance? It's time to destroy the hibernate hype...

    10. Re:Not Interested by espressojim · · Score: 1

      Or, I could continue developing my research apps, as I can do all the SQL work without issue.

      I would be interested in creating large object graphs at will easily, as I do that as often as I do summaries. I do find that if I'm going to pull those graphs, sometimes writing queries in specific ways will get me vast improvements.

      Oracle is annoying, in that sometimes two queries that look very similar can have different performance - sometimes 'forcing' the oracle query runner to pick a certain place to start earns you good performance gains.

      This occurs often if you have a dimension table that you select one item from - say you select "bob" from the dimension table, and join to some other table. Oracle will think that's selective - even though the other table uses "bob" for 60% of its rows. You also join to that table on some other FK, which is much more selective, but doesn't look as selective to oracle, so it starts in the 'wrong' place with the query tree.

      I'm curious as to how well hibernate performs under these areas. But, it sounds like it's well worth fooling around with, and teams that I work with/near have adopted it, so it's probably good to learn (even if I just put it on my resume and have another tech to say "been there".)

    11. Re:Not Interested by Anonymous Coward · · Score: 0

      Does anyone know if Hibernate can still ONLY JOIN two tables?

      When was that the case? Do you even know what you are talking about?

    12. Re:Not Interested by FortKnox · · Score: 1

      Troll. From version 1, hibernate was capable of joining multiple tables. Its in its very nature if you have any many-to-one relationships without lazy loading.

      --
      Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
    13. Re:Not Interested by Evil+Grinn · · Score: 2, Insightful

      And HQL? Wow that's a great feature. Having to learn a mini language that looks almost like SQL and does the job of SQL.

      Yeah, but you can't blame Hibernate for that idea. The whole Java world seems to love pseudo-SQL: EJB-QL, JDO-QL, etc.

    14. Re:Not Interested by LoztInSpace · · Score: 1

      OT, but if your statistics are up to date then Oracle should pick the most selective index (assuming it's going to use one at all). I would consider speaking to your DBA and making sure the stats are current.

    15. Re:Not Interested by Anonymous Coward · · Score: 0

      HQL is almost identical to SQL for most basic queries, and the difference only lies on its ways of handling JOINs. In HQL when you join two "tables", Hibernate works out what to join on what, and basically eliminates the need for the join "ON f1 = f2" clauses.

      I wouldln't say I had to "learn a new mini language", or at least it wasn't a setback to using hibernate. Heck, the EBF of HQL is only one page last time I looked at it.

    16. Re:Not Interested by MemoryDragon · · Score: 1

      But in case of Hibernate the description is really true. I have worked with many persistence layers in the past, (self written ones, Torque, some provided by the company I worked for, and Hibernate basically is the best there is, and one of the fastest. I worked with an OODB system years ago, they had so many open corners, like a lousy query language, no control over the object scope, no possibility to handle large amounts of object (you always heared that there is a flaw in the object design until they gave the hint, reverse the queries) Hibernate has solved all those things. I just wished there already was an ide, which binds JSF, Spring and Hibernate into a graphical editor, this ide would be a clear winner. Sun goes for raw JDBC , neglegting any sanity there is regarding session scope, oracle also goes for JDBC and IBM I have not seen yet (probably also does for JDBC) the other IDEs either only give helper tools to raw code with some visual editors but no database bindings, ore dont do anything.

    17. Re:Not Interested by MemoryDragon · · Score: 1

      Hibernate should not have any problems in this regard. Hibernate follows usually in its approach following strategy. Give the developers the tools for one approach which follows some standard practices, if those work out for all leave it that way, if not add a second or third way to cover the rest of the 10%,

      In case if your problem you might have to go for following solutions, Iterators can handle the dataset load, maybe paging (dumping 1.5m objects into the object heap is not really preferrable) and as for the queries, hibernate has a query caching system which you can turn on optionally, so even if you thing you run a ton of queries you only might send a handful of real queries to the database... If you want to process the data parallely, you might run several app servers and have a clustered cache.

    18. Re:Not Interested by MemoryDragon · · Score: 1

      Well hibernate is very dependend on the database being beneath it, so if your database design already is excellent you probably will not get any better performance, with lousy databases you might sometimes get better performance due to the excellent caching hibernate has. But dont expect wonders. You wont get any OODB all you get is an OODB-RDB layer, but one of the best there is.

      (I dont expect anything decent from JDO, since it is done by former ODMG people and DB vendors which shy interoperability like the devil shies holy water are sitting in there, that was one of the reasons why the ODMG standard was one of the lousiest ever in existence and basically rendered databases which relied entirely on it useless) But the JDO specs might prove me wrong in the long run, I somehow doubt it though once Oracle and others get a serious vote in the specs.

    19. Re:Not Interested by MemoryDragon · · Score: 1

      Design issue... The guy made a mistake in the DB design (you also can see it at the SQL statements) read the comments down the posting, one of the guys does explain it.

      He basically set's three foreign key 1:1 relations but has forgotten about adding the key colums on one side of the relation. Why the db itself did not check that is weird to me, normally dbs cry at such situation at creation level.

      This is definitely not a Hibernate issue, and if you could read more than three lines or would have bothered to read the topics you would have read the answer as well.

    20. Re:Not Interested by MemoryDragon · · Score: 1

      Actually it is there for a reason, there is a SQL standard which is broken by many databases see that as a vendor lock in, also if you want to stay in an object scope you cannot stay in SQL. There were earlier attempts to resolve the SQL-Object scope discrepancy but they did not work out too well. OQL basically gives you a big amount of database independency and resolves many of the how do I map SQL into the object realm problems very well.

    21. Re:Not Interested by MemoryDragon · · Score: 1

      Yes joins are very OO like in hibernate all you do is:
      objecta.relation1.relation1 do whatever you wantwith it
      That was basically the only part of the OQL which I really loved which hibernate based the HQL upon. You dont have to care whether the DB joins or subselects it you ara in a plain object scope for this.

    22. Re:Not Interested by espressojim · · Score: 1

      I spoke with the DBA, as well as our resident database architect. The DA was the guy who helped me shape a few querries in the not-as obvious methodology.

      Also, if you want to do something interesting, like join 3 tables together, create a summary of those, then link to dimension tables from that summary - it's better to do the summary as an inner view. That way, you join on a smaller number of rows as you link to each dimension table. If you don't, then the summary step comes LAST, and you wind up doing joins on all the dimensions with the full rowset. It's a HUGE difference in performance (think: 15 seconds vs. 2 hours).

      Things get interesting when you're working with huge data sets.

  5. fun with connotations by happymedium · · Score: 0, Redundant

    "I'm not a white-space extremist."

    (Did anyone else almost misinterpret that?)

    I don't know, you never can tell how crazy far-right those Java programmers are... them and their "non-free" interpreter. I for one thought we lived in a more enlightened time.

    1. Re:fun with connotations by yogikoudou · · Score: 0

      "I'm not a Whitespace extremist."

      (Did anyone else almost misinterpret that?)

  6. Coverage, it's not just for subjects. by Anonymous Coward · · Score: 0

    Isn't 351 pages a bit lightweight, for a complicated subject.

    1. Re:Coverage, it's not just for subjects. by metamatic · · Score: 1

      I was thinking exactly the opposite: how the hell can it take 351 pages to describe how to use an object persistence library? Either the book is really padded, or the library must be really badly designed.

      (Or both, of course.)

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    2. Re:Coverage, it's not just for subjects. by Anonymous Coward · · Score: 0

      agreed.

  7. Re:Hibernate by rel4x · · Score: 2, Insightful

    Yeah, really, it's not that bad. As a Java programmer, I've come to find out as long as you make sure you don't use more memory than you need (i.e. nulling variables that are no longer useful), things run fine... ...correction. Things run fine so long as you don't use Swing. Swing needs a serious makeover (yes I'm aware of alternatives, but Swing just looks so dang cool when it works)

    --

    Before you mod me funny, think, perhaps I was insightfully funny?
  8. Is it better than Hibernate in Action? by Babar · · Score: 5, Interesting

    I can't believe a review of a book about Hibernate would not compare it to the book everyone recommends, Hibernate in Action. HiA is a great book, written by people who work on the project, including the lead developer. Of course, this review doesn't have much information that couldn't be obtained from skimming through the table of contents on Amazon.

    1. Re:Is it better than Hibernate in Action? by mrtom852 · · Score: 4, Informative

      Hibernate in Action is the best available I think. I flicked through "Hibernate: A J2EE Developer's Guide" in a bookshop and didn't think it would teach me much - however it might be a better book as an introduction to hibernate. (It certainly looked better than "Hibernate: a developer's notebook")

      I did like HiA but it still left me wanting more. A lot of the book spent time talking about common design patterns where I would have liked to see a bit more Hibernate/DB theory.

    2. Re:Is it better than Hibernate in Action? by d95adam · · Score: 2, Informative

      Here are the other Hibernate books I've read (or skimmed):

      Hibernate: A Developer's Notebook
      Hibernate: A J2EE Developer's Guide (Addison Wesley))
      Java Open Source Programming: with XDoclet, JUnit, WebWork, Hibernate

      But they all fall short of Hibernate in Action imho.

    3. Re:Is it better than Hibernate in Action? by MemoryDragon · · Score: 1

      Dont forget the hibernate handbook on the Hibernate site. Hibernate is one of the best documented frameworks there is, thanks to the excellent documentation which is done by the Hibernate people themselves.

    4. Re:Is it better than Hibernate in Action? by Anonymous Coward · · Score: 0

      But realize that the style of Hibernate in Action is very much a discussion that meanders across various concepts at the same time. The online reference manual suffers from this to great deal as well ... but then it's free. Both also suffer from a fair amount of "a foo is a foo" type definitions.

      This book has its merits, but Hibernate is missing a good book that explicitly covers functionality bit by bit and in depth. Put like material next to like instead of scattering nuggets of wisdom throughout the book. We need not quite a reference book, but preferably a less "story" oriented book.

  9. Re:Hibernate by Swamii · · Score: 1

    Java isn't entirely interpreted anymore. In fact, much of it is just-in-time (JIT) compiled to machine language, meaning when you're about to run some Java code, the Java Virtual Machine compiles the byte code to native code on the fly.

    FYI, the various .NET/Mono languages are all JIT'd, zero interpreting. Java is much the same now, it was just originally designed to be an interpreted language.

    Also, .NET/Mono have ahead-of-time (AOT) compilation, meaning you can compile your dll libraries or exe applications to native code at install time.

    --
    Tech, life, family, faith: Give me a visit
  10. 3 Letters: by elid · · Score: 1

    SWT

  11. Re:Hibernate by therodent · · Score: 1

    Problem is, swing has been that way since the first time I saw it, in 1998!

    I know the guy who did the swing grid control -- friends and I used to give him shit all the time for how slow it was.

  12. Java never got a fair break. by Future+Man+3000 · · Score: 3, Interesting
    People tend to notice its flaws (oh it's so slow!) because it's the first iteration of its technology, but it is still an excellent tool for getting the job done regardless of its platform.

    Is it going to be replaced by C#? Perhaps, but it is possible to fully exploit it today, and with tools like Hibernate it's possible to rapidly deploy applications on a grand scheme. In today's business environment it is often a matter of getting it done fast rather than best, and if it's turning into a problem with performance it is always possible to turn to another language once you have something in place.

    --

    I never vote for anyone. I always vote against.
    -- W.C. Fields

    1. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      First iteration? Java has been through something like five iterations. Perhaps people are criticizing Java because it was poorly designed and rammed down peoples throats with tens of millions of dollars of marketing money. How many iterations did it take for them to figure out that OO needs introspection (2 or 3?), that asynchronous IO is necessary (4), that their native code interface is crap (??.)

      There are a lot of good programming languages and Java isn't one of them. Unless you think your only other option is C++.

    2. Re:Java never got a fair break. by customiser · · Score: 2, Informative

      The main use of Java today is in large scale enterprise applications, usually meaning J2EE, although the current trend is the use of lighter alternatives, namely JSPs/servlets coupled with frameworks like Spring and Hibernate.

      This development itself proves the big advantage Java has over C#/.Net in the enterprise arena: a far wider array of supporting libraries and frameworks, not to mention a selection of mature application servers. For this reason it will be quite hard for C# to catch up, especially since it does not bring anything remarkably new or unique to the game; it is just too similar to Java for a switch to be justified.

      As to whether "traditional" enterprise systems built in Java are "done fast"... Let's just say that its biggest drawback (always in the enterprise context) according to its opponents is the sheer complexity of developing, configuring and deploying any application of reasonable size. Hence the appeal of frameworks like Hibernate.

    3. Re:Java never got a fair break. by Hard_Code · · Score: 5, Insightful

      Even in the presence of CLR/C#, I think Java will continue to be very strong and popular. Some things are cumbersome and awkward in Java, granted it has its warts, but on the whole it is very "ergonomic". There is a gigantic amount you can do in Java that will be easily understandable and maintainable by other Java developers. Your options are limited, but that's a feature. JDK 1.5 (ne 5.0) did expand the language a bit with generics, and there has been a lot of controversy over that, but on the whole Java remains rather simple, and a massive amount of libraries have been developed for it, many of which are continually folded into the core.

      --

      It's 10 PM. Do you know if you're un-American?
    4. Re:Java never got a fair break. by Rakshasa+Taisab · · Score: 1

      I tried to give it a fair chance, but then i found that it had no unsigned data type... I'll stick to C++, where we got real types and real templates. (none of that fake stuff java/C# does)

      --
      - These characters were randomly selected.
    5. Re:Java never got a fair break. by Lysol · · Score: 2, Interesting

      Is it going to be replaced by C#? Perhaps,...

      Doubtful. I'm sure C# will get quite popular, but neither that nor will Mono have a foothold on the server like Java does anytime soon. Java's tools and microcosm of open and closed projects are being used by quite a bit by companines and organizations doing real, every day work. Granted, Java on the desktop never took off, but the whole C# vs. Java war is just a myth - there's plenty of room for both to exist.

      I'm using Hibernate on my current project and while it's not the be all/end all, it's definitely a better approach (I feel) than EJB entity beans. 99% of my current data layer is Hibernate code/classes and I'm pretty happy with it. Coupled with various plugin caches and you have a fast, reliable data access layer.

      Once you get the nuances of Hibernate, it's quite easy and sometimes even fast to plug in an entity and go. Remember, it's not just wrapper for JDBC/Transactions, etc, but a fairly mature and robust ORM solution. And, its HQL (yes, another QL) allows for fined tuning of any entities that might become a bottleneck.

      For med to big sized projects, I'd recommend it.

    6. Re:Java never got a fair break. by IceFreak2000 · · Score: 2, Informative
      This development itself proves the big advantage Java has over C#/.Net in the enterprise arena: a far wider array of supporting libraries and frameworks, not to mention a selection of mature application servers.

      This is bound to be the case, considering how much longer Java has been around compared to C# - however, bear in mind that a large number of popular frameworks have already been ported to C#/.Net including NHibernate, Spring.NET and Maverick.NET.

      --
      Life is like a sewer; what you get out of it depends on what you put into it...
    7. Re:Java never got a fair break. by k-zed · · Score: 1

      Is it going to be replaced by C#?

      How about python? Word is python is getting more and more considered for the enterprise, and is actually a nice language. (Well, C# is too, opposed to java, but we know how's it with Microsoft and all.) I'm not going to mourn java, at any case.

      --
      we discovered a new way to think.
    8. Re:Java never got a fair break. by killjoe · · Score: 1

      The competition for java is not C#. Let's face is there isn't a whole hell of a lot of difference between them. The competition is from python and ruby.

      Hibernate may be great but all the buzz these days is about ROR (ruby on rails). It takes a completely different approach to persistance layers and it still a bit immature but it has potential and some great brains behind it.

      While java is looking over it's shoulders at C# languages like python and ruby are becoming more ubiquitus.

      --
      evil is as evil does
    9. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      C# has unsigned types. C# generics are almost alebraeic data types, are supported at the bytecode level, and shouldn't be compared with Tiger's godawful syntactic auto-casting sugar that are its templates.

      C++ templates are a bloody macro hack. You might be able to do some amazing stuff with them, but the syntax is just murderous.

    10. Re:Java never got a fair break. by the+eric+conspiracy · · Score: 1

      C++, where we got real types and real templates

      C++ has neither real types or real templates.

      C++ types are system and implementation dependent, and the temples are an imitation of something done better elsewhere (i.e. CL macros).

      And BTW, Java does have an unsigned data type.

    11. Re:Java never got a fair break. by zoftie · · Score: 1

      I hate hate curly braces, and any other non alpha-numeric clutter that pollutes my code reading/writing space. And now we enter python/ruby. No matter how may technologies there are for Java, unless I have to explicity use it, I won't.
      Don't get me wrong I don't like writing english for code like cobol either. But if language institutes good layout format for all developers, I'm all for that. Let rest of languages participate in obfuscation contest and be winners, because thats
      what all those punctuation marks endorse, obfuscation, even if it is to drastically less then of the contest winners.

      As for popularity, popularity is an empty word. Popularity is applied in highschool, to denominate one's worth on what most people, pretend to think of you. These are adults, even if young ones that are building this technology sector. Lets rid ourselves of words demoninating public valuations and acceptance and do whats RIGHT.

      Of course graduates learning Java as the centerpiece of their skill sets will disagree, but they are at the conflict of interest... Sun might object. But then they object the GNU licencing, gee what does that leave me to believe...

      2c

    12. Re:Java never got a fair break. by lewp · · Score: 1

      If you're writing software in a business environment, popularity is directly related to how easy/cheap it is to get ahold of programmers who have experience in a given area.

      It's easy to find an adequate Java programmer. Not so much for Python, Ruby, or Lisp.

      Of course, just like any other profession out there, good programmers are hard to come by regardless of language. Good programmers could get rolling in any of the languages I mentioned in a couple days anyway.

      The business world mostly gets away with adequate programmers, though.

      --
      Game... blouses.
    13. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      And it seems most of the bad things people have to say about RoR are performance-related. And most of those statements have "well, you can do this in RoR, but you have to do a little bit of work" qualifiers.

      Easy things easy. Hard things possible. Java's got one. RoR nails them both. Bloggers seem to be buzzing about it right now, but in time it's going to be absolutely huge.

    14. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      Is it going to be replaced by C#? Perhaps,

      No, it's going to be supplanted by Ruby On Rails.

      There. Had to do it. Let the flame fest begin.

    15. Re:Java never got a fair break. by Anonymous Coward · · Score: 0


      > And BTW, Java does have an unsigned data type.

      It has byte. Show me an unsigned long in Java. C#'s got 'em.

    16. Re:Java never got a fair break. by Samus · · Score: 1

      I've got to call you on that last statement. I've been gearing up for a .Net project in my company and have been looking at all the cool tools that have been ported to .Net. Of those you listed Maverick seems to be the only one that is complete and its a pretty bare bones mvc. NHibernate is still in beta and it has a mix of 2.0 and 2.1 features. Spring.NET is very immature yet. They're working on getting .6 out the door. It has some useful features implemented like the core IoC but it is nowhere near its java cousin. There are some good tools like NUnit that are complete and actually being rewritten to take specific advantage of the platform. Overall I have been really disappointed in the lack of maturity of OS on .Net. Especially in the mvc arena. Though after further research I found that to go with a front controller style (Struts) would pretty much force you to abandon most of ASP.Net. Maybe I'll get lucky and be able to contribute some patches as part of my job. Its so hard for me to get worked up about .Net that I know I won't be doing it in my spare time.

      --
      In Republican America phones tap you.
    17. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      If the concensus becomes that ROR is a better solution, someone will reimplement it for Java and C# and Python. There isn't anything about Ruby that magically makes it possible to do things you can't do in other languages. People can't seem to get their heads around the fact that Java and C# and Ruby and Python are just languages, and not all that different from one another. A framework you can implement in one can be implemented in the others.

    18. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      "This development itself proves the big advantage Java has over C#/.Net in the enterprise arena: a far wider array of supporting libraries and frameworks, not to mention a selection of mature application servers"

      Well, having a "wider arrary of supporting libararies and frameworks" can be good or bad. Platform independence doesn't buy much if your application is locked in to a particular vendor's framework.

    19. Re:Java never got a fair break. by Anonymous Coward · · Score: 0

      The main use of Java today is in large scale enterprise applications, usually meaning J2EE, although the current trend is the use of lighter alternatives, namely JSPs/servlets coupled with frameworks like Spring and Hibernate.

      J2EE != EJB

      Spring and similar frameworks just offer another way to tap into the useful j2ee-features, without all the cruft that is EJB.

    20. Re:Java never got a fair break. by aled · · Score: 1

      Java and Python are being used to different problem domains right now, so there's little overlapping.
      In any case, nobody will port working systems from language a to language b if there isn't a motivation. There's none to move from java to python or c#, like it happened with legacy system and y2k.
      Just because some programmer prefer one language to another doesn't give motivation to do that.

      --

      "I think this line is mostly filler"
    21. Re:Java never got a fair break. by indifferent+children · · Score: 1
      As for popularity, popularity is an empty word. Popularity is applied in highschool

      OK, 'mindshare'. Are you happy now?

      --
      Censorship is telling a man he can't have a steak just because a baby can't chew it. --Mark Twain
    22. Re:Java never got a fair break. by Mr.+Ghost · · Score: 1
      I'm guessing from your post that you were not popular in high school.

      Propularity is hugely important when it comes to technology and real business solutions. For a company to accept a technology into their business they need to consider the size of the talent pool and th expected lifespan of the technology.

      If a technology is popular it will have a larger talent pool therefore a company will not have to hunt/beg/plead for potential developers/engineers.

      If a technology is popular it will also likely have a longer lifespan and 10 or 15 years down the road when something needs to be changed they will still be able to find people with those skills.

      If a company would actually choose to go with a more niche technology like say Eiffel or Dylan or today Ruby/Python they will likely be regretting their decision 5 or 10 years (maybe less) down the road when someone actually has to go back and support the application but the 1 or 2 people who actually wrote it have moved on to greener pastures.

      It may be cathartic to say that the popularity of a technology does not matter and in an academic environment or personal environment it really doesn't but if someone has to take budgets, bottom lines and contracts into account like the real world then popularity does indeed need to be considered.

    23. Re:Java never got a fair break. by nodrogluap · · Score: 1

      Two points that I think are largely overlooked when people are bitching about Java:

      1. Yes the native code interface requires you to include a new step in your compile process (javah), and that is inconvenient. It's not rocket science though. I figured it out in an hour or less for a proprietary C API I was wrapping. It's just inconvenient enough to discourage users from importing large chunks of code outside the control of the JVM. To some this as a feature, to others not. How many Java apps are wrappers around parts of existing C/C++ apps? How many C#/.NET apps are wrappers around parts of existing C/C_++ apps?

      2. We use Java in my group for one important reason: we write applets. We have an even split between Windows, UNIX and Mac users from all over the world (welcome to the wonderful world of molecular biology). Many do not even have the privileges to install software on their computers. Many others are too lazy to install the program just to try it out. It needs to be launchable and scriptable from many Web pages. It's interactive visualization that can't be done nicely via some server side solution. People may like/dislike various features of the language, but when it comes to its original market of running remote code, I don't see anybody really challenging it yet...

    24. Re:Java never got a fair break. by Tim+C · · Score: 1

      As others have said, if you choose to use a well-known, "popular" language or technology, and half way through the project one of your developers falls sick, you can easily replace them. If you choose to use something obscure, you probably won't be able to.

      My company is currently having massive amounts of trouble hiring good-quality contractors to work on a particular project because we have a relatively unusual requirement - they *must* be security cleared. The few that we've seen haven't been up to scratch technically. Subsitute "be security cleared" for "know new language no-one's heard of" and you'd have the same problem...

    25. Re:Java never got a fair break. by Decaff · · Score: 2, Interesting

      Easy things easy. Hard things possible. Java's got one. RoR nails them both. Bloggers seem to be buzzing about it right now, but in time it's going to be absolutely huge.

      Not in it's current form it won't. RoR has some serious design flaws for major projects. One is that the object model is derived directly from the database, so if the database changes even slightly, this can seriously break code. Serious ORMs have mapping configurations that allow the object model to be isolated from such changes. This hard link to the database also prevents easy portability between different database types - a schema change required by porting can again break code.

      Serious ORM systems (such as Hibernate and JDO) have the ability to fine-tune the loading of fields to prevent serious memory and performance problems. Imagine trying to use RoR for large datasets where the tables included large BLOB or VARCHAR fields - this would be a performance nightmare.

      The RoR people don't seem to understand that the configuration files present in large Java ORM applications are there for a good reason - to abstract and fine-tune database access.

      Finally, RoR requires use of vendor-specific SQL. JDO and Hibernate abstract this. Moving a JDO or Hibernate project between, say MySQL and PostgreSQL can be very fast. It could be a major problem with RoR.

      RoR takes a very old-fashioned database-centred vendor-SQL-specific approach.

    26. Re:Java never got a fair break. by zoftie · · Score: 1

      If you are working for mega corporation where mertis of technical tools are not considered, you probably working for company that will not respect your decisions. Aside from learning curves, I'd hire any decent developer and allot them 1 week of intensive python learning. In java things are much much different, i'd allot a month .. or just look for a new developer.
      Myopic view that there is more developers in technology du jour field, does not qualify that your project will succeed or be usable. Tool must be chosen on technical merit. Particular language is no obstacle to developer, since they all are same, of the oject oriented bunch. I agree using Forth to design your webserver is absurd, but for embedded devices it should not be so bad. Sun used it for boot rom software. Forth is made to write fast programs if terse and small. So learning small program would not pose much overhead. You should note that most of the time developers become useful after average of less then 1 month time at any rate. They have to learn the code base, understand conventions. 2 weeks is common. Of course the desire of companies is to have developers as interchangable as light bulbs. They also would like developers not to be paid, have no benefits have no social lives.

      One can make bad decisions on choosing tools.
      However most often companies don't give merit of choosing tools to developers anyway.

      Yes I was popular in high school, and I was in many sports teams.

    27. Re:Java never got a fair break. by zoftie · · Score: 0, Flamebait

      Read this: java is made for people with poor programming skills.

      I read it as an assault on industrialization of programming effort into minimum requirenment code production boxes , called programmers. It is much about deculturization of software development trade.

  13. Hibernate and J2EE by cmiles74 · · Score: 2, Interesting

    I am curious to know if this books spend a decent amount of space on actually using Hibernate in the context of a J2EE application (i.e., instead of using CMP)? I currently work with CMP and I am not a huge fan, I am very interested in alternatives and wonder if this book is the place to start looking.

    The title of the book implies that the book does cover this, but the review doesn't actually mention this specifically.

    1. Re:Hibernate and J2EE by chochos · · Score: 4, Interesting

      My quick recipe for that is:

      1. Screw EJB and CMP
      2. Use Spring instead of EJB's (or in conjunction with EJB's)
      3. Use Hibernate for persistence
      4. Configure Hibernate through Spring and use the Hibernate ORM support in Spring to further speed up development and decrease code (both Java AND xml)

    2. Re:Hibernate and J2EE by Anonymous Coward · · Score: 0

      Go grab Resin and try out their EJB 3.0 implementation. I think you'll find it surprisingly Hibernate-ish. It could change your mind about EJB (or at least the direction and future of EJB).

    3. Re:Hibernate and J2EE by Suhas · · Score: 1

      ....but.....but.....but.... how do I... Profit?!?!!

  14. Re:Hibernate by BarryNorton · · Score: 3, Funny
    In fact, much of it is just-in-time (JIT) compiled
    Like OMG, someone should tell the computing press QUICKLY....
  15. Re:Hibernate by Anonymous Coward · · Score: 0

    Just curious, what do you mean that Swring needs a makeover? I've used Swing extensively (but I have no experience with any other GUI toolkit), and I am curious as to what it's problems are in your eyes. Do you mean visual problems, or (code) usage problems?

  16. Hibernate vs. JDO vs. EJB by prakslash · · Score: 2, Interesting

    What is the latest on this battle?

    There are so many soundbites floating around:

    Hibernate is JDOish but does not follow Sun JDO Spec. But.. Gavin King of Hibernate became a member of JD02.0 Expert Group and would make it compatible with JDO 2.0 Spec.

    JBOSS is adopting Hibernate as the underlying persistence mechanism for its Container-Managed Entity Java Beans.

    EJB 3.0 rejected JDO 2.0.

    So.. now I am confused. Who is the winner? Should I buy the book or not? Anyone care to enlighten us?

    1. Re:Hibernate vs. JDO vs. EJB by peter_gzowski · · Score: 1

      A related question, one I get all the time from DB guys I know, is, "why are you putting all this persistence logic in the application instead of the DB (i.e. stored procedures)?". Can someone come up with a snappy comeback for me? I've been developing with java for less than a year.

      --
      "Now gluttony and exploitation serves eight!" - TV's Frank
    2. Re:Hibernate vs. JDO vs. EJB by customiser · · Score: 1

      I'm not sure who the "official" (if you can call it that) winner will be, but so far it seems that Hibernate is the no1 choice for new projects. Now of course Sun appears keen on improving Entity Beans after realising just how awful people found them in practice, so it is possible that there might be in the future a change in the status quo. But right now, Hibernate is the most recommended solution.

    3. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 2, Insightful

      portability.

      oracle is not the de-facto enterprise db.

    4. Re:Hibernate vs. JDO vs. EJB by Shayde · · Score: 2, Informative

      My main reason for going with Hibernate is... it's java. It's iwthin the J2EE appserver environment, deployment to it is identical to deploying any other J2EE component. Package it up, drop it in the deployment dir, and you're off and running.

      Shifting persistent objects into anything other than a standard SQL engine means you have to undersgtand and work with 2 different technologies when manipulating your persistence engine.

      Frankly, I'd like to stay with one language, one deployment method, one set of known plusses and minuses.

      Oh, and Hibernate works fine with a zillion SQL servers. Stored procedures only work with the one they're designed for.

      --
      Event Management Solutions : http://www.stonekeep.com/
    5. Re:Hibernate vs. JDO vs. EJB by FatherOfONe · · Score: 1, Informative

      Here is my understanding of it.

      Hibernate does not really compete with CMP Entity beans, but perhaps sessions beans. I see the breakdown as this.

      If the requirements are hundreds of transactions a second, then EJB will probably be the best choice. It has the ability to swap out objects to disk and share resources very well. In my humble opinion it is the only way to scale Java apps up to many thoughsands of concurrant users.

      With EJB's, the container handles and provides a ton of features that you the developer can take advantage of. Do you need these features?

      EJB's do provide an object to relational mapping but that is only one aspect of the technology. Using this approach though forces you to communicate with another server for that communication. In my opinion the object relational mapping in EJB is lacking, and the 3.0 spec will hopefully address these issues.

      Thus Hibernate was born. Hibernate does not require you to communicate to another server (RMI, Corba etc). Hibernate focuses on being the best object relational mapping tool out there. In my opinion it does an excellent job. However asking Hibernate to scale to the levels of EJB may be asking a bit too much.

      The question that needs to be asked is what does your application require? Most will find that Hibernate meets the needs and as such it is doing very well.

      NOTE: I am generalizing here. Please don't start a flame war. I am a fan of EJB AND Hibernate.

      --
      The more I learn about science, the more my faith in God increases.
    6. Re:Hibernate vs. JDO vs. EJB by scrotch · · Score: 3, Funny

      Tell your DB guys that the word from above is that your database vendor will be changing. Be vague enough that they worry...

    7. Re:Hibernate vs. JDO vs. EJB by Decaff · · Score: 3, Informative

      Hibernate is the most recommended solution.

      Depends what for.

      In spite of what you might read, JDO IS widely used, which was why the JDO 2.0 specification was recently approved against a lot of political pressure.

      JDO does not limit you to relational stores. Hibernate does. JDO 2.0 is very close to Hibernate in terms of use and features, but can work with a very wide range of stored. You can get JDO implementations that work with CSV files, Object databases, XML stores etc. You can use exactly the same code and API to access these stores as you use to access relational stored.

      Hibernate is a high-quality product, but JDO gives you choice.

      There are nice free and open source implementations of JDO as well.

    8. Re:Hibernate vs. JDO vs. EJB by peg0cjs · · Score: 1

      One word: caching.

      --
      Karma: Excellent (Mainly due to Bill & Ted's Karma Adventure)
    9. Re:Hibernate vs. JDO vs. EJB by nacturation · · Score: 1

      Should I buy the book or not? Anyone care to enlighten us?

      Well, with a name like Hibernate, I figure the book would put me to sleep.

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    10. Re:Hibernate vs. JDO vs. EJB by anomalous+cohort · · Score: 2, Informative
      portability

      Mod parent up. It's not caching. Databases can cache too. If you're an ISV and you want to sell to companies that don't neccessarily share your views on which DB vendor is the best, then stay away from stored procedures and make your SQL as standards compliant as possible. In which case, an ORM technology makes perfect sense.

    11. Re:Hibernate vs. JDO vs. EJB by sucati · · Score: 1
      Hibernate is a high-quality product, but JDO gives you choice.

      My experience with JDO (Solarmetric) left me using many of the vendor specific features, and not because I wanted to. Felt more like vendor lock-in to me.

    12. Re:Hibernate vs. JDO vs. EJB by sucati · · Score: 1

      If you were to compare Hibernate to EJB, you would be talking about CMP. Spring offers transaction management to fill the session bean gap. I don't think any respectful developer uses stateful session beans anymore.

    13. Re:Hibernate vs. JDO vs. EJB by koreth · · Score: 3, Interesting
      Hibernate does not really compete with CMP Entity beans, but perhaps sessions beans.

      I disagree -- Hibernate is almost a drop-in replacement for CMP entity beans. It does nothing to address the issues that session beans address (implicit transaction management and transparent load balancing, to name the two big things session beans buy you) and does the important thing CMP entity beans do (O-R mapping and removing the need for an object to have code to load and save itself.)

      Hibernate does not require you to communicate to another server (RMI, Corba etc).

      Neither does EJB, especially as of EJB 2.0. Using local bean interfaces means no RMI overhead -- they're so against you using remote invocations that local bean methods are forbidden from throwing RemoteException!

      Not, mind you, that I'm any big fan of CMP entity beans. Using them was the biggest architectural mistake I made when I was starting out in J2EE development. Lots of development overhead, bad performance, and very little real gain. Hibernate beats CMP entity beans in just about every respect.

    14. Re:Hibernate vs. JDO vs. EJB by zoftie · · Score: 1

      Thousands of transactions on what ? Mainframe? A PC? an AMD server? PIII latop? Quad xeon server. Sorry speed metrics in software systems has to be backs against a hardware unit, otherwise they are useless.
      And transcation can include X amount of queries.
      thanks.

      PS: someone on slashdot should enable Spell check button, since so many people are out of English speaking states. Maybe make it a requirenment... :)

    15. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 0

      > * EJB 3.0 rejected JDO 2.0.

      In favor of Hibernate, basically. The winner is Hibernate, but the one that comes away with the "most improved" prize is EJB 3.0. JDO is looking like an also-ran at this point.

    16. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 0

      > Hibernate does not require you to communicate to another server (RMI, Corba etc)

      EJB has never required you to. EJB 2.0 required you to treat the container as remote, however. EJB 3.0 drops that assumption, and the persisted objects are POJOs. EJB 3.0 is a lot simpler. Of course, it basically is Hibernate.

    17. Re:Hibernate vs. JDO vs. EJB by Guillermito · · Score: 1

      IMO Database job is to store data reliably. Nothing more, nothing less. Bussiness logic (other than integrity constraints) does not belong to that tier.

    18. Re:Hibernate vs. JDO vs. EJB by FatherOfONe · · Score: 1

      Excellent points. I definately have a lot to learn about EJB 2.x and Hibernate. I still stand by my point though that EJB is "generally" on a separate server and communicated to, where Hibernate is used in the local JVM. I also stand by the point that the core reason for EJB is scaleability.

      From my limited test with Hibernate I have found it to be a HUGE memory hog. Specifically RAM. Now given that the app is not distributed, RAM can become an issue. I also want to point out that when the system finally ran out of ram (~30k rows from a DB to a list of objects) it just gave me a generic hibernate error. "Invalid query" I believe was the error. I spent FOREVER debugging the error, to find out it was just a RAM issue.

      I only mention this because, in my opinion no option is perfect. I believe that you and I would be in total agreement about using Hibernate vs. EJB's for 99.99% of the applications.

      --
      The more I learn about science, the more my faith in God increases.
    19. Re:Hibernate vs. JDO vs. EJB by FatherOfONe · · Score: 1

      First, I am sorry about the spelling.

      You are correct about transactions. However my point is fairly general, in that if you want to have a system scale (say 75% database reads, and 25% writes), at some point Hibernate will not be the answer. My experience is that Hibernate is RAM hungry, and EJB's are a pain to debug and develop. No solution is perfect, but Hibernate and EJB's don't really compete against each other.

      --
      The more I learn about science, the more my faith in God increases.
    20. Re:Hibernate vs. JDO vs. EJB by bckrispi · · Score: 1
      I don't see how Hibernate competes with Session beans, as it's Entity beans that handle the persistance layer of your app. In fact, I've read several articles about using Hibernate as a replacement for Entity beans, and using a Stateless Session bean facade to work with your Hibernate objects. This way, you get all the bennies of a J2EE app server and EJB (Scalability, declarative security, declarative transaction management, connection pooling, JNDI services, JMX services, messaging services, etc.) without the pain of trying to model a complex relational database using Entity beans.

      I'm actually buried in this arguement right now. I'm currently designing a middleware and persistance architecure for a web application. The following three rules *need* to be followed:

      1. Data stored in the DB is *only* accessed through the persistance layer
      2. The persistance layer must be totally de-coupled from the domain layer.
      3. The persistance layer must be able to retrieve any arbitrary data stored in the DB, bound by any arbitrary constraints.
      At first, I tried prototyping this using Entity beans, and I found it to be impossible to meet all of these requirements without wasting a lot of CPU and DB calls. Using EJB, it appears to be next to impossible to use a "finder" to return arbitrarily constrained data. For example, lets say in an E-Commerce app, I have a finder for returning all products, for finding one product by PK, and by finding all products in a certain category. Some months down the road, a requirement comes in that I need to allow users to search for items in a given price range. Not only do I need to build this logic into my web and domain layers, but I must also build a *new* finder for my EJB's. If there are requirements to add fifty new product search criteria, that's fifty new finder methods that need to be built into my Entity beans and deployment descriptors. Yuk!!! My only other alternatve is to do a "findAll()" at the persistance layer, then have the domain layer iterate over the entire dataset and filter out those items that don't meet the criteria. Even bigger "Yuk!".

      So now, I'm looking at Hibernate as well as JDO. Looking at the constraint API, I think I'll be able to make this work, and just wrap the whole thing in a session facade pattern.

      --
      Xenon, where's my money? -Borno
    21. Re:Hibernate vs. JDO vs. EJB by FatherOfONe · · Score: 1

      EJB 3.0 is NOT out yet!

      I am willing to bet that 99% of all EJB 2.0 apps do not use the local interface.

      Now having said that... It does look like the EJB 3.0 spec for O/R mapping will look a lot like Hibernate :-) :-) :-)

      This is great news.

      --
      The more I learn about science, the more my faith in God increases.
    22. Re:Hibernate vs. JDO vs. EJB by FatherOfONe · · Score: 1

      Excuse my ignorance, but couldn't you have used session beans and done the O/R mapping yourself? Then within that session bean used some of the CMP entity beans, when needed?

      I don't have much time right now, but I would love to talk more about this with you and see what issues you found, and how you solved them.

      Thanks

      --
      The more I learn about science, the more my faith in God increases.
    23. Re:Hibernate vs. JDO vs. EJB by bckrispi · · Score: 1
      I had considered a "hybrid" type solution where I use Entity beans for inserts and updates, and some other method (ORM/SQL called from POJO's, etc.) for constrained lookups. However, I think that I'd be doing a lot of redundant work for this (i.e. defining an Entity bean to represent a product, then doing a ORM object for representing a product). I'd rather just use one framework for handling persistance. If you have an example of how you've done something like this in the past without too much pain, please let me know about it!

      It was only a couple of days ago that I gave up on doing an Entity Bean solution, and I'm just now looking at Hibernate as a replacement.

      --
      Xenon, where's my money? -Borno
    24. Re:Hibernate vs. JDO vs. EJB by LoztInSpace · · Score: 1

      Personally I don't think there is one. One poster said "portability". Using a stored procedure interface you can pretty much cover this one, although admittedly not without writing one SP layer per database.
      I'd also point out that many products are not required to be portable, especially in-house systems. Those that are are rarely optimal on any platform-the worst of both worlds.

    25. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 0

      Tell them it is because the application can do a better job of ensuring data quality than the database.

      Of course, the application only checks the constraints on data it changes - and so doesn't typically handle problems caused with changes to the schema. So don't bring that part up!

      And don't let them look at your application constraints - your procedural code is generally much more complex than the declarative code used to ensure data quality in a database (primary & foreign key constraints, check constraints, uniqueness constraints, etc).

    26. Re:Hibernate vs. JDO vs. EJB by LoztInSpace · · Score: 1

      I disagree. Data can have business logic. Databases have multiple clients (in the application sense). What better place to implement business logic? The minute you code your business logic anywhere else it becomes a one-off, specific to that application. A major skill is identifying those rules that are application specific compared with those that are data or organisationally specific.

    27. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 0

      Tell your App guys that the word from above is that your programming language will be changing. Indicate that this includes all existing programs.

    28. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 0

      * Gavin (To be strict, JBoss Inc.) left JDO group long time ago,
      * Hibernate been around for years before JDO was born. Frankly speaking hibernate has almost nothing in common with JDO, from the very beginning. Hibernate is about POJOs and JDO is focused on managed objects.
      * EJB 3.0 (strictly EJB 3.0 Persistence) didn't rejected JDO. SUN just decided to focus on EJB 3.0 persistence deprecating JDO (which has quite big community, they just voted JDO 2.0 spec) in some sense. I think most JDO vendors will provide a 'easy track' to migrate to EJB 3.0.

      About the winner - I think that the winner is POJO persistence. EJB 3.0 Persistence is highly influenced by leading ORM solutions - I mean TopLink and Hibernate and has all best of this both frameworks. In fact, if You know HB or TopLink now, You shouldn't buy new book. Just look at the spec - it is *very* similar to HB or TopLink. Now HB3.0 has most of the EJB 3.0 persistence functinality and I thing it will be very easy to migrate from HB to EJB 3.0.

    29. Re:Hibernate vs. JDO vs. EJB by Anonymous Coward · · Score: 0


      JDO does not limit you to relational stores. Hibernate does. JDO 2.0 is very close to Hibernate in terms of use and features, but can work with a very wide range of stored. You can get JDO implementations that work with CSV files, Object databases, XML stores etc. You can use exactly the same code and API to access these stores as you use to access relational stored.


      Oh come on! Have You ever seen Object Databse in real enterprise working as a high volume transactional system (or CSV files or XML Files as a mass storage)? Most modern RDBMSes allows You working with XML and with 'structured files' (for example extrenal tables in Oracle). Point me out the Object DB which has more than 1% market share? This is the problem - hibernate guys stated from the very begining - 'do one thing, and do it well'. JDO tries to do all things and, actually, does it poor.

      Artur

    30. Re:Hibernate vs. JDO vs. EJB by Baki · · Score: 1

      Looking at a list of new stuff in JDO 2 compared to JDO 1, it is obvious that all that happened between version 1 and 2 is to copy features from Hibernate.

      This goes from the most fundamental one, namely to specify an ORM, to many details such as an API to get a single result instead of a Collection from a query.

    31. Re:Hibernate vs. JDO vs. EJB by fupeg · · Score: 1
      Hibernate is JDOish but does not follow Sun JDO Spec. But.. Gavin King of Hibernate became a member of JD02.0 Expert Group and would make it compatible with JDO 2.0 Spec.
      Gavin King is actually on the JSR 220 (EJB 3.0) committee and has completely thumbed his nose at JDO. He has posted on TheServerSide.com about how much JDO sucks. EJB 3.0 completely embraces Hibernate. In fact Hibernate 3.0 + Annotations is an implementation of EJB 3.0.
      JBOSS is adopting Hibernate as the underlying persistence mechanism for its Container-Managed Entity Java Beans.
      Ths is true. In fact Gavin King and several other Hibernate developers were hired by JBoss. Now the two biggest schmucks (King along with Marc Fleury) in Java are working together!
      EJB 3.0 rejected JDO 2.0.
      See point #1. JDO has been abandoned by Sun and by the app server vendors.
    32. Re:Hibernate vs. JDO vs. EJB by davesag · · Score: 1

      mmmm JDO. I switched from Hibernate to JDO last year and love it. I have always avoided EJB, preferring Jini should I need to build distributed systems, and POJOs with JDO (or Hibernate, honestly it's 6 of one, half dozen of the other). The big plus for JDO is there are loads of JDO vendors competing and so far it's been prety much plug'n'play to swap out one JDO impl and use another. JDO2 is really flexible, much more so than Hibernate IMHO and the whole i really dig the byte code enhancement idea a whole lot as it keeps your code small and tidy. hibernate's use of the getters and setters to persist fields can be very annoying and forces you to make specific adjustments to your objects which can be annoying.

      --
      I used to have a better sig than this, but I got tired of it
    33. Re:Hibernate vs. JDO vs. EJB by master_p · · Score: 1

      Can the same Hibernate objects be used from different web applications? let's just say that I have one database, but multiple web applications running in the same application server. How does Hibernate solve the problem of data integrity across different web applications? Last time I checked (and Hibernate was rejected by my company for this reason alone), if I have some information in one Hibernate session, then other Hibernate sessions might be unaware of the changes in the database made by other web applications.

    34. Re:Hibernate vs. JDO vs. EJB by ivano · · Score: 1
      wow...a real dialogue between two people that know what they're talking about. A first for slashdot :)

      It was a pleasure to listen in. Shows everyone the power of the internet community and the original reason why we have slashdot. Thanks!

      Now, I'm off to hug someone.

      Ciao

    35. Re:Hibernate vs. JDO vs. EJB by Decaff · · Score: 1

      Oh come on! Have You ever seen Object Databse in real enterprise working as a high volume transactional system

      Absolutely. Some stock exchanges use Object Databases, some airlines, and CERN uses it because a customised object database has extremely high performance.

      (or CSV files or XML Files as a mass storage)? Most modern RDBMSes allows You working with XML and with 'structured files' (for example extrenal tables in Oracle). Point me out the Object DB which has more than 1% market share?

      Who cares? JDO is a proven successful way to access relational systems AND it gives the choice to handle non-relational systems as well. You can use the same API if the user of your application simply needs to persist a few objects
      to a flat file or XML store. Java is about flexibility and scalability for a wide range of uses. JDO meets that requirement as well. Hibernate doesn't. With the features of JDO 2.0 there is no disadvantage, either in code quality or performance, to using JDO rather than Hibernate. There are big advantages - being able to get it from more than one supplier, and being able to use it for more than just relational stores if you need to. What is the problem?

      This is the problem - hibernate guys stated from the very begining - 'do one thing, and do it well'. JDO tries to do all things and, actually, does it poor.

      This is plain nonsense. JDO's main use is for relational systems, and it works very effectively, even for high-demand enterprise systems.

      The Hibernate guys would say this because relational systems are their focus, and they don't want competition there.

      JDO is about choice.

    36. Re:Hibernate vs. JDO vs. EJB by Decaff · · Score: 1

      My experience with JDO (Solarmetric) left me using many of the vendor specific features, and not because I wanted to. Felt more like vendor lock-in to me.

      True, but you get that lock-in with Hibernate anyway - none of it is standardised. At least with JDO 1.0.1 you had a substantial core of the API which was portable. Take a look at JDO 2.0 (just approved, implementations will be out soon, including open source versions). Most if not all vendor-specific features (such as Object/Relational Mappings) have now been standardised, so you won't be locked in.

    37. Re:Hibernate vs. JDO vs. EJB by Decaff · · Score: 1

      Looking at a list of new stuff in JDO 2 compared to JDO 1, it is obvious that all that happened between version 1 and 2 is to copy features from Hibernate.

      And what is wrong with that? It gives you Hibernate features, but standardised and available from more than one supplier.

      Of course, there are many features well in advance of Hibernate - object states and the ability to persist to stores other than relational databases.

      To say it is only Hibernate copying is not true at all - there are many new features, such as being able to set up customised named fetch groups to help with performance and scalability, that Hibernate lacks.

    38. Re:Hibernate vs. JDO vs. EJB by Decaff · · Score: 1

      Hibernate 3.0 + Annotations is an implementation of EJB 3.0.

      No it isn't. It is an implementation of one particular aspect of EJB 3.0 - the plain Java object persistence. EJB 3.0 is a very large specification, with features such as Session Beans and Message Beans. Hibernate does not implement these.

      EJB 3.0 rejected JDO 2.0.

      Wrong. There are many JDO experts and vendors in the EJB 3.0 expert group.

      JDO has been abandoned by Sun and by the app server vendors.

      Nonsense. You could not be more wrong. Sun not only actively support JDO, it is the mechanism they use to provide persistence in their App server. Hardly 'abandoning' JDO, is it?

    39. Re:Hibernate vs. JDO vs. EJB by FatherOfONe · · Score: 1

      I see your point. A hybrid approach would suck.

      We are using Hibernate in a few applications now, (very early projects), and have found it to work well. I personally use Eclipse with the MyEclipse plugin ($30/year) and it will do quite a bit of the repetitive work for you. Now I have found that Hibernate is a memory hog. When it runs low on memory it will kick out "query is not valid" errors.

      So my early opinion is that if you have enough memory to handle the load of the system AND you know your user count will not grow a ton, Hibernate is a good solution. I would reccommend the book Hibernate in Action, and perhaps the developers notebook.

      We have looked and played with EJB's and have never had a real need of the services and scaleability they provide. That and the complexity of them and none of our projects ever require their use.

      --
      The more I learn about science, the more my faith in God increases.
    40. Re:Hibernate vs. JDO vs. EJB by Guillermito · · Score: 1

      Data can have business logic. Databases have multiple clients (in the application sense). What better place to implement business logic?


      An application server, perhaps?
    41. Re:Hibernate vs. JDO vs. EJB by koreth · · Score: 1

      They definitely expect other apps to be using the database at the same time; see, for example, a few of the entries on the Features page and some discussion in the second-level cache section of the manual.

    42. Re:Hibernate vs. JDO vs. EJB by Decaff · · Score: 1

      But right now, Hibernate is the most recommended solution.

      Recommended by who?

      There is a full-featured new Java Community Process standard for the persistence of plain Java objects that has the same features as Hibernate. This is called JDO version 2.0. JDO does not limit you to one supplier and works on more than just databases.

    43. Re:Hibernate vs. JDO vs. EJB by bokmann · · Score: 2, Informative

      This is a complex minefield I have been navigating for a couple of years. HEre is my understanding of it:

      1) When we talk about EJB 3.0 in this context, we are really talking about Entity Beans. Entity Beans are currently crap - do not use them. Future versions of the spec are moving in a better direction though (see below). The Session Beans part of EJB 3.0 are very useful IF you need to services provided by the container (but that is outside this conversation).

      2) JDO is a real thing, and it works really well IF you have an object-oriented domain model that you want to persist as transparently as possible. While not part of the J2EE spec, it doesn't have to be - it works inside the container just fine. (Th main reason it is not part of the spec is political - the EJB vendors didn't want to have to write yet another component). IF you have an existing database schema, your mileage may vary with JDO - it is up the the JDO vendor to so support mapping tools to existing schemas. JDO 2.0 is not revolutionary - it just takes the existing stuff a little further. IF you like this approach, I would also suggest you look at an OODBMS like Versant.

      3) Hibernate ROCKS, especially if you are mapping an existing database to a bunch of objects. It does a lot more than that though - you can start from objects and either generate or map to a schema, start with a schema and generate objects, etc. There is a fundamental 'impedance mismatch' between relational and OO, as the first chapter of "Hibernate In Action" outlines better than any explanation I have seen. It isn't a 'standard', but so what? You use standards when you want to choose between different vendors... This is open source, which is another risk-mitigation strategy for the same problem. 'Ant' isn't a standard, yet I doubt you could show me more than a handful of projects that don't use it (or Maven, which uses Ant under the covers).

      In short, there is no one choice. All have their plusses and minuses, and any can be used in a J2EE environment even if they aren't 'part of the spec'. Even JDBC might be a valid choice given a particular project's needs. The choice is going to depend a lot on the application.

      Sun realizes there is confusion, and is trying to address it... unfortunately, the letter they wrote to 'the community' actually added more confusion to the mix.

      The next version of Entity Beans is going to look a LOT like Hibernate, but will use the new JDK 5.0 concept of 'annotations' to help describe the relational mapping. This will ultimately mean Hibernate will be subsumed into JBoss as their Entity Bean implementation (which is why they are a part of JBoss).

      Sun also wants to have a persistence mechanism that is usable outside of a J2EE container. Entity beans in their current form are not it. JDBC can do this, but it is does not facilitate thinking in terms of an 'object model'. JDO is this spec now, as is Hibernate, and hibernate is actually moving to be more EJB-Like. My crystal ball says that Hibernate and JDO will unite under some uber-api umbrella that allows a developer to use it like either api can be used today, and will be a spec that can be used in a J2EE container as well as outside.

    44. Re:Hibernate vs. JDO vs. EJB by master_p · · Score: 1

      The hibernate docs you linked to say that:

      The second-level cache is appropriate for

      • immutable data
      • mutable data in the case of exclusive database access by the Hibernate application

      So in order to use the 2nd level cache, the data must either be immutable or only the Hibernate application can use them.

      In other words, Hibernate can not be used in the context of one database and multiple web applications. Too bad, because it would be much easier for us to develop lots of little web apps, instead of a big one.

      Unless I am missing something...

    45. Re:Hibernate vs. JDO vs. EJB by koreth · · Score: 1
      Hibernate's second-level cache can't be used in the context of multiple web applications hitting the same database from separate JVMs. Not the same thing as saying Hibernate can't be used with multiple web applications.

      If your web apps are all in the same JVM you can use a JVM-wide cache. If they're not, it's trivial to turn off the second-level cache entirely (hibernate.cache.use_second_level_cache=false in hibernate.properties). More effort, but higher performance, is to configure Hibernate's cache usage on a per-class basis, which could be a win if only a subset of your tables are modified by other software.

    46. Re:Hibernate vs. JDO vs. EJB by LoztInSpace · · Score: 1

      What about applications that do not use the application server but connect directly to the database? Application rules (for want of a better description) should certainly live in the application server. General business rules should live in the database.

    47. Re:Hibernate vs. JDO vs. EJB by mrjohnson · · Score: 1

      The unfortunate thing is that the second you think about changing the database, you start worrying about all those procs you'd have to port. There shouldn't be a direct connection to the database for all but the simplest of apps. Otherwise you're talking about a lot of pain incurred when the logic, the database, or the app changes.

      The database layer's job is to store data. If you need a stored proc to assist with that, then it's the best tool. But business data is best implemented in a layer far abstracted from anything else. You should be able to use it as a wholly separate piece from the application, the database, or anything else, really.

      The other point I wanted to make was that your business layer typically needs access to other things besides just the other data. There's only so much junk you can collect up in the app layer to pass to a stored proc before your app logic is riddled with code that doesn't make sense for anything but that specific business layer. When the time comes to port to another business, you're screwed...

      This is coming from a guy who very painfully re-implemented an app designed like you've described. And the blasted thing is still stuck on Oracle. :-)

    48. Re:Hibernate vs. JDO vs. EJB by GoofyBoy · · Score: 1

      >But business data is best implemented in a layer far abstracted from anything else.

      The problem for me here is that having the business data is useless if you have it in J2EE and you are trying to use a tool that doesn't interface with J2EE.

      For example, you want to slap on a simple an Excel spreadsheet to pull data out and do some funky things. J2EE does not integrate well/easily with Excel, but Excel does with the database. Same thing with loads of different products such as Crystal Reports or my old Fortran program. Database connectivity is tested and common. Integration with EJB is not.

      I would love to have the business rules independent of any layer/technology, but the reality is that it needs to be accessable more than abstracted.

      --
      The surprise isn't how often we make bad choices; the surprise is how seldom they defeat us.
    49. Re:Hibernate vs. JDO vs. EJB by mrjohnson · · Score: 1

      I think we're not talking about the same thing. For the apps I write, for example, the business logic often entails complicated financial calculations that aggregate several fields from multiple database tables. The server-side script does this and the result is stored in the database. The output from the business logic, in this case, is part of the record and is appropriately stored with it.

      There's no problem running reports and (shudder) Excel against the database, because the business logic has been applied. I'm not sure what you're doing in order to simply read from storage, which makes me think we're misunderstanding each other.

      It wouldn't be possible for me to change the data on the read for a number of reasons. Most importantly, if it has to be changed, then the record in the database is wrong and it counts as a bug against my app. I also need to have a record of the structures the users create, even if the business logic changes. (It is a Bad Thing if the record changes and some customer suddenly owes more money on their next bill.) Also, these scripts are long and difficult even when written in a convenient language like Python, when implemented in stored procs on every read, reports would take days to complete.

      Oh, one last point, from a pessimistic viewpoint. If I were to screw up the on-save business layer, that's not good. But if I were to screw up an on-read design, then every single record is broken. That's a lot worse...

    50. Re:Hibernate vs. JDO vs. EJB by GoofyBoy · · Score: 1

      >I think we're not talking about the same thing.

      I do realize that you have a specific app that makes things work good for you and its different from the apps that I work on. I'm just trying to flesh out the problems I've encountered/see.

      >The server-side script does this and the result is stored in the database.

      Thats interesting. You have the business rules on both sides. The code that implements it and the on the database tables that has the results. If the business rules changes then you have to change both the code and previously existing result data you've stored on the database, correct?

      >If I were to screw up the on-save business layer, that's not good. But if I were to screw up an on-read design, then every single record is broken.

      Both ways every single record is screwed up (or just the important ones that matter in our case). If the business rules are wrong, it goes into the database result tables wrong and it gets read wrong. If the on-read design is wrong, it gets read wrong. Both have the same result. I'm not sure how one way is more worse than others, from a "correctness" point of view.

      --
      The surprise isn't how often we make bad choices; the surprise is how seldom they defeat us.
    51. Re:Hibernate vs. JDO vs. EJB by mrjohnson · · Score: 1

      "Thats interesting. You have the business rules on both sides. The code that implements it and the on the database tables that has the results. If the business rules changes then you have to change both the code and previously existing result data you've stored on the database, correct?"

      Nope, there's little logic in the database. There's only a few functions to help me pull data in some places. If the server script needs data it wasn't provided with, then it uses the app side to retrieve whatever it needed.

      The only thing that really changes in the database according to user needs is adding new columns (or tables on rare occasions).

      Also, the database is the record of somebody's transaction. Even if the business rules change, the records must not... I'd suspect most apps are this way, but then I don't know what you're working on. You're right though, if there's no need to have a record of a calc or rule, then there's probably no good reason to keep it in the database.

      "Both ways every single record is screwed up (or just the important ones that matter in our case)."

      Only if the bug isn't caught. If it somehow manages to get through testing, a bug is usually found pretty quickly. (Think user riots and lots of hand-wringing. :-) We have a lot of controls here because those records translate to paper checks somewhere.

      Anyway, I'm not saying it's the best design, but re-running the business rules on every read struck me as a massive waste of CPU. I couldn't do it in my case, but you have made me think of some situations where it could make some sense.

  17. white-space extremists? by game+kid · · Score: 1

    Perhaps blackmonday should insert a Clayton Bigsby quote here. But if not...

    Say White Space back at ya brother! ...or something.

    --
    You can hold down the "B" button for continuous firing.
  18. Re:Hibernate by Swamii · · Score: 1

    I know you were being sarcastic in your first post, but a lot of people (especially ex-VB6ers) don't understand that Java is JIT'd, or even what is JIT'd means.

    --
    Tech, life, family, faith: Give me a visit
  19. Now... by Anonymous Coward · · Score: 0

    Is this for newbies?

    http://savescooter.sytes.net/

  20. thinking of hibernate, try OJB first... by the-build-chicken · · Score: 1, Informative
    1. Re:thinking of hibernate, try OJB first... by the-build-chicken · · Score: 1

      offtopic my ass...hibernate and OJB are direct competitors to each other...I would say that's directly bloody on-topic.

      Me thinks someone has an affiliation with the hibernate crew

  21. Re:if..then by Rosco+P.+Coltrane · · Score: 4, Funny

    if (java.performace >= c.performace) I.eat_hat();

    Bleh:

    push ax
    push bx
    push cx

    call test_speed_C

    move di,cs:[ofs_testC_result]
    move ds,cs:[seg_testC_result]
    move al,ds:[di+2]

    call test_speed_asm

    move di,cs:[ofs_testC_result]
    move ds,cs:[seg_testC_result]
    move ah,ds:[di+2]

    cmp al,ah
    jb bwahaha_msg

    pop cx
    pop bx
    pop ax

    Chicks dig asm, but I'll concede it's so-so for rapid prototyping though...

    --
    "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
  22. Can anyone tell me... by viiviiviivii · · Score: 1

    Does hibernate compare to what I currently use:

    * Tomcat
    * WebMacro
    * Custom Web Deployment platform.

    The web platform has its own connection pooling, user access management (before template is evin processed), caching (of ANY object or abritary data / response), fully Java OO scripting language (thx to WebMacro), persistence, threading, database query management and resultset object representation.

    Although not as good as the system where I used to work, my system is getting there.

    It is scalable, fast, and very quick to develop on.

    I am at a loss as to why there is so much hype on Hibernate.

    I guess I will have to rtfb :P

    --
    ....... / ........ / ....... .......
    1. Re:Can anyone tell me... by coyote-san · · Score: 1

      Different issues. Hibernate does one thing and does it very well - it persists your Java objects to a database in an efficient way. I generally distrust anything that tries to solve multiple unrelated problems.

      --
      For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
    2. Re:Can anyone tell me... by viiviiviivii · · Score: 1

      I can understand that having an all in one layer is a bad thing.

      The platform I use consists of 4 components which can be removed from the whole.

      1 Template servlet. This is generic and can be integrated with any templating type.. Currently I use WebMacro

      2 Database Core. This handles connection pools, Database Access Objects.

      3 Caching System. This lets you cache database queries, or practically anything else.

      4. Access Control. This system can be hooked into other components (such as WebMacro) to add security to template loading.

      Where I currently work they use hibernate. I am suprised at the slow development time compared to what I can do. With my system the webdeveloper/scripter doesn't change any of the 4 components. They only write the scripts that hook into component #1.

      Bleh... one of these days I am gonna have to make this thing public. There has to be other people wanting to have a faster method to develop web apps with Java.

      --
      ....... / ........ / ....... .......
    3. Re:Can anyone tell me... by HeelToe · · Score: 1

      It sounds like your framework still yields a very page-oriented development style.

      I'd be interested in looking under the covers at what you have, but after working with struts, xml->xslt->browser consumable language, and back in the day plain old servlet/jsp, I've grown weary of page-oriented development of webapps.

      I've recently built a smallish system using tapestry and have been amazed at the boost in productivity it gives me. I also used hibernate in the same project and found it gave a similar boost. Much less fussing with SQL for pretty standard stuff that is easy for the framework to optimize in the general case.

      Comparing this system to another I built about 4 months ago of similar complexity, the tapestry + hibernate combination saved me 1/3 the overall code and configuration lines. If I compare just the stuff related to putting pages up, taking user input, and working with the db, it saved me 1/2 the overall code and configuration lines. Pretty amazing!

    4. Re:Can anyone tell me... by curunir · · Score: 1

      The kind of system you're talking about needs to be compared with the combination of Spring and Hibernate. Some people might include MiddleGen too, though I've worked on projects without it and we've done alright.

      Spring offers the equivalent of #1, though you can also use other templating languages (Velocity, WebMacro) or other MVC frameworks (Struts, Tapestry). In simple cases, JSP with Spring is sufficient. What Spring does really well is to keep you from polluting your view logic with application logic and your application logic with data access logic while at the same time minimizing developer effort. It also provides a ton of features which you can use piecemeal if you don't need all of them.

      Hibernate offers #2 and #3, though #3 and connection pooling are provided through third-party implementations of defined interfaces.

      I believe Hibernate is capable of using any JDBC DataSource, so this can be provided by whatever implementation you want. Spring has perfectly usable implementations, but you can also use ones from Apache or some other provider. This offers flexibility in that a DataSource can be provided as a JNDI resource.

      Caching is handled by one of a number of caching implementations (default is EHCache) which can be selected depending on what features you need. If need be, you can even implement your own caching provider.

      There is an access control system for Spring called ACEGI. From my experience, it's quite capable.

      Obviously, since I've never looked at your implementation, I can't compare this solution with the one you've written. But I can say that it's unlikely that you've created a system which, end to end, offers the power, flexibility and ease of use that Hibernate/Spring do. The trend in these kinds of architectures is increasingly moving away from the single, all-encompassing frameworks like EJB. Instead, like another poster noted, the trend is to use a number of light-weight frameworks which pick one aspect of the overall architecture (MVC, ORM, caching, security, templating, etc) and do it well, with defined interfaces so that other implementations can be swapped easily. While your implementation might work well for you since you know the code and can make modifications to it so that it perfectly suits your environment, it won't be very useful to the general public. For a framework to be useful to the rest of us, it has to be flexible to fit in our environments without having to go in and hack the code. Hibernate and Spring have already proven to be this flexible. You might consider looking at these frameworks and determining whether ideas from your implementation can be included into these frameworks. Both communitites have very active developer discussion forums, so if you feel either solution is lacking in some respect, bring it up there and they can either tell you why they do it differently or incorporate your ideas into their projects.

      --
      "Don't blame me, I voted for Kodos!"
  23. Re:Hibernate by antifoidulus · · Score: 1

    No, JAVA itself has never been an interpreted language. The Java program you write is in fact compiled, but not to native code. It's compiled to bytecode for the Java Virtual Machine, which is a stack machine(not too many physical stack machines exist nowadays, but hey, it seemed good at the time). The bytecode then can be compiled into native format as it runs inside the JVM.

  24. Re:if..then by dnoyeb · · Score: 1

    Java JVMs are typically written in c/c++. Your comparison if flawed.

  25. Cayenne - You'll like it better. by CtAhBeAbNoAy · · Score: 2, Informative

    If you think Hibernate is good, then try Cayenne and really be blown away.
    I am not affiliated with Cayenne at all - just a VERY satisfied customer.
    http://objectstyle.org/cayenne/

  26. Re:if..then by sfjoe · · Score: 2, Funny


    To follow the usual java method naming conventions, your method should be named performAce(). Also, from a readability standpoint, a method named performXXX() should probably return void. Secondly, any C programmer worth his salt will remove some (but not all) of the vowels from a method name to mark his territory (i.e. c.prfrmce).
    Lastly, would you like fries with that hat?

    --
    It's simple: I demand prosecution for torture.
  27. first JVMs by vlad_petric · · Score: 1
    The main problem was that the first JVMs from Sun were outright dumb (it wasn't until 1.3 that they actually included a good JIT in it). First impressions are strong.

    Current JVMs are reasonably fast. In fact, most performance gap between java and C comes from its safety features.

    Safety, however, is very important for web apps. Writing regular sites in C is just asking for C-style memory attacks, like buffer overflows.

    Finally, nobody really complains about python's or perl's speed.

    --

    The Raven

  28. Re:Hibernate by Swamii · · Score: 1

    Exactly my point. When I said "compiled", I was speaking of compiled to native code. Java, C# and other .NET languages are compiled, just not to native.

    Java depends on interpretation and JITing to get to native, while .NET/Mono apps depend on JITing and AOTing to get to native.

    --
    Tech, life, family, faith: Give me a visit
  29. hmm.. by joshsnow · · Score: 1

    I thought this was a discussion about Hibernate, not the Slashdot Urban Myth about Java performance. And in some cases, you'd have to make sure that hat was edible..

    1. Re:hmm.. by Anonymous Coward · · Score: 0

      Is that Slashdot Urban Myth indicating that Java's performance is good or bad?

    2. Re:hmm.. by Anonymous Coward · · Score: 0

      That's obvious; since it would only be a myth if it indicated that performance was good.

    3. Re:hmm.. by Anonymous Coward · · Score: 0

      I thought this was a discussion about Hibernate, not the Slashdot Urban Myth about Java performance. And in some cases, you'd have to make sure that hat was edible..

      Sadly, it's life in the big city that the java apps I've encountered are big fat slow and buggy (and require the kitchen sink of other crap) along with them. But thank god hibernate came along, adding yet another layer of middleware to the infrastructure that java apps will drag along with them.

  30. XDoclet? by coyote-san · · Score: 3, Insightful

    The most important unanswered question: does it discuss XDoclet?

    I know, many people like maintaining configuration files manually. Some people also like nailing their tongue to flaming coals.

    Personally I prefer using a handful of @hibernate and @spring tags. But I haven't found a decent explanation of how to use the tags (e.g., if you use A you must also use B). It can be annoying - I only recently discovered the @hibernate.joined-subclass tag that permits me to use a common base object (for an integrated 'id' space) without creating a "kitchen sink" monster table.

    --
    For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
  31. NOOOOOOOO!!!! by wiresquire · · Score: 1
    Now we're going to see the Java equivalent of emacs vs vi: Hibernate vs EJB vs JDO.

    If you wanted those flame wars, you could just head over to theserverside

    But on a slightly more serious note, it seems that there are moves afoot for reconciliation between EJB and JDO. There's a link with discussions here. Enjoy the reading. theserverside does have some infamous trolls and makes slashdot look like the greatest thing since sliced bread.

    --

    So does Anonymous Coward have good karma?

    1. Re:NOOOOOOOO!!!! by Anonymous Coward · · Score: 0

      Since vi won that old debate, just tell us which one is vi in your list of three.

  32. Re:Java vs Ruby by Agrippa · · Score: 1

    What you meant to type was:

    "I don't want to start a language flamewar, but I just finished reading a slashdot article comparing Ruby on Rails to Java + Spring/Hibernate and was hoping that was enough to interject into this conversation with the hope someone would click on my free Nintendo DS, GC, PS2, Xbox link."

    Don't worry, it happens.

    .agrippa.

  33. Don't fear the SQL by Anonymous Coward · · Score: 0

    Why so damned many complicated wrappers just to hide from SQL? The probability of switching DB vendors is small for most projects (and is further dimished by a financing principle known as Future Value). And, it is usually more efficient machine-wise to take advantage of native vendor SQL features. And, one can use "value micro-wrappers" to avoid SQL hacker injection.

    Learn SQL and embrace it. Stop hiding from it, people. The medicine is growing worse than the desease. The schema is the noun model, not your verbose classes.

    1. Re:Don't fear the SQL by Anonymous Coward · · Score: 0

      It would be nice if relational operators were right in the language, just like math operators.

      For instance, you don't type "OPERATE ON 4, 5 USING ADD", you rtype "4+5".

      Similarly, you shouldn't have to type "SELECT * FROM Customer JOIN Address WHERE Customer.address_id = Address.id", you should just type "Customer JOIN Address" or "Customer > Address".

      Instead of making the database better by eliminating this SQL garbage (is it a programming language? Is it an algebra? What the hell is it?), programmers have chosen to bury it under another layer of code.

      However since SQL isn't formally and consistently defined, this is doomed for failure as well.

      So, what's my point.. erm..

    2. Re:Don't fear the SQL by kimanaw · · Score: 1
      Why so damned many complicated wrappers just to hide from SQL?

      In my experience, the SQLphobia seems to derive from the following:

      • Using developers that simply don't know SQL, and aren't interested in learning (guess its not kewl anymore)
      • Using a DBMS w/ a half-assed SQL implementation
      • Developers that were raised on procedural languages, and just don't "get" declarative, set-theoretic programming
      • Misapplication of SQL databases. Many of the SQLphobic applications really just need an indexed, journaled filesystem to temporarily save web form data. <insert favorite DBMS> just happened to be the solution at hand.

      Case in point: I recently saw a post in another forum in which the OP opined they couldn't produce the actual SQL that the OR wrapper de jure was generating, which they needed to show the DBA in order to get an explanation as to why the SQL was running forever. Of course, suggesting they just write the damn SQL was an unacceptable answer.

      In addition, if apps used more robust SQL implementations, much of the processing would be executed in the DBMS via SQL, which could be a career-limiting move to the army of J2EE hackers out there.

      Another case in point: another thread in this topic attempts to point out how verbose/ugly SQL is with 3 or 4 joins compared to some Hibernate shorthand...conveniently overlooking the fact that, in robust DBMS's, most of the example query would be buried in a nicely maintained view in the DBMS.

      --
      007: "Who are you?"
      Pussy: "My name is Pussy Galore."
      007: "I must be dreaming..."
    3. Re:Don't fear the SQL by kpharmer · · Score: 1

      Seriously can't imagine developing powerful business apps today without writing sql by hand.

      Sure, there's plenty of simple CRUD (create, replace, update,delete) stuff that could be hidden behind something like this if you want. It's tedious stuff - but hardly difficult.

      But beyond that - applications are expected to provide a greater amount of analysis than they were ten years ago. Just doing CRUD isn't enough - people also want to see simple analytical data (trends, totals, medians, averages, rolling averages) all throughout their transactional applications.

      And without learning how to write some sql, you'll end up unable to provide this functionality - the app will be too slow to code and too slow to run it.

    4. Re:Don't fear the SQL by Anonymous Coward · · Score: 0

      I don't know if it is possible or practical to include/embed it directly in every language because the syntax would be different for each language. Further, it is not an imperative language, which tends to conflict with imperative implementation.

      As far as making a relational language that is less COBOL-like, see:

      http://www.c2.com/cgi/wiki?TqlRoadmap

    5. Re:Don't fear the SQL by Anonymous Coward · · Score: 0
      # Developers that were raised on procedural languages, and just don't "get" declarative, set-theoretic programming

      I have run into this a lot. What truly amazes me about this is the stubborn refusal of many such developers to recognize that the procedural approach is sometimes grossly inefficient on production-scaled data, and the utter unwillingness to learn appropriate skills for the task. It's almost as if they're fascinated by the "kewlness" of their theoretical toys and are uninterested in the messy details of making something work well in the real world. I've seen cases where well-written procedural code would not complete in the lifetime of the Earth on a real data set, but runs in 30 seconds using unions and intersections. When I tried to explain the basics of what I had done and why the approach was better, I got a shrug and "that's what DBAs are for" attitude.

      I often see a similar "why is that my problem" whenever usability issues come up: a developer adds a new feature, and to make sense of it, the user has to understand some arbitrary implementation details. When this is pointed out, the developer argues that it performs the required functionality and that we can cover the problem with documentation (that someone else is expected to write).

      That said, I think OR wrappers are a powerful productivity tool (I help maintain an open-source JDO implementation), and can and should be used WHERE APPROPRIATE. They're just another hammer in the toolbox, and a real developer needs to know half-a-dozen hammers, several types of saws, and at least the basics of several different power tools.

  34. Not always by Anonymous Coward · · Score: 0

    Jalepeno is a JIT-based Java VM written in Java. It doesn't have an interpreter--it uses a fast-but-lousy code generator for most code, and progressively higher optimization levels for hotter code.

    1. Re:Not always by Anonymous Coward · · Score: 0

      And it's pretty much the fastest of all Free software VMs out there (faster than Mono and Kaffe, for instance)

      Although it's named Jikes RVM now.

  35. Embedding configuration in the source? Yuck by Anonymous Coward · · Score: 0

    I've always wondered why the XDoclet folk thought it was a good idea to embed the app's configuration in the Java source (via the various @foo tags). As an XDoclet user, can you provide some insight?

    1. Re:Embedding configuration in the source? Yuck by tigeba · · Score: 1


      I'll take a shot.

      In theory the idea is that the "configuration" can be changed at runtime by some person who has the job "Application Deployer". So the developer maintains a n external config file.

      In practice, this "Application Deployer" does not exist, and the developer is the only person who knows what the hell any of the stuff does. This makes the developer grumpy because he/she has to go digging thru a gross XML file to keep it in sync with their code. Whereas with XDoclet, the config information is right there with your code, so no hunting around, no maintaining external files.

      In the case of using Hibernate, it's really a moot point, since you can use XDoclet to generate your XML file for you and still have the ability to change the XML file at runtime.

      As an additional comment, EJB3 (And Hibernate3) address this metadata/config issue by using Java Annotations. I think this will pretty much kill off XDoclet.

    2. Re:Embedding configuration in the source? Yuck by koreth · · Score: 2, Informative
      My mod points evaporated this morning, so I'll reply instead.

      The parent is exactly on the mark. The forced separation of deployer/developer roles in J2EE has caused me to do lots of useless busywork since I first started using it back in the 1.0 days. I'm a contractor, and have worked in a bunch of J2EE shops since then -- and not one of them has ever made use of the ability to tweak the sorts of configuration parameters you'd typically include in your XDoclet tags. But until XDoclet started catching on, they all had to endure the development overhead of maintaining separate configuration files and source files.

      In addition, the parent is also spot on that using XDoclet doesn't stop you from changing the configuration at runtime! The system still reads the configuration files and they can still be tweaked at deployment time if need be. The only thing XDoclet does is save the developer from having to maintain all those annoying XML files by hand while coding.

      If it still bothers you, just think of it as embedding default configuration information into the source. Most applications, I think it's safe to say, do that in one way or another anyway.

    3. Re:Embedding configuration in the source? Yuck by Anonymous Coward · · Score: 0

      In theory the idea is that the "configuration" can be changed at runtime by some person who has the job "Application Deployer". So the developer maintains a n external config file.

      Application deployers exist all over the place -- they're the guys at webhosts who create an account and turn on Miva or whatnot and set it up for the customer. The idea was that you'd use some GUI that spat out the relevant XML bits into the DD, and you could just use one generic tool with a different "skin" for the purpose of whatever app...

      Turns out to be better though when the developers take usability in hand themselves and write their own configuration interface inside the app.

  36. Re:Hibernate by ClosedSource · · Score: 1

    Hey I know it's always open season on VB guys here on Slashdot, but what do they care about Java performance, JIT'd or not?

  37. Re:Hibernate by Anonymous Coward · · Score: 0

    You say Tom-ah-toe and I say interpreted. Let's call the Java compilation off.

  38. On that... by beejay54 · · Score: 1

    On that, would someone take time time and write a nice e-Book on JSP/JavaServlet for WikiBooks? Please! It'll only take a moment ;)

    --

    -- Bored? Check out my Portfolio
  39. Sqlmaps by Espectr0 · · Score: 4, Informative

    For those of us that want a simpler, faster, easier to use framework and just want to map your own queries to objects, is much better. And for those that like .NET it is available in that platform too.

    Here's an example on how to execute a query called "myquery"

    MyObject myobject = (MyObject)sqlMap.queryForObject("myquery",myintege r);

    And here is the query declaration:

    <select id="myquery" parameterClass="java.lang.Integer" resultClass="mypackage.MyObject>
    select * from mytable where id = #value#
    </select>

    Simple query to object mapping

    1. Re:Sqlmaps by hammeredpeon · · Score: 1

      unfortunately, you left off the part where you have to search for 3 hours to find out how to do something, and even then it takes some luck.

      i use ibatis and i like it a lot. that said, it took me many hours to find out how to do things that should have been in the manual. nothing pisses me off than seeing the title of the section i want and under it "".

      but, yeah, ibatis is pretty sweet.

      --
      best college pickem site ever: pickem.terrbear.org
    2. Re:Sqlmaps by Anonymous Coward · · Score: 0

      I picked it up for a J2EE project at the end of 2004 and got it up and running very quickly - including using some very complex dynamic queries. I never had a problem with the documentation, plus the creator of it replies within a day to any questions.

      I guess you must've been using an older version or something (I used version 2).

    3. Re:Sqlmaps by StrawberryFrog · · Score: 1

      iBATIS looks at first glance like Teh suck. Where's the basic documentation?

      ie, From the front page of http://www.ibatis.com/ click on the small "Wiki, FAQ, IRC" link. Near the bottom of that page, locate a tiny "FAQ" link and click it, and go to a page that tells you that "Frequently 20Asked 20Questions This page does not exist yet." And suggests I try "Frequently Asked Questions" instead. Click this, and at long last you get to the FAQ

      - The FAQ does not answer the questions "What is iBATIS?", "What does iBATIS do?", "why/when would I want to use iBATIS?" or any closely related question. I get bored and wander off in search of a meaningful interaction.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    4. Re:Sqlmaps by Decaff · · Score: 1

      Here's an example on how to execute a query called "myquery"

      MyObject myobject = (MyObject)sqlMap.queryForObject("myquery",myintege r);

      And here is the query declaration:


      Here it is for JDO:

      Query q = persistenceManager.newQuery(MyObject.class,"id == myint");
      q.declareParameters("Integer myint");
      q.setUnique(true);
      MyObject result = (MyObject) q.execute(myinteger);

      No need for external files describing the query. No need to worry about which dialect of SQL you are using (the full range of relational capabilities is available in JDO query language).
      No need to worry about optimising your SQL (a good JDO product will do this for you anyway).

      There are dozens of vendors who provide JDO, including open source products, and you aren't limited to data stores that can understand SQL.

    5. Re:Sqlmaps by Espectr0 · · Score: 1

      iBATIS looks at first glance like Teh suck. Where's the basic documentation?

      Look harder. There is a developer guide (pdf), a generic guide (pdf) and a tutorial (pdf) on the "downloads" page.

      So far everything i have ever wanted is on there. Granted, i would have preferred html documentation and javadocs, but so far i haven't needed to look at the source

  40. It was unfairly judged, but that doesnt make it OK by Paradox · · Score: 1

    Yeah, Java got a bum rap early on for speed. But people quickly showed that in many of Java's preferred domains, I/O latency was by far the primary reason for speed issues.

    Then, people starting coding GUI apps in Java, with a misguided notion that it would be truly portable GUI apps. This is not only untrue, but a lot of people got angry because their sluggish machines couldn't handle it. This continues even today. A common comment about Eclipse, for example, is that it's a terrific IDE so long as you have a very fast machine.

    These days, when you hear educated people complain about Java, it's not usually because of the speed issues anymore. It's usually language issues (Java needs that, Java shouldn't have this, etc.). The validity of these complains depends entirely on your viewpoint.

    --
    Slashdot. It's Not For Common Sense
  41. Isn't an SQL writer? Please clarify. by fireboy1919 · · Score: 3, Informative

    From the Hibernate homepage:
    The Hibernate Query Language, designed as a "minimal" object-oriented extension to SQL, provides an elegant bridge between the object and relational worlds. Hibernate also allows you to express queries using native SQL or Java-based Criteria and Example queries.

    So...I'm guessing you're using the phrase "SQL writer" in some new and unusual way. Does "SQL writer" mean "writes SQL output to standard output"? Do you mean "SQL optimizer?"

    Hibernate can only talk to RDBMSs that use SQL. It writes SQL to them and recieves SQL from them.

    --
    Mod me down and I will become more powerful than you can possibly imagine!
    1. Re:Isn't an SQL writer? Please clarify. by JavaRob · · Score: 1

      Informative? Hm.

      Read the grandparent post ("I'm heavily thinking about shifting from handwritten SQL and the Spring framework to hibernate") to get the context, and it's not hard to figure out.

      Tip: substitute "generator" for "writer". Then try again.

  42. Hibernate is right... by Anonymous Coward · · Score: 0

    switch to .NET...all J2EE IDE's suck...

    1. Re:Hibernate is right... by Brendonian · · Score: 1

      Well seeing as IntelliJ had to create a plug-in to bring Visual Studio up to IDEA's level........I'd say Visual Studio actually sucks. Have you even used that P.O.S. After using IDEA it makes me wretch.

    2. Re:Hibernate is right... by Anonymous Coward · · Score: 0

      Never heard of IntelliJ IDEA but ill give it a try and see if J2EE should take a long nap...

  43. Bogus! Was:Don't fear the SQL by retendo · · Score: 1

    From Hibernate in Action,

    Would you rather type:

    select ... from BID B inner join ITEM I on
    B.ITEM_ID = I.ITEM_ID inner join CATEGORY C on
    I.CATEGORY_ID = C.CATEGORY_ID inner join BID SB on
    I.SUCCESSFUL_BID_ID = SB.BID_ID where C.NAME like 'Laptop%' and SB.AMOUNT > 100

    than this:

    from Bid bid join bid.item item where
    item.category.name like 'Laptop%' and
    item.successfulBid.amount > 100

    Your call.

    You do have a point about the schema being the noun but that doesn't really fly in a multi-tier system. You could easily argue that a single tier system is the best approach, thereby using the schema as a noun. There are serious benifits to this but I haven't seen a system that provides the necessary front end technology straight on top of a database. Although I dissagree with you I do like the lines that you seem to be thinking along.

  44. Re:Hibernate by k98sven · · Score: 1

    FYI, the various .NET/Mono languages are all JIT'd, zero interpreting. Java is much the same now, it was just originally designed to be an interpreted language.

    Wrong, and wrong.

    First, off JIT doesn't mean "zero interpreting", no JIT VM compiles all code. It's simply not efficient to do so. And all that code is interpreted.

    Second, Sun's first VM for Java was an interpreter, but Java was not at all designed to be an interpreted language. In fact, it was designed with allowing JIT VMs in mind. (And Sun's JIT VM was publicly released in '96, only two years after Java itself)

    Also, .NET/Mono have ahead-of-time (AOT) compilation, meaning you can compile your dll libraries or exe applications to native code at install time.

    Yes, but please note that this is performing the compilation the JIT does ahead-of-time, which again isn't all of code. So it's not the same thing as conventional compiling to native code. (Although the difference isn't big performance-wise)

  45. Re:Bogus! Was:Don't fear the SQL by StarsAreAlsoFire · · Score: 1

    I'd rather call

    MyObject obj = (MyObject)getmydamnobject(Object searchParamA, Object searchParamB);

    Hell, I don't even want to have to cast it; what the hell else would I want? Why the hell would I try to cram an integer into a custom datatype?

    Sadly.... ah fuckit.

    Looks nice. I wish this all took less mental overhead; not saying it is *hard* persay -- just so much crap in the attic to pull down, dust off and use every time we need to write a decent prog.

    We really are the mages of our time -- waving our hands in funny, highly scripted ways and producing... well, hopefully something interesting, but generally... I digress.

    The above paragraph is language neutral -- we all have our own rituals. I am not referring to goats, silver daggers and moonlight here either people.

  46. Hibernate makes you re-express the data model by blackhedd · · Score: 1

    Hibernate's fans say it's the "right" way to handle extremely large, complex data models, especially if they already exist.
    What you have to do is write yourself a new Java class (according a to big complex set of rules), one for each entity in the model. And there are a lot of different ways to handle various association-types and cascading-persistence requirements.
    Once you've done all this, you have Hibernate's methods for "easily" loading and saving the objects.
    So in a way you have to re-express an already-existing data model in code.
    Anybody with experience in the tool care to argue whether it's worth the effort?

    1. Re:Hibernate makes you re-express the data model by Anonymous Coward · · Score: 0

      The short answer is you don't have to make that effort. Use middlegen to autogenerate your Hibernate DO classes based on your database schema. You can even add custom code to your template in case you'd want to enhance your DOs yet still be able to run a new autogeneration in case your database schema changes.

  47. 1 Word by Anonymous Coward · · Score: 0

    portability

  48. Re:Java vs Ruby by Anonymous Coward · · Score: 0

    Sure. Fuck off, spammer.

  49. Re:Bogus! Was:Don't fear the SQL by Anonymous Coward · · Score: 0

    Some RDBMS can use "natural joins" which shorten join code. Or, one can use views for frequently-used join patterns. Joining is usually not where the bloat is anyhow if the schemas are well-designed in my experience.

    I don't think it makes sense to have a slightly-different-than-SQL syntax. It increases the training and confusion. Better to stick with a standard unless you get significant benefits by deviating. If you are going to overhaul SQL, then let's go all the way and start over.

  50. It's the "write once" paradigm by coyote-san · · Score: 1

    Here's an analogy - you're going on vacation. Deciding whether to go to Orlando or Cabo is a top-level decision comparable to what a deployer makes. The implementation of the embedded software in the navigation avionics of your flight is comparable to what XDoclet generates. You shouldn't touch it, not without a compelling reason.

    Once you accept this the benefits of using XDoclet are obvious. First, you only have to update information once - the configuration file and generated source files will be automatically updated. You don't have to worry about getting called into an urgent meeting and forgetting to update the fourth auxillary file.

    Second, the XDoclet tags help document the nature of the fields and how classes are related. E.g., if I see

    @hibernate.property not-null="true" unique="true" length="20"

    I know a lot more about the field than "String" alone tells me. It's also another example of "write once" since I don't have to worry about a block comment getting out of sync with a configuration file.

    --
    For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
  51. Re:Chappelle? by Anonymous Coward · · Score: 0

    How could people not have found that funny???

    Aren't there Dave Chappelle Show fans in here??

    Geez...

  52. Re:Makes sense by symbolic · · Score: 1


    To me it makes somse sense to abstract the data access away from the business application. This metholdogy embraces the whole notion of object-oriented design, since switching out the data means you won't have to touch the business app - just the interfaces.

  53. Re:Bogus! Was:Don't fear the SQL by kpharmer · · Score: 1

    Ok, here are a few reasons why I *wouldn't* want to use that hibernate syntax:

    1. how do I separately validate the syntax & query results? Can I run it in on a command-line? In a query tool, etc?

    2. how do I diagnose subtle problems caused by hibernate join failures? Exactly what sql is it running?

    3. how much flexibility does it have? Can it handle outer joins? Subselects? Group bys? Aggregate functions? No? Then why use such a poor subset? Yes? Then why not just use sql?

    4. How do you leverage dbms-specific features? Yes, I know that it's best to stay generic, but when you need to add more analytical queries to your app (to deliver something beyond simple CRUD), you want to use olap functions, etc. Now, yeah, you could do this in your app. But it'll be slower. *Far* slower: you might have to process a hundred thousand rows - and the database will do it in less than a second. Your app? Maybe 5-10 seconds?

    My recommendation is to learn sql, use standard sql whenever possible for portability. But learn the advanced sql required to deliver robust functionality. And when required be prepared to dip into vendor extensions.

    Or stay away from huge, challenging, and powerful business applications.

  54. Rule #751 by Anonymous Coward · · Score: 0

    If you choose a programming language based on its inclusion of unsigned types, you're an idiot. You're an old troll that will never succeed in the real world.

  55. Re:Makes sense by Tablizer · · Score: 1

    This metholdogy embraces the whole notion of object-oriented design, since switching out the data means you won't have to touch the business app - just the interfaces.

    SQL is already an interface, and a rather high-level one at that. Putting interfaces around interfaces is overkill. IMO people wrap SQL because they don't like it or don't know it, not necessarily because it is inherently "bad". It "encapsulates" many collection-oriented concepts into a fairly decent standard. OO tends to allow roll-your-own collection oriented interfaces, producing inconsistcy and often reinvent the wheel in the process.

  56. Hibernate in a new performance benchmark by Chris_Stanford · · Score: 1

    The new database benchmark "PolePosition" shows how much performance Hibernate costs:

    http://polepos.sourceforge.net/

    For overcoming the object-relational mismatch in resource constrained applications, like on mobile platforms, or where performance matters, you might want to look at the open source object database db4o (http://www.db4o.com/ which is up to 44x faster in the benchmark (http://www.db4o.com/about/productinformation/benc hmarks/).

    Chris

  57. Two table joins? by MemoryDragon · · Score: 1

    Well in m:n relations in hibernate you need at least three tables beneath it, so no two table join limit there. As for the queries, yes simplistic queries are faster as long as you dont hit a cache. In the typical webapp 90% of the operations are done over and over again on almost the same data, and there hibernate can shine. You can add a query cache if your query is constantly started again and again, you can start to cluster on application cache level once you hit a maximum of possible site users your VM can handle so that you still run against one DB but have clustering due to a cluster cache on the Object level.

    You dont have to write any JDBC to object binding code which almost every plain JDBC app does. You basically are 99% database independent thanks to the abstracted query language and abstracted data type mapping. You have automated connection management, to keep the number of connections small.

    The list of stuff Hibernate adds to this mix is endless. But dont expect to run a single query on a plain table as fast as one in JDBC. The reason for this is, all this caching and query translation, object mapping stuff comes with a small constant speed penalty which goes away once you run into the caches or you have to do bigger work in JDBC and have to start to implement the caching and mapping yourself (which you almost always have to do)

    You will start to love hibernate once a customer or your boss decides to switch databases for political reasons and wants a reasonable upgrade path.

  58. Re:Hibernate by Anonymous Coward · · Score: 0

    Nice trolling. Java programmers don't go around 'nulling variables', the gc takes care of any object that isn't reachable.

    As for Swing, yup - it needs fairly beefy hardware, but certainly beats the alternatives.

  59. Re:Bogus! Was:Don't fear the SQL by Anonymous Coward · · Score: 0

    I personally like to keep the abstraction down, so I have so far avoided any object-relational mappers. (My favourite language is Perl, too, so those technologies you hear most about aren't even available.)

    In many cases, the query needs to be written only once -- just like some other posters noted, wrapping the query inside a method and then calling it by its name is a pretty nice way to do whatever you need, from the application viewpoint.

    From what it looks like, though, Hibernate has reinvented a simplified version of SQL suited for object stuff -- of course the hidden cost here is that for your simple query to work it needs to be backed up by some XML configuration. (Which looks a tad involved, just like SQL in general looks a tad involved.) But on the other hand, once the XML is there, any query should just work! So probably it's a win, after all: one painful configuration, then easier usage later on.

    But in many cases you get past painlessly with just SQL views, which allow you to express the queries in terms so simple that even a manager could understand it.

    I still hand-craft my SQL due to having worked with SQL for something like 5 years. It isn't bad, and in many cases it keeps typical web application very simple. Here's how the code for a view usually looks like:

    $template->{param} = $dbi_wrapper->execute_sql($sql, @the_placeholder_values)->fetchall_arrayref({});

    It's not pretty for the uninitiated, but it means that a typical webapp is driven by the SQL and the template language chosen (which could be Embperl or TT or something else). The only work for the code is validating the placeholder values and choosing the right SQL. I doubt this would be any faster or simple with a framework, though I _might_ be proven wrong.

  60. Re:if..then by Decaff · · Score: 1

    if (java.performace >= c.performace) I.eat_hat();

    open_url("http://www.shudo.net/jit/perf/");
    che ck_section("SciMark 2.0");
    eat_hat();

  61. Bhavaya by The+Grassy+Knoll · · Score: 0

    I believe Bhavaya does along the same lines?

    .

    --
    They will never know the simple pleasure of a monkey knife fight
  62. .NET version of Hibernate by bmalnad · · Score: 0

    There is a .NET port of Hibernate here: http://nhibernate.sourceforge.net/

    --
    Free Scotland!
  63. Re:It was unfairly judged, but that doesnt make it by Decaff · · Score: 1

    Then, people starting coding GUI apps in Java, with a misguided notion that it would be truly portable GUI apps. This is not only untrue

    That is odd. As I sit here typing there are two major Java GUI apps open on my desktop, which have good interfaces and work without change on Windows and Linux. I have developed my own Java GUI apps and have had no porting problems for years. How is this untrue?

  64. Re:Bogus! Was:Don't fear the SQL by joib · · Score: 1


    Ok, here are a few reasons why I *wouldn't* want to use that hibernate syntax:


    It's been a year or so since I last used Hibernate, but IMHO, it rocks compared to hand-written SQL. Now, for your points:


    1. how do I separately validate the syntax & query results? Can I run it in on a command-line? In a query tool, etc?


    There exists a GUI tool for this, see http://www.hibernate.org/259.html


    2. how do I diagnose subtle problems caused by hibernate join failures? Exactly what sql is it running?


    You turn on the sql output switch in the config file, and look at the sql which depending on your configuration is output to the console or the log file.


    3. how much flexibility does it have?


    A lot. :-)


    Can it handle outer joins?


    Yes.


    Subselects?


    Yes.


    Group bys?


    Yes.


    Aggregate functions?


    Hmm, I don't remember, but I suspect not. Of course it is possible and advisable to use both SQL and Hibernate in the same application.


    4. How do you leverage dbms-specific features? Yes, I know that it's best to stay generic, but when you need to add more analytical queries to your app (to deliver something beyond simple CRUD), you want to use olap functions, etc. Now, yeah, you could do this in your app. But it'll be slower. *Far* slower: you might have to process a hundred thousand rows - and the database will do it in less than a second. Your app? Maybe 5-10 seconds?


    In general, Hibernate has pretty good support for stuff that you can find in standard SQL. Also, the architecture of Hibernate makes it extremely suitable for CRUD style stuff, e.g. the caching works very well if the app has any notion of working set, and Hibernate saves huge amounts of time when retrieving complicated object graphs compared to writing SQL by hand. For reporting, OLAP etc. Hibernate is less well suited. The general consensus seems to be to take advantage of Hibernate for CRUD stuff and do complicated reporting/OLAP/whatever in (vendor specific) SQL.


    My recommendation is to learn sql, use standard sql whenever possible for portability. But learn the advanced sql required to deliver robust functionality. And when required be prepared to dip into vendor extensions.


    My recommendation to you is to at least take a look at Hibernate; it makes you look less like a fool when people see that you have at least a vague idea of what you're talking about. ;-)


    Or stay away from huge, challenging, and powerful business applications.


    Yeah, that's what I do these days, business apps tend to be very boring. Fortran (and computational physics) forever!

  65. Re:It was unfairly judged, but that doesnt make it by Paradox · · Score: 1

    Many people, myself included, have made GUI apps with Java. And everyone goes in-full of optimism-and says, "This will be easy! Java makes it so that we can deploy on multiple platforms!"

    While it's true, strictly, it's not really what people expect. Java means your code can execute on multiple platforms without a recompile. This is great, but it doesn't help you with deployment, OS integration, and usability. A good GUI application must address all those things, and getting it right across all platforms is very difficult (and sometimes impossible, each platform has different rules about usability).

    There is also the performance issues. If you choose Swing, then you do incur a penalty, and this penalty varies depending on what Swing theme you select and what platform you choose. Often, these choices are the 'least of many evils'.

    I've also developed apps for multiple platforms using Qt, and I have to say that the Qt experience in C++ and the Java experience were, all in all, about equal. Which is to say better than it would have been 10 years ago, but not painless by any stretch of the imagination.

    --
    Slashdot. It's Not For Common Sense
  66. Hardware ? by Anonymous Coward · · Score: 0

    Why is this under the Hardware tag ?

    It's OK - this is a rhetorical question, like "Why the Editors don't ?"

  67. Re:Makes sense by symbolic · · Score: 1


    To an extent I agree, but there is still the issue of converting tables back and forth from the object models used in the business app.

  68. Re:It was unfairly judged, but that doesnt make it by Decaff · · Score: 1

    While it's true, strictly, it's not really what people expect. Java means your code can execute on multiple platforms without a recompile. This is great, but it doesn't help you with deployment, OS integration, and usability.

    I would say that it really does help significantly. I don't know of any other major language that is as easy to deploy, and I have had decades of experience. It sure isn't perfect, but compared to library and versioning issues, even within a supposedly single OS like Windows, Java has been a dream for my work.

    A good GUI application must address all those things, and getting it right across all platforms is very difficult (and sometimes impossible, each platform has different rules about usability).

    I would agree, but Java gets it better that almost any other system, I would argue. It gets you 90% there, and should be praised for that.

    There is also the performance issues. If you choose Swing, then you do incur a penalty, and this penalty varies depending on what Swing theme you select and what platform you choose. Often, these choices are the 'least of many evils'.

    I think is is far, far less of a problem that it used to be. Things have improved hugely since Java 1.3.x, and now with 1.5.x, I am finding Swing apps extremely responsive most of the time.

    I know Java isn't perfect if you want to write apps that tie in to each platform in detail, but for cross platform apps, I think it is outstanding.

  69. I won't argume much... by Paradox · · Score: 1
    I won't argue this point much further, since it's certainly subjective and also varies wildly depending on when you tried to use Java for this purpose.

    But I will reiterate that most people who dislike Java dislike it for the design of its library and its linguistic features and its developer culture, not because of any flaws in its implementation.

    I don't want to poke a hornets nest, so please keep in mind I work with Java nearly every day, and the other language I get paid to work with is C++ (which I also dislike, somewhat). Here are some examples:
    1. Java is very verbose. Some argue that this is for improved readability, and some feel that this is a hollow argument.
    2. Java is statically typed in a lexical fashion, a-la C++ and C. While there are reflection featues, they are not as strong as the features in a language like Python.
    3. There are a great many design flaws in Java's standard library. For example, InputStream and OutputStream do not have a common root or delegate, so any code written that is applicable to both input AND output must be either abstracted into another class or duplicated.
    4. Some people feel Java's new template system is unacceptable because it does not provide Liskov-like substitution.


    These are just a few examples of what I was really getting at.
    --
    Slashdot. It's Not For Common Sense
    1. Re:I won't argume much... by Decaff · · Score: 1

      But I will reiterate that most people who dislike Java dislike it for the design of its library and its linguistic features and its developer culture, not because of any flaws in its implementation.

      I really disagree that there is a single developer culture with Java - there is a very, very wide range of developer types who use it, from the embedded application producer, the game developer, the tool developer and the various types of website/server application developer, and there are frequent clashes between different cultures.

      As for the library, there is nothing to stop developers writing their own!

      Java's syntax and capabilities are both its flaw and its success. There are far more revolutionary languages that should have been successful (like Smalltalk), but Java needed to be usable by mainstream developers without any major transition to new ways of working, hence the C syntax. I don't like this, but I can see the point.

    2. Re:I won't argume much... by Paradox · · Score: 1

      As for the library, there is nothing to stop developers writing their own!


      The only reason anyone would do this is to open source it. There is no reasion for a company to do it, unless they have VERY long term plans for Java.

      Further, they'd need to be willing to hack the runtime some. What if they want to add a new class with String-like functionality? In order to get operator overloading, which Sun seems to think they needed to make the Java Standard Library, you'd have to do that.

      I'll agree that Java's syntax was both it's reason for success and its greatest flaw, though.
      --
      Slashdot. It's Not For Common Sense
    3. Re:I won't argume much... by Decaff · · Score: 1

      The only reason anyone would do this is to open source it. There is no reasion for a company to do it, unless they have VERY long term plans for Java.

      I disagree a bit. There does seem to be this lazy attitude these days to criticise libraries that are reasonably easy to write yourself. A decade or so ago, developers would not have complained about putting together a few hundred or thousand lines for such a library. Now, they have to be 'spoon-fed' everything. Maybe I am getting old and cynical!

      Further, they'd need to be willing to hack the runtime some. What if they want to add a new class with String-like functionality? In order to get operator overloading, which Sun seems to think they needed to make the Java Standard Library, you'd have to do that.

      I'm not sure. There are plenty of classes which have behaviour which syntactically would look better with operators, but most developers seem to manager without : java.math.* etc.

    4. Re:I won't argume much... by Paradox · · Score: 1
      I'm not sure. There are plenty of classes which have behaviour which syntactically would look better with operators, but most developers seem to manager without : java.math.* etc.


      I think operator overloading got a bum rap. Many developers, myself included, saw people abusing it and said that the horror outweighed the benefit. Now, without it, the landscape is pretty bleak.

      Also, Sun saw fit to use it, but we cannot. This says something about Sun's attitude, I think.
      --
      Slashdot. It's Not For Common Sense
    5. Re:I won't argume much... by Decaff · · Score: 1

      I think operator overloading got a bum rap. Many developers, myself included, saw people abusing it and said that the horror outweighed the benefit. Now, without it, the landscape is pretty bleak.

      I think this is exaggerating - it is a minor matter, perhaps?

      Also, Sun saw fit to use it, but we cannot. This says something about Sun's attitude, I think.

      Java was always designed to be simple, and avoid the on-going horrors of languages like C++. This simplicity means that compilers are simple and implementations can be simple. It also allows huge amounts of automatic optimisation by technologies such as Hotspot. Java was not designed to be concise or elegant, it was designed to be small and very clear for readers and compilers to understand.

      Interestingly, there is a new Java technology that will allow operator overloading, closures etc. It is called Groovy, and is now a JCP JSR. This is a dynamic scripting language that can seamlessly use existing Java classes and can in turn be compiled to classes for use by pure Java. Groovy classes can freely mixed with Java classes in any application. This will allow the flexibility that many of us would like, but in a clearly defined and delimited area.

    6. Re:I won't argume much... by Paradox · · Score: 1
      I think this is exaggerating - it is a minor matter, perhaps?
      No. Not having it sucks. Just because I can abuse a feature doesn't mean I will. If it's so bad, why is Sun using it on its string class? The answer to "why" is obvious, because it made the class easier to use. But, I am prevented from making that decision.

      It would make no difference to the compiler's complexity to add operator overloading because, obviously, it's allready there in some capacity.

      This simplicity means that compilers are simple and implementations can be simple.
      The java compiler and runtime are not simple. They incorporate some of the best JIT stuff in the commerical landscape. There are better things out there, but they aren't as well known or used.
      Java was not designed to be concise or elegant, it was designed to be small and very clear for readers and compilers to understand.
      Funny, where I come from concise, elegant code is easy to read. But that's just us Python and Ruby folks being quirky, I guess. I mean, sure, Python is called Executable Pseudocode and Ruby has been referred to as a "joy" to read.

      But hey, I'll admit maybe some people like typing 20 characters just so that they can write a string to the screen, and maybe there are people who like having to fake anoymous functions with an interface and class to get nice internal iteration or pleasantly abstract code. Obviously, I am not one of them. I've seen the light, or the dark, or the other side, or whatever.

      Interestingly, there is a new Java technology that will allow operator overloading, closures etc. It is called Groovy, and is now a JCP JSR. This is a dynamic scripting language that can seamlessly use existing Java classes and can in turn be compiled to classes for use by pure Java. Groovy classes can freely mixed with Java classes in any application. This will allow the flexibility that many of us would like, but in a clearly defined and delimited area.
      I've played with Groovy, it's an interesting project. Someone over there is starting to get what we love about dynamic and functional languages, and they're trying to introduce it to Java users. However, it shares the same weakness as JRuby or Jython. It's too alien, and there are many people out there who, having spent years mastering Java, feel extremely threatened when someone suggests their hard-earned knowledge may not always be applicable.
      --
      Slashdot. It's Not For Common Sense
    7. Re:I won't argume much... by Decaff · · Score: 1

      No. Not having it sucks. Just because I can abuse a feature doesn't mean I will. If it's so bad, why is Sun using it on its string class? The answer to "why" is obvious, because it made the class easier to use. But, I am prevented from making that decision.

      I think it is like this: Java (for better or worse) is based on years of experience of how projects go wrong because of poor developer and coding techniques. Just because you and I have no problems with understanding what is happening with operators, that does not mean that everyone does, especially those who are trying to support others' code. The problems that features like operator overloading and multiple inheritance introduce for code maintainability aren't just matters of opinion - they are well established. So, we use a less-than-perfect language knowing that there are likely to be long-term advantages.

      The use of + in String was because that has been well-established for decades in languages like Pascal.

      Well, that's what I think the Java designers were thinking!

      However, it shares the same weakness as JRuby or Jython. It's too alien,

      I really don't see this at all, as those languages are virtually identical to the C-based counterparts. Groovy is about as different from Ruby as Ruby is to Python - there is nothing fundamentally alien about it because it is hosted on JVM.

      and there are many people out there who, having spent years mastering Java, feel extremely threatened when someone suggests their hard-earned knowledge may not always be applicable.

      Personally, I don't care! Providing I can mix and match classes from different languages cleanly, I welcome the chance to use new languages in this way. I guess I have always believed that IT knowledge always goes out of date, and the only thing that counts is general experience and a willingness to learn.

    8. Re:I won't argume much... by Paradox · · Score: 1
      I really don't see this at all, as those languages are virtually identical to the C-based counterparts. Groovy is about as different from Ruby as Ruby is to Python - there is nothing fundamentally alien about it because it is hosted on JVM.


      That's the problem. It's too different from Java. You're right about the execution environment not mattering.


      Personally, I don't care! Providing I can mix and match classes from different languages cleanly, I welcome the chance to use new languages in this way. I guess I have always believed that IT knowledge always goes out of date, and the only thing that counts is general experience and a willingness to learn.


      Many of us have this dream, but it's a very progressive dream and there are a lot of people out there who wouldn't like to see it. It makes me want to help out with Parrot, but I don't have the time.
      --
      Slashdot. It's Not For Common Sense
  70. Re:Bogus! Was:Don't fear the SQL by kpharmer · · Score: 1

    Hey thanks for the informative reply. Still suspicious of the value of something that thinly skins simple sql & doesn't help with complex sql - but I'll have to take a closer look.

    ken

  71. Re:Makes sense by Anonymous Coward · · Score: 0

    To an extent I agree, but there is still the issue of converting tables back and forth from the object models used in the business app.

    Toss OOP then.

  72. Re:Hibernate by rel4x · · Score: 1

    I know this comment will never get seen, but I'll bite anyways. The situation I'll give may not be quite right, because I'm writing this on the fly... Situation:Accessing a LARGE ArrayList. This is the last time it will be needed. Due to the function that it calls during it's loop, you get an out of memory error. Here's what you might do... for(int i=0; imyList.size(); i++) { iUseMemory(myList.get(i)); myList.set(i,null); } ...and voila. It helps out the memory problem. Garbage Collector is great, but can't do everything.

    --

    Before you mod me funny, think, perhaps I was insightfully funny?