667481 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 259 Messages: 259 Messages: 259 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

EJB 3.0 and JDO 2.0: Views from both sides

Posted by: Dion Almaer on May 08, 2004 DIGG
Gavin King recently wrote an entry discussing EJB 3.0 where he discussed his thoughts on JDO. Abe White of Solarmetric has posted a response to his comments, and has given TSS permission to post them.

Firstly you may want to read Gavin's blog on EJB 3.0
JDO FUD by Abe White

In his blog, Gavin King of Hibernate recently posted his thoughts on EJB 3. In the second half of his essay, Gavin attempts to justify the EJB 3 expert group's decision to develop their own POJO persistence solution (based on Hibernate and tied to relational databases) rather than adopting JDO.
Gavin states that there are three problems "right at the heart of the JDO spec" that make it unsuitable for an ORM persistence solution:
JDOQL, field interception, and specification complexity. Let's examine each in turn:

1. JDOQL

Gavin refers to JDOQL as "an abomination". He doesn't back up this claim with evidence or examples, so unfortunately we'll have to talk about JDOQL in a general sense rather than refute any specific arguments.

JDOQL consists of Java boolean expressions and Java field traversals.
Boolean expressions are used to form the equivalent of SQL's WHERE and HAVING clauses. Field traversals are used to form the equivalent of SQL's SELECT, GROUP BY, and ORDER BY clauses. Basically, if you know Java, then you know JDOQL. It is difficult to see how this constitutes
an "abomination". But rather than take our word for it, let's look at
an example:
Query q = pm.newQuery (Employee.class);
q.setResult ("firstName, lastName, department"); q.setFilter ("age > 50 && !retired && department.name == 'Marketing' && projects.isEmpty ()"); q.orderBy ("employeeId ascending");

We think it is pretty clear to anyone who knows Java exactly what this query does. It selects the first name, last name, and department object of every employee who is older than 50, not retired, in the marketing department, and who is not working on any projects.
Presumably this company is about to force some retirements :). The query orders the results by the employee id number. If we had wanted to, we could have left out the setResult call and just gotten Employee objects back rather than individual field values. Or we could have used setResult, possibly in combination with setGrouping, to perform aggregations.

The equivalent query in HQL is:
Query q = ses.createQuery ("select emp.firstName, emp.lastName, emp.department "
   + "from Employee as emp "
   + "where emp.age > 50 and emp.retired = false and emp.department.name = 'Marketing' and size(emp.projects) = 0 "
   + "order by emp.employeeId asc");

We won't turn Gavin's contention on its head and say that HQL is "an abomination". It isn't. But it is a little less obvious to the average Java developer, and the fancier the query, the less obvious it becomes (the above example is a very simple one). Some might prefer HQL to JDOQL, but that's all it is: a matter of preference. Others prefer JDOQL to HQL. A vendor could easily create both HQL and JDOQL front-ends to JDO queries; functionally, they are more or less equivalent. This seems a little odd, since according to Gavin, JDOQL represents a problem "right at the heart of the JDO spec".

Finally, it is worth noting that both EJB 3 and JDO 2 allow direct SQL queries.

2. Field Interception

Gavin's second complaint about JDO is that it's use of field
interception is "a completely inappropriate way to implement POJO
persistence". He gives only one reason for this blanket assessment:
"The biggest problem rears its head when we combine lazy association
fetching with detached objects. In a proxy-based solution, we throw an
exception from unfetched associations if they are accessed outside the
context of the container. JDO represents an unfetched association using
null. This, at best, means you get a meaningless NPE instead of a
LazyInitializationException. At worst, your code might misinterpret the
semantics of the null and assume that there is no associated object.
This is simply unnacceptable, and there does not appear to be any way
to fix JDO to remedy this problem, without basically rearchitecting
JDO."

This statement is, in fact, totally false. JDO 2 will throw an
exception when attempting to retrieve unfetched values from a detached
object. It will not return null. It acts exactly like Gavin thinks a
proper detachment strategy should. And we did not "rearchitect" JDO to
accomplish this; JDO 2 is 100% backwards compatible, with a grand total
of one rarely-used operation from JDO 1.0 being deprecated.


3. Complexity

Gavin's final complaint is about complexity. "The JDO spec is just
absurdly over-complex." He provides three concrete examples:
a. JDO defines four identity types, "where one would do".
First, one of the four JDO identity types -- nondurable identity -- is
an optional part of the specification that is meant to support
persistent objects that don't need unique identities: things like
persistent log messages. As it is optional and is used to solve a
problem that EJB 3 persistence cannot solve, it hardly seems fair to
include it as a sign of JDO's complexity over EJB 3.

So we're down to 3 identity types. These are: datastore identity
(identity value managed by the persistence service), application
identity (identity value managed by the application; i.e. primary key
fields), and simple identity. Simple identity is just a special case
of application identity in which there is only one primary key field.

Interestingly, Hibernate has all three of these identity types as well
(though datastore identity in Hibernate has limitations). But since
this is "absurdly complex", and "one would do", we're curious as to
which two of these three identity types Gavin plans on removing from
Hibernate.

b. JDO defines "umpteen lifecycle states and transitions, when there
should be just three states (persistent, transient, detached)".
You can group all of JDO's lifecycle states into the three above
categories, and in fact these categories are all the user ever has to
be aware of. The JDO authors, however, felt a user might want to be
able to distinguish between, say, an object that will be inserted on
flush (persistent-new state), vs. one that will be deleted
(persistent-deleted), vs. one that will be updated (persistent-dirty),
vs. one that is persistent, but hasn't changed in the transaction
(persistent-clean). We don't know about you, but that seems like
useful information to us. And you can't get it from the three states
of persistent, transient, and detached.

The distinction between states not only provides the developer with
useful information, but also means that most JDO implementations don't
have to do field-by-field comparisons when deciding what objects to
flush to the data store. The implementation knows at all times exactly
which objects are dirty, and exactly which fields in those objects need
flushing. For transactions involving many objects, this is clearly an
advantage.

c. JDO is "bloated with useless features such as 'transient
transactional' instances".
First of all, transient-transactional objects are an optional part of
the JDO spec. They can be completely ignored by users who don't have a
need for them, and by implementations who don't think their users will
benefit from them.

Second, transient-transactional instances can actually be useful. They
are non-persistent objects that have the ability to rollback their
state when a transaction is rolled back. This ensures that if you make
changes to non-persistent state that are only valid if the transaction
commits, those changes don't come back to haunt you if the transaction
rolls back for some reason. You can also mix persistent,
transient-transactional, and unmanaged fields in the same object. Is
this useful to everyone? No; that's why it's optional. But is it
useful to some? Certainly.

Conclusions

It is disappointing to read the amount of misinformation and downright
FUD being spewed against JDO. Gavin may simply have been confused on
certain points; that is perfectly excusable. Passing off confusion as
fact is slightly less so, but still completely understandable.
Research takes time that is often in short supply. But the consistency
and volume of rhetoric from certain vendors with a vested interest in
tying persistence to EJB and relational databases cannot all be
attributed to ignorance.

JDO provides, today, a standardized transparent persistence solution.
Relational JDO vendors support, today, all of the features found in
other ORM solutions. JDO 2 will build on this by providing a
transparent persistence solution that is completely backwards
compatible, continues to support non-relational stores, and yet also
standardizes ORM and other relational features, all before EJB 3. Many
JDO vendors are already previewing JDO 2 features in their products.
Please, let's base future discussions on facts, not FUD.

Threaded replies

·  EJB 3.0 and JDO 2.0: Views from both sides by Dion Almaer on Sat May 08 04:57:57 EDT 2004
  ·  EJB 3.0 and JDO 2.0: Views from both sides by Juozas Baliuka on Sat May 08 07:05:38 EDT 2004
    ·  EJB 3.0 and JDO 2.0: Views from both sides by Dirk Laessig on Sat May 08 08:29:35 EDT 2004
    ·  The tools should get better by David Ezzio on Sat May 08 09:17:58 EDT 2004
    ·  A Question or Practicality by Fred McCann on Sat May 08 11:02:10 EDT 2004
    ·  Good question, I'd like to know too by peter lin on Sat May 08 18:17:40 EDT 2004
      ·  Good question, I'd like to know too by Mark Nuttall on Sat May 08 18:30:59 EDT 2004
      ·  How banks implement Queries by Robin Roos on Sat May 08 18:48:32 EDT 2004
        ·  that makes sense by peter lin on Mon May 10 10:15:39 EDT 2004
          ·  that makes sense by David Jordan on Mon May 10 11:17:43 EDT 2004
  ·  Query Language Tradeoffs? by Kevin Lewis on Sat May 08 09:20:57 EDT 2004
    ·  Query Language Tradeoffs? by Juozas Baliuka on Sat May 08 09:56:22 EDT 2004
      ·  Query Language Tradeoffs? by Michal Maczka on Sat May 08 11:03:01 EDT 2004
        ·  Query Language Tradeoffs? by Juozas Baliuka on Sat May 08 11:20:30 EDT 2004
        ·  Query Language Tradeoffs? by Kevin Lewis on Sat May 08 11:27:07 EDT 2004
          ·  Query Language Tradeoffs? by Michal Maczka on Sat May 08 11:48:58 EDT 2004
            ·  Query Language Tradeoffs? by Kevin Lewis on Sat May 08 12:02:33 EDT 2004
      ·  Query Language Tradeoffs? by tom tarb on Sat May 08 20:31:13 EDT 2004
        ·  Query Language Tradeoffs? by Robin Roos on Sat May 08 20:42:25 EDT 2004
    ·  Query Language Tradeoffs? by Abe White on Sat May 08 12:46:32 EDT 2004
      ·  Query Language Tradeoffs? by Juozas Baliuka on Sat May 08 13:09:43 EDT 2004
        ·  Query Language Tradeoffs? by David Jordan on Sat May 08 13:41:09 EDT 2004
          ·  Query Language Tradeoffs? by Kevin Lewis on Sat May 08 13:58:42 EDT 2004
            ·  Query Language Tradeoffs? by Abe White on Sat May 08 14:57:35 EDT 2004
              ·  Query Language Tradeoffs? by Kevin Lewis on Sat May 08 15:15:00 EDT 2004
                ·  Query Language Tradeoffs? by David Jordan on Sat May 08 16:17:11 EDT 2004
                ·  Query Language Tradeoffs? by Abe White on Sat May 08 17:29:34 EDT 2004
                  ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 02:31:16 EDT 2004
                    ·  Query Language Tradeoffs? by Erik Bengtson on Sun May 09 04:13:59 EDT 2004
                ·  Query Language Tradeoffs? by geoff hendrey on Sun May 09 01:43:06 EDT 2004
              ·  leveraging the mapping expertise of experts by David Jordan on Sat May 08 15:22:03 EDT 2004
                ·  leveraging the mapping expertise of experts by Juozas Baliuka on Sat May 08 16:22:20 EDT 2004
                  ·  leveraging the mapping expertise of experts by David Jordan on Sat May 08 16:53:16 EDT 2004
                    ·  leveraging the mapping expertise of experts by Juozas Baliuka on Sat May 08 17:12:11 EDT 2004
                      ·  leveraging the mapping expertise of experts by David Jordan on Sat May 08 17:30:38 EDT 2004
                        ·  leveraging the mapping expertise of experts by Juozas Baliuka on Sun May 09 02:02:09 EDT 2004
                          ·  OO vs. RestOfTheWorld debate by christophe hartwig on Sun May 09 04:33:07 EDT 2004
                            ·  OO vs. RestOfTheWorld debate by Juozas Baliuka on Sun May 09 06:11:55 EDT 2004
                      ·  On object models by Robin Roos on Sat May 08 18:21:13 EDT 2004
                      ·  leveraging the mapping expertise of experts by Mark Nuttall on Sat May 08 18:35:53 EDT 2004
                        ·  leveraging the mapping expertise of experts by Juozas Baliuka on Sun May 09 01:20:17 EDT 2004
                    ·  leveraging the mapping expertise of experts by Mark Nuttall on Sat May 08 18:19:30 EDT 2004
          ·  Query Language Tradeoffs? by Juozas Baliuka on Sat May 08 14:19:03 EDT 2004
        ·  Of course, JDO uses one Model and why not? by David Ezzio on Sat May 08 14:32:21 EDT 2004
          ·  Of course, JDO uses one Model and why not? by Juozas Baliuka on Sat May 08 14:39:35 EDT 2004
      ·  Query Language Tradeoffs? by Juozas Baliuka on Sat May 08 13:28:50 EDT 2004
        ·  switching DBs with JDO by David Jordan on Sat May 08 13:36:24 EDT 2004
          ·  switching DBs with JDO by Doug Clarke on Sat May 08 14:08:42 EDT 2004
            ·  switching DBs with JDO by Juozas Baliuka on Sat May 08 15:15:27 EDT 2004
      ·  Query Language Tradeoffs? by Mileta Cekovic on Sat May 08 19:34:33 EDT 2004
    ·  Query Language Tradeoffs? by ABC DEF on Sat May 08 20:26:42 EDT 2004
    ·  Query Language Tradeoffs? by geoff hendrey on Sun May 09 01:29:29 EDT 2004
    ·  Query Language Tradeoffs? by David Tinker on Sun May 09 06:47:33 EDT 2004
      ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 07:14:54 EDT 2004
        ·  Query Language Tradeoffs? by David Jordan on Sun May 09 08:58:34 EDT 2004
          ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 09:28:21 EDT 2004
          ·  Both EJB3 and JDO2 Will Be Backwards Compatible by Scott Crawford on Sun May 09 09:44:24 EDT 2004
            ·  EJB 3.0 should learn about Optional Features from JDO by Robin Roos on Sun May 09 09:55:17 EDT 2004
              ·  EJB 3.0 should learn about Optional Features from JDO by Scott Crawford on Sun May 09 10:25:28 EDT 2004
                ·  EJB 3.0 should learn about Optional Features from JDO by Robin Roos on Sun May 09 10:36:38 EDT 2004
                  ·  EJB 3.0 should learn about Optional Features from JDO by Scott Crawford on Sun May 09 10:52:52 EDT 2004
                    ·  Cannes JDO meeting by David Jordan on Sun May 09 11:09:46 EDT 2004
                    ·  EJB 3.0 should learn about Optional Features from JDO by Robin Roos on Sun May 09 11:30:49 EDT 2004
                    ·  EJB 3.0 should learn about Optional Features from JDO by Robin Roos on Sun May 09 11:38:19 EDT 2004
                      ·  EJB 3.0 should learn about Optional Features from JDO by Scott Crawford on Sun May 09 11:46:39 EDT 2004
                ·  EJB 3.0 should learn about Optional Features from JDO by John Harby on Sun May 09 11:02:19 EDT 2004
              ·  EJB 3.0 should learn about Optional Features from JDO by Cedric Beust on Sun May 09 16:30:30 EDT 2004
                ·  EJB 3.0 should learn about Optional Features from JDO by David Jordan on Sun May 09 16:52:53 EDT 2004
                  ·  EJB 3.0 should learn about Optional Features from JDO by Scott Crawford on Sun May 09 17:04:43 EDT 2004
                  ·  EJB 3.0 should learn about Optional Features from JDO by Cedric Beust on Sun May 09 17:08:43 EDT 2004
                    ·  EJB 3.0 should learn about Optional Features from JDO by David Jordan on Sun May 09 17:21:43 EDT 2004
                    ·  EJB 3.0 should learn about Optional Features from JDO by Geir Magnusson Jr on Mon May 10 12:15:24 EDT 2004
                ·  Re: EJB 3.0 should learn about Optional Features from JDO by Oliver Kamps on Mon May 17 18:14:18 EDT 2004
                  ·  Re: EJB 3.0 should learn about Optional Features from JDO by Christian Bauer on Tue May 18 07:27:22 EDT 2004
                    ·  Re: EJB 3.0 should learn about Optional Features from JDO by Cameron Purdy on Tue May 18 09:12:38 EDT 2004
                    ·  Re: EJB 3.0 should learn about Optional Features from JDO by Oliver Kamps on Tue May 18 15:27:03 EDT 2004
                      ·  Re: EJB 3.0 should learn about Optional Features from JDO by Cedric Beust on Tue May 18 16:05:14 EDT 2004
                        ·  Re: EJB 3.0 should learn about Optional Features from JDO by Oliver Kamps on Tue May 18 16:31:32 EDT 2004
                          ·  Re: EJB 3.0 should learn about Optional Features from JDO by Cedric Beust on Tue May 18 16:35:32 EDT 2004
                            ·  Re: EJB 3.0 should learn about Optional Features from JDO by Oliver Kamps on Tue May 18 16:47:08 EDT 2004
                              ·  Re: EJB 3.0 should learn about Optional Features from JDO by Cedric Beust on Tue May 18 19:01:05 EDT 2004
                                ·  Re: EJB 3.0 should learn about Optional Features from JDO by Oliver Kamps on Wed May 19 02:33:40 EDT 2004
                                  ·  Re: EJB 3.0 should learn about Optional Features from JDO by Oliver Kamps on Wed May 19 02:42:49 EDT 2004
                        ·  Optional implementation, standard specification by Bruce Tate on Tue May 18 22:00:41 EDT 2004
                          ·  Optional implementation, standard specification by Cedric Beust on Tue May 18 23:06:18 EDT 2004
                            ·  Optional implementation, standard specification by Juergen Hoeller on Wed May 19 04:27:12 EDT 2004
                              ·  Ironic, isn't it? by Bruce Tate on Wed May 19 12:14:01 EDT 2004
                                ·  Optional Features in JDO by Robin Roos on Thu May 20 07:15:26 EDT 2004
                                  ·  Optional Features in EJB 3.0 by Robin Roos on Thu May 20 07:18:15 EDT 2004
                            ·  Optional implementation, standard specification by Cameron Purdy on Wed May 19 09:52:00 EDT 2004
                        ·  exorcising options by Cameron Purdy on Wed May 19 09:42:00 EDT 2004
        ·  Query Language Tradeoffs? by Robin Roos on Sun May 09 09:29:27 EDT 2004
          ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 10:16:25 EDT 2004
            ·  Query Language Tradeoffs? by Robin Roos on Sun May 09 10:26:36 EDT 2004
              ·  Query Language Tradeoffs? by Alex Roytman on Mon May 10 00:23:21 EDT 2004
            ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 10:37:18 EDT 2004
              ·  Query Language Tradeoffs? by Robin Roos on Sun May 09 10:52:10 EDT 2004
                ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 11:54:17 EDT 2004
                  ·  Query Language Tradeoffs? by David Jordan on Sun May 09 12:20:04 EDT 2004
                    ·  Query Language Tradeoffs? by Juozas Baliuka on Sun May 09 13:27:53 EDT 2004
                      ·  Query Language Tradeoffs? by David Jordan on Sun May 09 13:44:51 EDT 2004
                      ·  Simple Question by Daniel Haynes on Sun May 09 13:52:23 EDT 2004
                        ·  Simple Question by David Jordan on Sun May 09 14:22:25 EDT 2004
                  ·  Not true by Giedrius Trumpickas on Sun May 09 13:51:09 EDT 2004
                    ·  Not true by Juozas Baliuka on Sun May 09 14:28:21 EDT 2004
                      ·  shouldn't it be an OOA/OOD matter? by Piergiuseppe Spinelli on Fri May 14 07:22:13 EDT 2004
                        ·  shouldn't it be an OOA/OOD matter? by Robin Roos on Fri May 14 09:17:28 EDT 2004
                          ·  shouldn't it be an OOA/OOD matter? by Piergiuseppe Spinelli on Fri May 14 11:43:48 EDT 2004
            ·  Query Language Tradeoffs? by Harald M. Mueller on Tue May 11 06:24:23 EDT 2004
    ·  ORM vs. JDBC by Harald M. Mueller on Tue May 11 06:26:08 EDT 2004
      ·  ORM vs. JDBC by Robin Roos on Tue May 11 07:40:02 EDT 2004
        ·  ORM vs. JDBC by Harald M. Mueller on Wed May 12 12:05:38 EDT 2004
          ·  ORM vs. JDBC by Robin Roos on Wed May 12 12:26:51 EDT 2004
            ·  ORM vs. JDBC by Robin Roos on Wed May 12 12:46:08 EDT 2004
              ·  JDO vs Hibernate Study by Makan Time on Wed May 12 13:19:26 EDT 2004
              ·  ORM vs. JDBC by Harald M. Mueller on Wed May 12 14:02:15 EDT 2004
                ·  ORM vs. JDBC by Robin Roos on Wed May 12 15:14:56 EDT 2004
            ·  ORM vs. JDBC by Harald M. Mueller on Wed May 12 13:18:35 EDT 2004
              ·  ORM vs. JDBC by Robin Roos on Wed May 12 14:14:50 EDT 2004
                ·  ORM vs. JDBC by Christian Bauer on Wed May 12 14:18:53 EDT 2004
      ·  ORM vs. JDBC by Juozas Baliuka on Tue May 11 08:00:55 EDT 2004
        ·  ORM vs. JDBC by Harald M. Mueller on Wed May 12 10:36:09 EDT 2004
          ·  ORM vs. JDBC by Juozas Baliuka on Wed May 12 13:15:03 EDT 2004
  ·  My campaign of FUD by Gavin King on Sat May 08 10:36:37 EDT 2004
    ·  My campaign of FUD by Juozas Baliuka on Sat May 08 10:53:22 EDT 2004
    ·  no technical substance by David Jordan on Sat May 08 11:21:38 EDT 2004
      ·  responding to my own post... by David Jordan on Sat May 08 11:39:24 EDT 2004
    ·  Misconception by Patrik A on Sat May 08 11:28:08 EDT 2004
      ·  Misconception by Cameron Purdy on Sat May 08 17:47:29 EDT 2004
    ·  My campaign of FUD by Abe White on Sat May 08 11:29:57 EDT 2004
      ·  My campaign of FUD by Juozas Baliuka on Sat May 08 11:44:44 EDT 2004
    ·  Speak for yourself by Toby Reyelts on Sat May 08 11:38:45 EDT 2004
      ·  JDO versus Hibernate versus NewAndCool by Ben Eng on Sat May 08 12:19:41 EDT 2004
        ·  JDO versus Hibernate versus NewAndCool by Matthew Adams on Sun May 09 00:44:10 EDT 2004
    ·  Why I got fed up with Hibernate - here's the 'catches' by Val Johnson on Sun May 09 19:51:00 EDT 2004
      ·  Why I got fed up with Hibernate - here's the 'catches' by Emmanuel Bernard on Sun May 09 20:19:27 EDT 2004
    ·  No one is asking for a pissing match... by Tom Davies on Sun May 09 20:09:50 EDT 2004
    ·  My campaign of FUD by Kalyan Kolachala on Mon May 10 09:01:09 EDT 2004
    ·  Gavin King doesn't like piss? by David McCuistion on Mon May 10 15:01:46 EDT 2004
      ·  Gavin King doesn't like piss? by Cedric Beust on Mon May 10 15:20:26 EDT 2004
        ·  Gavin King doesn't like piss? by David McCuistion on Mon May 10 15:59:54 EDT 2004
      ·  Gavin King doesn't like piss? by Christian Bauer on Mon May 10 15:30:25 EDT 2004
        ·  Gavin King doesn't like piss? by David McCuistion on Mon May 10 16:14:56 EDT 2004
      ·  sorry JDO folks by Rolf Tollerud on Mon May 10 15:50:29 EDT 2004
    ·  Hollow Instances are, essentially, Proxies by Thomas Whitmore on Tue Jun 01 22:07:11 EDT 2004
  ·  ejb.jdo well nothing beat good old jdbc by aturo michelangeli on Sat May 08 12:22:30 EDT 2004
    ·  ejb.jdo well nothing beat good old jdbc by Juozas Baliuka on Sat May 08 12:30:17 EDT 2004
  ·  EJB 3.0 and JDO 2.0: Views from both sides by Brian Miller on Sat May 08 20:14:30 EDT 2004
    ·  EJB 3.0 and JDO 2.0: Views from both sides by Robin Roos on Sat May 08 20:30:18 EDT 2004
      ·  EJB 3.0 and JDO 2.0: Views from both sides by Brian Miller on Mon May 10 13:09:02 EDT 2004
    ·  JDO Filters are queries by Tom Davies on Sun May 09 20:33:26 EDT 2004
      ·  JDO Filters are queries by David Jordan on Sun May 09 20:42:04 EDT 2004
        ·  JDO Filters are queries by Tom Davies on Sun May 09 21:33:47 EDT 2004
          ·  JDO Filters are queries by David Tinker on Mon May 10 03:09:14 EDT 2004
          ·  Java language representation of JDOQL by Patrick Linskey on Mon May 10 11:11:00 EDT 2004
            ·  Query language by Wes Biggs on Thu May 13 01:44:02 EDT 2004
              ·  Query language by Brian Miller on Thu May 13 11:11:42 EDT 2004
  ·  Best DAO is... (and ... I don't like what Hibernate did either) by Vic Cekvenich on Sat May 08 23:47:08 EDT 2004
    ·  in J2EE land, KISS is not allowed by Rolf Tollerud on Sun May 09 09:50:45 EDT 2004
      ·  in J2EE land, KISS is not allowed by Vic Cekvenich on Mon May 10 18:40:34 EDT 2004
    ·  Best DAO is... (and ... I don't like what Hibernate did either) by Jon Tirsen on Sun May 09 17:21:05 EDT 2004
      ·  Best DAO is... (and ... I don't like what Hibernate did either) by Valeri Sarantchouk on Thu May 27 20:00:08 EDT 2004
  ·  WTF? by geoff hendrey on Sun May 09 02:22:19 EDT 2004
    ·  Status by Robin Roos on Sun May 09 09:44:24 EDT 2004
  ·  Where is advantage? by Pavel Tavoda on Sun May 09 05:28:47 EDT 2004
  ·  How well does JDO/Hibernate handle impedance mismatch? by Robert Devi on Sun May 09 14:55:26 EDT 2004
    ·  How well does JDO/Hibernate handle impedance mismatch? by Robin Roos on Sun May 09 15:17:17 EDT 2004
      ·  Hibernate rules by Hans Schw?bli on Sun May 09 15:41:19 EDT 2004
        ·  Hibernate rules by David Jordan on Sun May 09 16:10:59 EDT 2004
          ·  Hibernate rules? by Robin Roos on Sun May 09 16:21:18 EDT 2004
          ·  Hibernate rules by Cedric Beust on Sun May 09 16:43:27 EDT 2004
            ·  Hibernate rules by David Jordan on Sun May 09 17:05:21 EDT 2004
              ·  Hibernate rules by Cedric Beust on Sun May 09 17:14:22 EDT 2004
                ·  Hibernate rules by David Jordan on Sun May 09 17:28:59 EDT 2004
                  ·  Hibernate rules by Cedric Beust on Sun May 09 18:53:43 EDT 2004
                    ·  Hibernate rules by David Jordan on Sun May 09 19:03:14 EDT 2004
                    ·  Hibernate rules by Robin Roos on Sun May 09 19:21:15 EDT 2004
                  ·  Hibernate rules by John Harby on Sun May 09 19:25:19 EDT 2004
                    ·  Off topic, SOA by Brian Miller on Mon May 10 14:17:40 EDT 2004
                      ·  Off topic, SOA by Juozas Baliuka on Mon May 10 14:50:21 EDT 2004
                        ·  Off topic, SOA by Brian Miller on Mon May 10 16:27:39 EDT 2004
                          ·  Off topic, SOA by John Harby on Mon May 10 23:41:29 EDT 2004
                            ·  Off topic, SOA by Juozas Baliuka on Tue May 11 01:12:30 EDT 2004
                ·  Hibernate rules by geoff hendrey on Mon May 10 00:18:53 EDT 2004
            ·  Backing a position by Robin Roos on Sun May 09 17:41:23 EDT 2004
          ·  Hibernate rules by Joe Java on Sun May 09 17:26:35 EDT 2004
            ·  Hibernate rules by Emmanuel Bernard on Sun May 09 19:51:33 EDT 2004
        ·  Hibernate rules? by Robin Roos on Sun May 09 16:17:02 EDT 2004
          ·  Hibernate ru13z? by Cameron Purdy on Sun May 09 21:51:02 EDT 2004
            ·  Hibernate ru13z? by David Jordan on Sun May 09 22:01:53 EDT 2004
            ·  Comparing Hibernate and JDO by Chris Richardson on Mon May 10 00:12:15 EDT 2004
              ·  Comparing Hibernate and JDO by geoff hendrey on Mon May 10 00:36:52 EDT 2004
                ·  JCP members voted against JDO 2.0 by Hans Schw?bli on Mon May 10 02:10:03 EDT 2004
                  ·  (a few) JCP members voted against JDO 2.0 by Christian Sell on Mon May 10 08:25:07 EDT 2004
                    ·  (a few) JCP members voted against JDO 2.0 by Robin Roos on Mon May 10 08:39:37 EDT 2004
                ·  Comparing Hibernate and JDO by Chris Richardson on Mon May 10 10:58:41 EDT 2004
                  ·  Comparing Hibernate and JDO by geoff hendrey on Mon May 10 12:48:08 EDT 2004
                    ·  Comparing Hibernate and JDO by geoff hendrey on Mon May 10 12:55:18 EDT 2004
                ·  Query pre-compilation not strictly necessary by Patrick Linskey on Mon May 10 11:01:45 EDT 2004
                  ·  Query pre-compilation not strictly necessary by David Tinker on Mon May 10 11:53:21 EDT 2004
              ·  Re: Comparing Hibernate and JDO by Joe Java on Mon May 10 00:54:54 EDT 2004
              ·  Comparing Hibernate and JDO by Juozas Baliuka on Mon May 10 10:20:09 EDT 2004
            ·  EDO : was "Hibernate ru13z?" by Geir Magnusson Jr on Mon May 10 12:31:28 EDT 2004
  ·  EJB 3.0 and JDO 2.0: Views from both sides by Race Condition on Sun May 09 23:59:27 EDT 2004
  ·  Why don't join efforts of EJB3, JDO2 and (Hybernate by Luca Garulli on Mon May 10 09:46:05 EDT 2004
    ·  Why don't join efforts of EJB3, JDO2 and Hybernate? by Luca Garulli on Mon May 10 10:27:22 EDT 2004
      ·  Back to the Basics by Arjuna Chala on Mon May 10 12:29:54 EDT 2004
    ·  Why don't join efforts of EJB3, JDO2 and (Hybernate by David Jordan on Mon May 10 10:40:41 EDT 2004
      ·  Re: Why don't join efforts of EJB3, JDO2 and (Hybernate by Joe Java on Mon May 10 10:55:18 EDT 2004
      ·  a story from real life by Rolf Tollerud on Mon May 10 11:16:35 EDT 2004
      ·  Why don't join efforts of EJB3, JDO2 and (Hybernate by Scott Crawford on Mon May 10 11:25:29 EDT 2004
        ·  Why don't join efforts of EJB3, JDO2 and (Hybernate by Abe White on Mon May 10 12:21:27 EDT 2004
        ·  Why don't join efforts of EJB3, JDO2 and (Hybernate by Robin Roos on Mon May 10 17:27:42 EDT 2004
      ·  Why don't join efforts of EJB3, JDO2 and (Hybernate by ramesh loganathan on Mon May 10 14:01:19 EDT 2004
      ·  Dear David Jordan by Gavin King on Tue May 11 08:21:55 EDT 2004
        ·  Dear David Jordan by Juozas Baliuka on Tue May 11 08:47:29 EDT 2004
        ·  JDO2 using ideas from Hibernate by David Tinker on Tue May 11 09:52:07 EDT 2004
        ·  Strongest survives by Artti Jaakkola on Tue May 11 12:23:05 EDT 2004
          ·  Strongest survives by Brian Miller on Tue May 11 14:22:21 EDT 2004
        ·  Dear Gavin King by David Jordan on Tue May 11 18:30:20 EDT 2004
          ·  pluggable CMP, non-relational CMP, ? by Brian Miller on Tue May 11 23:19:38 EDT 2004
            ·  pluggable CMP, non-relational CMP, ? by Ruslan Zenin on Wed May 12 01:07:59 EDT 2004
            ·  pluggable CMP, non-relational CMP, ? by Kalyan Kolachala on Wed May 12 02:26:42 EDT 2004
              ·  pluggable CMP, non-relational CMP, ? by Cedric Beust on Wed May 12 11:50:39 EDT 2004
                ·  Decoupling services is the key issue by Bruce Tate on Mon May 17 01:03:02 EDT 2004
              ·  pluggable CMP, non-relational CMP, ? by ABC DEF on Wed May 12 17:08:34 EDT 2004
          ·  Dear Gavin King by Juozas Baliuka on Wed May 12 01:18:29 EDT 2004
          ·  Back to technology... by Robin Roos on Wed May 12 07:43:47 EDT 2004
            ·  Back to technology... by Dawn Fraser on Wed May 12 09:44:32 EDT 2004
              ·  Back to technology... by Robin Roos on Wed May 12 09:55:18 EDT 2004
                ·  Back to technology... by Robin Roos on Wed May 12 10:07:59 EDT 2004
                ·  Production proven JDO open source implementation by Erik Bengtson on Wed May 12 10:17:56 EDT 2004
                ·  Back to technology... by Dawn Fraser on Wed May 12 10:18:29 EDT 2004
                  ·  Back to technology... by Robin Roos on Wed May 12 10:53:47 EDT 2004
                    ·  Back to technology... by Christian Bauer on Wed May 12 11:27:59 EDT 2004
                      ·  Back to page hits and download counts... by Robin Roos on Wed May 12 11:49:45 EDT 2004
                    ·  Dion with oil for troubled waters by Robin Roos on Wed May 12 11:38:34 EDT 2004
  ·  Java is its own worst enemy by Rob Aught on Mon May 10 14:13:53 EDT 2004
    ·  Moment of Truth by Ricky Datta on Mon May 10 14:17:21 EDT 2004
  ·  JDO and EJB are very good things, but please, remove EntityBeans by Johan Strandler on Mon May 10 17:46:35 EDT 2004
  ·  JDO 2.0 spec leaders need to be real tech-leaders by Ruslan Zenin on Mon May 10 20:37:38 EDT 2004
  ·  "IT without borders"? by Rolf Tollerud on Tue May 11 02:48:40 EDT 2004
  ·  Why O/R mapping as part of the EJB spec? by Juergen Hoeller on Tue May 11 07:22:07 EDT 2004
    ·  Why O/R mapping as part of the EJB spec? by Valeri Sarantchouk on Tue May 11 09:27:18 EDT 2004
  ·  What do you think will happen when they finally kill JDO? by Guglielmo Lichtner on Tue May 11 09:10:22 EDT 2004
    ·  Last Manning Book : Darwinism in action by Dawn Fraser on Tue May 11 10:07:54 EDT 2004
      ·  Last Manning Book : Darwinism in action by Juozas Baliuka on Tue May 11 10:29:16 EDT 2004
        ·  Standardized Large Result Set Support in JDO 2.0? by Joe Java on Tue May 11 12:07:11 EDT 2004
          ·  Standardized Large Result Set Support in JDO 2.0? by Patrick Linskey on Tue May 11 12:51:10 EDT 2004
            ·  Standardized Large Result Set Support in JDO 2.0? by Joe Java on Tue May 11 13:02:30 EDT 2004
        ·  Fork Hibernate! by Kalyan Kolachala on Wed May 12 02:41:39 EDT 2004
          ·  Fork Hibernate! by Juozas Baliuka on Wed May 12 02:53:41 EDT 2004
      ·  Age Old Dream : Darwinism in Software by Valeri Sarantchouk on Tue May 11 12:08:41 EDT 2004
        ·  Age Old Dream : Darwinism in Software by Juozas Baliuka on Tue May 11 13:04:22 EDT 2004
  ·  Lazy Load by Patricia Marinho on Wed May 19 01:00:37 EDT 2004
  ·  A View from the big guys ... by Wolfgang Keller on Wed May 26 10:27:24 EDT 2004
    ·  A View from the big guys ... by Chris Colman on Sat Dec 17 06:41:27 EST 2005
  ·  All of them work fine by karan malhi on Mon Jan 17 04:40:08 EST 2005
  ·  The View from the Bowl by Helmut Ramstein on Sat Feb 25 18:52:40 EST 2006
    ·  The View from the Bowl by Steve Zara on Thu Mar 16 11:13:17 EST 2006
  Message #121153 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 and JDO 2.0: Views from both sides

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121147
But rather than take our word for it, let's look at an example:Query q = pm.newQuery (Employee.class);q.setResult ("firstName, lastName, department"); q.setFilter ("age > 50 && !retired && department.name == 'Marketing' && projects.isEmpty ()"); q.orderBy ("employeeId ascending");We think it is pretty clear to anyone who knows Java exactly what this query does. It selects the first name, last name, and department object of every employee who is older than 50, not retired, in the marketing department, and who is not working on any projects.
Ok, it looks very cool. How DBA can tune it ?

  Message #121162 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 and JDO 2.0: Views from both sides

Posted by: Dirk Laessig on May 08, 2004 in response to Message #121153
But rather than take our word for it, let's look at an example:Query q = pm.newQuery (Employee.class);q.setResult ("firstName, lastName, department"); q.setFilter ("age > 50 && !retired && department.name == 'Marketing' && projects.isEmpty ()"); q.orderBy ("employeeId ascending");We think it is pretty clear to anyone who knows Java exactly what this query does. It selects the first name, last name, and department object of every employee who is older than 50, not retired, in the marketing department, and who is not working on any projects.
Ok, it looks very cool. How DBA can tune it ?
A DBA will never look into the Java code. He/she will probably monitor to the statements executed on the DB. Depending on the JDO implementation the SQL statements may differ.

A Java developer can easily write down this JDOQL statement. But a Java developer may not be able to tune it. You can find a lot of these developers for developing the application's business logic.

What you need is one JDO expert in the team of Java developers, who knows how the JDO implementation works and who closely works with DB experts to tune the application. He must review the code and the OR-mapping of the other developers.

What you finally get is a highly maintainable application. Non-JDO-expert developers can easily understand and extend it. But don't forget the JDO export during the development phase.

  Message #121166 Post reply Post reply Post reply Go to top Go to top Go to top

The tools should get better

Posted by: David Ezzio on May 08, 2004 in response to Message #121153
"How DBA can tune it ?"

Juozas,

Fair question, but one that is hardly unique to JDO implementations. The answer is that the DBA needs tools. The JDO implementations can provide some of these tools (and some of them are doing that.)

Abe postulates, in his example, that the older marketing types without projects identified in the query will be offered early retirement. Perhaps instead the query ran (I won't say where) to find people who would like to end their careers by taking on the thankless and pointless task of explaining how EJB 3.0 is better than JDO 2.0. :)

Most developers will use the tool that does the job with minimum fuss. I happen to think that JDO takes care of persistence with ease in many scenarios and will get better with the 2.0 spec. But I'm quite willing to allow others to have their opinions.

I'm glad to hear that EJB 3 plans to address the shortcomings of EJB 1, EJB 1.1, and EJB 2. I'm also glad to hear that open source (JBoss and Hibernate) have gained influence in the EJB expert group. Only good can come from these developments. The entire world of software development will change because of the open processes, lean management structure, and agile development of open source. I wish the JBG and the Hibernate team good luck as they lead the charge into the heart of the kingdom of darkness. I'll hazard that they'll need friends before they are done.


David Ezzio

  Message #121167 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Kevin Lewis on May 08, 2004 in response to Message #121147
Can anyone explain the tradeoffs between using the JDOQL v. SQL in a typical JDO implementation?

I think that tuning SQL is a fundamental part of any developer's work with a relational database. Further, there is quite a bit of difference between effective SQL in one database v. another, and it is very important that you use SQL that works best with your database (if you want your application to perform, that is).

I personally don't see any advantage to learning another query language because SQL works very well--unless there are framework-related advantages to JDOQL. Further, I think it's much easier to write a query in a SQL query tool than to write a query as shown above (which to me is much harder to understand and much more error prone, though I haven't ever used JDO); another advantage of normal SQL, I think.

Thanks for any explanations or contradictions.

--Kevin

  Message #121168 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121167
One of ways to tune queries is to enable SQL log, trace query plan to view statistics tables to create indexes to eliminate table scans, add hints to query, modify views. This kind of JDOQL, OQL, EJBQL or HQL queries are useless and it is hell for DBA or maintainers in practice.
It is good on emtpy development databases and this kind of application must droped after database grows. SQL support is more usefull than cool and transparent OOP queries and optimistic attachments. Make JDO/EJB a good tool for RDBMS and it will be usefull too. Drop useless QL and forget transparence dream, this is a very big damage for users to sell JDO/EJB as standard way to access RDBMS.

  Message #121169 Post reply Post reply Post reply Go to top Go to top Go to top

My campaign of FUD

Posted by: Gavin King on May 08, 2004 in response to Message #121147
As I admitted in the other thread, I guess I was wrong on detached objects. Apparently the problem with null values in serialized objects was fixed more recently, after I stopped paying attention to JDO. Certainly JDO1 features this problem in the section which deals with serialization; I'm not sure when and how it was resolved in JDO2.

There are two further reasons I listed for proxy solutions being preferred:

--QUOTE:
Proxy-base solutions have some other wonderful advantages, such as the ability to create an association to an object without actually fetching it from the database, and the ability to discover the primary key of an associated object without fetching it.
--ENDQUOTE

And those reasons still apply.

Lastly, JDOQL -is- an abomination, and the JDO spec -is- too complex and misfeatured. But I am 0% interested in getting into a pissing match over this. I've had my say and will say no more. The Java world has already adopted Hibernate over JDO, so apparently I am not the only one who thinks JDO is not perfect.

  Message #121170 Post reply Post reply Post reply Go to top Go to top Go to top

My campaign of FUD

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121169
JDOQL -is- an abomination, and the JDO spec -is- too complex and misfeatured. But I am 0% interested in getting into a pissing match over this. I've had my say and will say no more. The Java world has already adopted Hibernate over JDO, so apparently I am not the only one who thinks JDO is not perfect.
You are rigth, continue to work on hibernate and we will help as we can too. I believe hibernate can sove problems like queries friendly for tuning, better SQL support and stored procedures, Hibernate team and community can do it better than JDO or EJB politics with standards and specifications, I think they do not let you to make EJB usefull too.

  Message #121171 Post reply Post reply Post reply Go to top Go to top Go to top

A Question or Practicality

Posted by: Fred McCann on May 08, 2004 in response to Message #121153
I think it's clear that Hibernate currently has an edge as a persistence technology not because it is more correct or better designed than any other solution, but rather because of it's practicality. Hibernate is free to use, there is great documentation, a large user community, and a SQL like query language. Is a SQL like query language the best choice for querying persistent objects? Maybe not, but most developers who interact with databases already know SQL and can hit the ground running with HQL.

That said, I'm all for the changes in EJB 3.0. If they make good on POJO persistence that isn't tied too deeply in all the J2EE services, it will be great. Anyone working in the J2EE space just doesn't use entity beans, or they use them sparingly. The lightweight persistence solutions (OR mapping and JDO) are easier to develop and easier to use.

On the topic of JDO, my observation is it's just not a technology I can employ today. Though I like the idea of a standardized persistence technology, JDO 1 isn't the path of least resistance. From what we've heard on JDO 2 (http://www.theserverside.com/news/thread.tss?thread_id=25695), I'm not sure how well that's going either.

I guess what I'm saying is that I need something that I can put to work now. The solution needs to be: Easy to use, easy to learn, and solve the problem. Of all the systems I've used or evaluated (EJB Entity Beans, Apache OJB, JDO, Hibernate, custom code), Hibernate delivers.

I think the real friction between Hibernate and JDO is a a larger friction between Open Source Java projects and standardization efforts. What we're seeing in the Open Source space is projects that solve a well defined problem and blossom (XDoclet, Hibernate, etc). In the standardization sphere the emphasis is on complete coverage of a set of related problems and creating specifications that allow for several implementations. At the end of the day we need to come together on this one. I want a standardized persistence API and I want a system that solves my problems right now.

The reality is that the solutions that are more widely used have the edge regardless of what's the best model to get the job done. Will a JDO spec matter if developers continue to adopt O/R packages? Considering that Hibernate is surging in use right now, I think the JDO group should take a serious look at how Hibernate operates because I don't want to end up with an official JDO standard and a de-facto standard.

  Message #121172 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Michal Maczka on May 08, 2004 in response to Message #121168
One of ways to tune queries is to enable SQL log, trace query plan to view statistics tables to create indexes to eliminate table scans, add hints to query, modify views. This kind of JDOQL, OQL, EJBQL or HQL queries are useless and it is hell for DBA or maintainers in practice.It is good on emtpy development databases and this kind of application must droped after database grows. SQL support is more usefull than cool and transparent OOP queries and optimistic attachments. Make JDO/EJB a good tool for RDBMS and it will be usefull too. Drop useless QL and forget transparence dream, this is a very big damage for users to sell JDO/EJB as standard way to access RDBMS.
Don't forget that in 3-4 years from now the computers with Terabytes of RAM will be probably the reality. So content of most of the databases can be fully kept in memory.
http://www.prevayler.org/wiki.jsp?topic=BreakthroughsInMemoryTechnology

Permormace tunning: MS SQL server is alredy doing self-tuning and managment of indicies. And you have almost no control over it. It's far away from being perfect but it will improve (like garabe collecting in java did).
There is some probability that other RDBMS system will follow this path and most of database tuining will be done automatically.


Michal

  Message #121175 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121172
Yes, I am going to live in the Mars in the future, but I need to develop applications today.
One of ways to tune queries is to enable SQL log, trace query plan to view statistics tables to create indexes to eliminate table scans, add hints to query, modify views. This kind of JDOQL, OQL, EJBQL or HQL queries are useless and it is hell for DBA or maintainers in practice.It is good on emtpy development databases and this kind of application must droped after database grows. SQL support is more usefull than cool and transparent OOP queries and optimistic attachments. Make JDO/EJB a good tool for RDBMS and it will be usefull too. Drop useless QL and forget transparence dream, this is a very big damage for users to sell JDO/EJB as standard way to access RDBMS.
Don't forget that in 3-4 years from now the computers with Terabytes of RAM will be probably the reality. So content of most of the databases can be fully kept in memory.http://www.prevayler.org/wiki.jsp?topic=BreakthroughsInMemoryTechnologyPermormace tunning: MS SQL server is alredy doing self-tuning and managment of indicies. And you have almost no control over it. It's far away from being perfect but it will improve (like garabe collecting in java did). There is some probability that other RDBMS system will follow this path and most of database tuining will be done automatically.Michal


  Message #121176 Post reply Post reply Post reply Go to top Go to top Go to top

no technical substance

Posted by: David Jordan on May 08, 2004 in response to Message #121169
Instead of using emotionally charged and negative words like abomination, complex and misfeatured, you should provide technical justification with examples. Otherwise, there is no substance to back up your claims.

You can create an association with an object without actually fetching the object from the database in JDO 1.0. The object identity of an object can be used to acquire a reference to an object representing the object in the database, which can then be used to establish the association. All this can be done without fetching the object from the database. The JDO interface gives the programmer the option of whether to validate the identity or not. But even with validation, it does not need to actually fetch the object from the database until the application initiates access of fields.

Getting the primary key of an associated object would be a trivial extension to JDO, if you considered it important you should have mentioned it during your brief and limited participation in the JDO expert group. The Java representation of that association is a Java reference in JDO, but the underlying JDO implementation also has the foreign key/primary key values of the associated object. If this is a major source of your issues with JDO, well it can very easily be resolved.

  Message #121178 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Kevin Lewis on May 08, 2004 in response to Message #121172
Hi, Michal.

Self-tuning and index management are a very minor part of optimizing the use of the database. Some databases have been managing indexes mostly on their own for a long time now. Indexes on tables are not any sort of panacea--it's much more complex than that.

Further, just keeping a database in memory doesn't solve as many problems as one might think--you still have to write to disk (or some persistent store) to commit a transaction, and protect data from concurrent updates, present a consistent picture of the data, etc. This means that placing the database in memory takes much more space than just the current copy of the database. It depends on how many readers and writers exist at any point in time (undo and redo segments, etc).

Besides, I have to build applications now--I'm not on the 3-4 year plan.

Thanks,
--Kevin

  Message #121179 Post reply Post reply Post reply Go to top Go to top Go to top

Misconception

Posted by: Patrik A on May 08, 2004 in response to Message #121169
Gavin,

the problem here is that JDO actually HAS a spec. Hibernate doesn't. If you were to write up a spec covering all peculairities of it, it would not be a pretty sight. It would be right up there with the JDO one.

Don't forget WHY hibernate is successful. Very few people chose between JDO and Hibernate, very few chooses between Hibernate and EJB. Hiberante is the default choice from the merit of, among other things, it being free, newAndCool and doesn't require an ejb container. Since there's no free ejb container (no, jboss does not count. It simply doesn't qualify as anything other than lots of code and stacktraces) hibernate is going to be picked. It used to be the Ofbiz entity engine (for the same reasons).

Another thing, this POJO bullshit has to end. There's nothing POJO about persistent objects in Hibernate. They're simply not Plain Old Java Objects. They have contracts with the hibernate persisters, their particulars are specified in configuration files, they are even "enhanced" by that cglib abomination of a tool.

Another thing that goes with the usage base hibernate has is the forgiving attitude. It's free and newAndCool, so people are going to forgive lots of irritating oddities they would never forgive WebSphere for. Write up specs for it and formalize it and people are going to realize what a bastard piece of software it really is in all its newAndCool:ness.

I predict that hiber..*cough*..EJB3 is going to end up the same route JDO has with noone using it. It's going to be too hard to implement, too hard to get stable and too hard to get any performance out of it, all the while the people who made hibernate the popular choice it is are all tugging at eachother's unmentionables to the next newAndCool persistence toy.

In closing, I'm not calling Hibernate bad. Really. I like hibernate and use it for three projects right now. I also like EJB very much. The fourth project uses EJB (including cmp entity beans). But these are all small projects where I have a lot of freedom to change decisions that turned out to be bad.

  Message #121180 Post reply Post reply Post reply Go to top Go to top Go to top

My campaign of FUD

Posted by: Abe White on May 08, 2004 in response to Message #121169
Proxy-base solutions have some other wonderful advantages, such as the ability to create an association to an object without actually fetching it from the database, and the ability to discover the primary key of an associated object without fetching it.
For the record, you can do this in JDO also. No problem.

I don't want to get into a "pissing match" either; I just want to stop the misinformation.

  Message #121182 Post reply Post reply Post reply Go to top Go to top Go to top

Speak for yourself

Posted by: Toby Reyelts on May 08, 2004 in response to Message #121169
The Java world has already adopted Hibernate over JDO, so apparently I am not the only one who thinks JDO is not perfect.
Please speak for yourself Gavin. I chose JDO over Hibernate for my project's needs and have been very happy with the decision.

I think what we're seeing right now, is that a lot of the fanbase for JDO and Hibernate has been divided based upon the type of work being done. I imagine that Hibernate has probably won over more of the "report-style" systems out there, while JDO has won out more of the systems that have complex application logic.

Based on JDO 2.0, I would say that JDO is poised to grab more market share in reporting systems, as it standardizes query capabilities like projection and aggregation, along with features like attachment/detachment. On the other hand, as things stand now, the only way I can see Hibernate winning me over, is if it implements the JDO standard.

God bless,
-Toby Reyelts

  Message #121183 Post reply Post reply Post reply Go to top Go to top Go to top

responding to my own post...

Posted by: David Jordan on May 08, 2004 in response to Message #121176
Actually, in the case of application identity in JDO, you can get the primary key of an associated object without retrieving the object. All you have to do is traverse the reference and access the fields corresponding to the primary key. This can all be done without fetching the object from the database. Its only the case of datastore identity where you cannot directly access the primary key values. But this is how datastore identity was designed, you are not supposed to directly deal with the representation. So for the typical relational approach of having primary keys, JDO 1.0 handles the situation just fine. So, Gavin, you are wrong again in these new criticisms of JDO.

  Message #121185 Post reply Post reply Post reply Go to top Go to top Go to top

My campaign of FUD

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121180
Proxy-base solutions have some other wonderful advantages, such as the ability to create an association to an object without actually fetching it from the database, and the ability to discover the primary key of an associated object without fetching it.
For the record, you can do this in JDO also. No problem. I don't want to get into a "pissing match" either; I just want to stop the misinformation.
I am sure it is possible without proxies too, cglib has a feature to intercept fields too, but nobody uses it in practice, I know authors, they do not use this stuff for many reasons too.

  Message #121186 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Michal Maczka on May 08, 2004 in response to Message #121178
Hi, Michal.Self-tuning and index management are a very minor part of optimizing the use of the database. Some databases have been managing indexes mostly on their own for a long time now. Indexes on tables are not any sort of panacea--it's much more complex than that.Further, just keeping a database in memory doesn't solve as many problems as one might think--you still have to write to disk (or some persistent store) to commit a transaction, and protect data from concurrent updates, present a consistent picture of the data, etc. This means that placing the database in memory takes much more space than just the current copy of the database. It depends on how many readers and writers exist at any point in time (undo and redo segments, etc).Besides, I have to build applications now--I'm not on the 3-4 year plan.Thanks,--Kevin
I agree will all of your comments. My intention was just say that ejb3 or jdo2 and ORM in generall have a future and this future looks brighter then then reality which we have today.

Michal

  Message #121188 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Kevin Lewis on May 08, 2004 in response to Message #121186
Oh, I agree. I want to use them, too. I just think it's important that they support native SQL as a "first class" dialect.

Thanks for your comments, Michal.

--Kevin

  Message #121192 Post reply Post reply Post reply Go to top Go to top Go to top

JDO versus Hibernate versus NewAndCool

Posted by: Ben Eng on May 08, 2004 in response to Message #121182
It is pretty obvious that the persistence problem is not solved today. The problem will not be perfectly solved by EJB 3.0 nor JDO 2.0. There will be areas of convergence in ORM (e.g., identity, metadata), and other areas of divergence (e.g., transparent persistence). It is not clear today whether query languages are converging or diverging.

My hope is that the J2EE standards being developed continue to enable innovation and competition by allowing for pluggable implementations. If the chosen standard technology is inappropriate for a particular purpose (like CMP entity beans for sophisticated data models), then choosing an alternative technology or implementation to take its place will always be the natural course of action. However, if those options are impeded by the container, the container will find itself in jeopardy of becoming irrelevant (replaced by better technology).

It seems almost humorous to see the many camps argue, except for the vitriol, like this is a marketing campaign, when the technical solution still seems far from being at hand. It will become more clear that we have reached a good solution, when there is convergence. The fact that there are heated battles between camps is itself strong evidence that convergence is not at hand. Sometimes JCP standards attempt to push the community towards converging on a particular approach. Failures to do so are a burden on the entire community, because they slow down progress on the Java platform itself (in relation to .NET in particular). I would encourage the Hibernate folks and the JDO folks not to fight, but to work both collaboratively and competitively, while not being overwhelmed by egos, to develop the most generally useful technical solution. And understand that we are still a long way from that goal, if we look outside of the individual camp that often colors our perspective, preventing us from recognizing the needs of the larger Java community.

  Message #121193 Post reply Post reply Post reply Go to top Go to top Go to top

ejb.jdo well nothing beat good old jdbc

Posted by: aturo michelangeli on May 08, 2004 in response to Message #121147
nothing beats good old vanilla jdbc. why do we have to bother will all the ejbql, jdoql crap. just use the good old straightforward jdbc.

  Message #121194 Post reply Post reply Post reply Go to top Go to top Go to top

ejb.jdo well nothing beat good old jdbc

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121193
nothing beats good old vanilla jdbc. why do we have to bother will all the ejbql, jdoql crap. just use the good old straightforward jdbc.
I found JDBC with some helpers is a very good way to access RDBMS, It does not mean I lost interest in innovations, but to sell experiment as standard is too much.

  Message #121195 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Abe White on May 08, 2004 in response to Message #121167
Can anyone explain the tradeoffs between using the JDOQL v. SQL in a typical JDO implementation?
The advantages of JDOQL are that it is so much simpler than SQL for complex queries, and that it only requires knowledge of the object model, rather than the names of tables and columns in the relational model (good for when you have different people managing each, or when you develop and deploy on different DBs, or switch DBs for performance or other reasons).

For example, consider a JDOQL filter on the hypothetical Employee class like:
"!(projects.contains (proj) && proj.manager.firstName == 'Abe')"
This means "find me all the employees who do *not* have any projects managed by Abe". Now imagine the SQL for that. Hint: you need a subselect and joins between at least 3 tables... possibly more depending on whether Employee is a subclass and what inheritance mapping strategy it uses.

So JDOQL allows for rapid development. Later, if you discover that your DB is creating a horrible execution plan for this query, then by all means tweak it, either by plugging into the vendor's SQL generation system, or by reverting to a straight SQL query.

  Message #121197 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121195
The advantages of JDOQL are that it is so much simpler than SQL for complex queries, and that it only requires knowledge of the object model, rather than the names of tables and columns in the relational model (good for when you have different people managing each, or when you develop and deploy on different DBs, or switch DBs for performance or other reasons).
Why do we need to use two models ? Do you think it is possible to write something meaningfull without relational model knowlege ?
If you need "alias" then you can use it in SQL too.

  Message #121198 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121195
BTW, how JDO or EJB can help to switch DBs for some reasons ?
JDO implementations have native features too, does it means we need standard on top of JDO and EJB to swich between JDO implementations for performance or other reasons ?

  Message #121199 Post reply Post reply Post reply Go to top Go to top Go to top

switching DBs with JDO

Posted by: David Jordan on May 08, 2004 in response to Message #121198
JDO lets you switch between DBs. Your JDO applications, both navigational and query access, will be binary compatible across all databases. By simply changing a couple of properties in a property file, you can switch between Oracle, IBM, (pick your favorite relational database), and a variety of other datastores supporting JDO. This is a major reason why Oracle and IBM don't like JDO, it does not provide vendor lockin. The JDO interfaces have been defined to provide binary compatibility and separation from the JDO implementation. You can have a single persistent class and use it simultaneously with several different JDO implementations (each managing their own database connection) and things work just fine. Every vendor supporting a standard is going to have their own features that you can choose to use or not. That is no reason not to adopt a standard. In JDO, using the standard interfaces, you can switch JDO implementations and underlying databases without having to change a single line of Java source.

  Message #121200 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: David Jordan on May 08, 2004 in response to Message #121197
Yes, you can write meaningful Java code without relational model knowledge. The relational model and Java object model mapping is defined in an XML metadata file. That mapping is the sole place the information resides and is used by the JDO implementation to provide an efficient mapping between your Java object model and the underlying database being accessed. In your JDO application, you only need to interact with your Java object model, there is no need to use the relational model. Get a book about JDO and learn about it. I have the feeling that some of the people throwing darts here at JDO are not that familiar with it. There are a number of books that describe JDO.

  Message #121201 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Kevin Lewis on May 08, 2004 in response to Message #121200
Hi, David.

So JDO abstracts the database concurrency model and schema characteristics? How does it do this in an efficient manner? The concurrency models of leading databases are vastly different (despite what many people think). How does JDO handle this?

Further, and perhaps unfortunately, for performance reasons, an object model often has to be adjusted to efficiently map to a relational model. These changes often include navigability and inheritance (and more). How does JDO compensate for (what I would consider) a simple fact of the impedance mismatch between an object and relational model?

In short, I find it somewhat difficult to believe that someone can build an efficient application without a solid knowledge of the database, including the concurrency model and the schema in use.

I'm happy to be wrong, though.

Thanks,
--Kevin

  Message #121202 Post reply Post reply Post reply Go to top Go to top Go to top

switching DBs with JDO

Posted by: Doug Clarke on May 08, 2004 in response to Message #121199
Although hesitant to join this discussion I do feel that the theme of dispelling misinformation must be continued.

OracleAS TopLink provides our customers with database independence. We generate and support the use of standard and native SQL for all of the major relational database vendors. This is public information in our statement of direction on our Oracle Technology Network (OTN) page.

Not only do we claim this support but we verify this against all the major vendors and releases. Our enterprise customers are not purely Oracle database or Oracle Application Server. In most cases these large customers must maintain a heterogeneous set of databases and application servers.

Cheers,

Doug Clarke
Product Manager, OracleAS TopLink

  Message #121203 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121200
Yes, you can write meaningful Java code without relational model knowledge. The relational model and Java object model mapping is defined in an XML metadata file. That mapping is the sole place the information resides and is used by the JDO implementation to provide an efficient mapping between your Java object model and the underlying database being accessed. In your JDO application, you only need to interact with your Java object model, there is no need to use the relational model. Get a book about JDO and learn about it. I have the feeling that some of the people throwing darts here at JDO are not that familiar with it. There are a number of books that describe JDO.
I do not need books about JDO. Trust me I know specification and I can implement it myself (BTW It was interesting to read and I did it a few times).
I must be sure it is a good idea, before to use it in the real projects. Relational model is more usefull than Java object, it is the fact,
I hope you know relational theory and do not need books about relational algebra, RDBMS, SQL, transactions and concurency control. If you not know it and know about data structures like "bean" only then you can not write something more than PetStore.

  Message #121204 Post reply Post reply Post reply Go to top Go to top Go to top

Of course, JDO uses one Model and why not?

Posted by: David Ezzio on May 08, 2004 in response to Message #121197
Why do we need to use two models? Do you think it is possible to write something meaningfull without relational model knowlege?
Juozas,

I think you have hit the crux of the matter. JDO consciously decided to work with only one model -- the model of Java objects that can be persisted. The programs interaction with JDO consists of life cycle requests on persistent objects (find, create, delete, pre-fetch fields, detach, attach, etc.) and of controlling transactional boundaries (except when the container controls them.) As a result, the query language is based on the object model and not the database schema. Is it possible to write something meaningful without relational knowledge. Yes, and why not? You don't have to write a relational database server to get your data persisted, why should you have to write a persistence layer to get your data persisted? The history of software is one of constantly implementing another abstraction. There really was a time when Assembly language was considered a toy. Real programmers wrote their code in machine ops. So yes, JDO is a step in the right direction. Furthermore, the vendors have every incentive to write the most performant code possible.

David Ezzio

  Message #121205 Post reply Post reply Post reply Go to top Go to top Go to top

Of course, JDO uses one Model and why not?

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121204
Why do we need to use two models? Do you think it is possible to write something meaningfull without relational model knowlege?
Juozas,I think you have hit the crux of the matter. JDO consciously decided to work with only one model -- the model of Java objects that can be persisted. The programs interaction with JDO consists of life cycle requests on persistent objects (find, create, delete, pre-fetch fields, detach, attach, etc.) and of controlling transactional boundaries (except when the container controls them.) As a result, the query language is based on the object model and not the database schema. Is it possible to write something meaningful without relational knowledge. Yes, and why not? You don't have to write a relational database server to get your data persisted, why should you have to write a persistence layer to get your data persisted? The history of software is one of constantly implementing another abstraction. There really was a time when Assembly language was considered a toy. Real programmers wrote their code in machine ops. So yes, JDO is a step in the right direction. Furthermore, the vendors have every incentive to write the most performant code possible. David Ezzio
This is the right direction, if you think object model is better than relational in some way. I do not think so. Sorry if it looks like ignorance, but I like innovations and I like JDO too (As you can see, I have spend a lot of time to talk about it, my coworkers just ignore it).

  Message #121207 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Abe White on May 08, 2004 in response to Message #121201
How does JDO compensate for (what I would consider) a simple fact of the impedance mismatch between an object and relational model?
The impedance mismatch between the relational and object models is well know, of course. It's the same problem that every ORM tool faces, whether it be a JDO implementation, Hibernate, EJB 3, Toplink, etc. And, basically, all these tools solve the problem in the same ways:
1. Dynamically adapt their behavior to the database in use. This includes varying their SQL, their locking policies, etc.
2. Provide tools to the developer. Tools to create an efficient schema for a given object model, to create an efficient object model for a given schema, or to wire an existing schema and an existing object model together.
3. As a last-ditch resort, allow the user to access the underlying JDBC layer directly.

While the details and specific capabilities of each ORM technology differ, the above broad-strokes strategies don't.

  Message #121208 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Kevin Lewis on May 08, 2004 in response to Message #121207
Hi, Abe.

Thanks for your list.

In my view, the only reason to use one of these frameworks is to get my objects in and out of the database. Every time I've used one (and this includes Entity Beans), I have to jump through hoops to get the concurrency right (or, at least, acceptable--it's almost never optimal), and they always generate SQL that just sucks.

Now, if JDO will allow me to do native database locking, and not try to do it on its own (because I don't believe it can do it correctly without either being inefficient, just wrong, or more painful than the native database), then that's cool. I don't want it to "be my database"; I just want it for the brokering.

Thanks,
--Kevin

  Message #121209 Post reply Post reply Post reply Go to top Go to top Go to top

switching DBs with JDO

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121202
Although hesitant to join this discussion I do feel that the theme of dispelling misinformation must be continued.OracleAS TopLink provides our customers with database independence. We generate and support the use of standard and native SQL for all of the major relational database vendors. This is public information in our statement of direction on our Oracle Technology Network (OTN) page.Not only do we claim this support but we verify this against all the major vendors and releases. Our enterprise customers are not purely Oracle database or Oracle Application Server. In most cases these large customers must maintain a heterogeneous set of databases and application servers.Cheers,Doug ClarkeProduct Manager, OracleAS TopLink
As I understand this database independence is more usefull for vendor to have more customers. SQL is a standard too, but I think it is better to have performant and tested application for one RDBMS implementation than something for all possible "persistent stores". Most "enterprice" applications are not redistributed like text editors and I do not think database or storage independance is usefull for this kind of application. All ways are good to persist data for PetStore type applications, It was proved a lot of times: EJB,.NET, iBatis, I am sure there is no problems to implement PetStore with JDO too.
I have changed RDBMS for some applications a few times too, but It was no problems. It takes a few days to port JDBC code or to implement some "abstractions", application must work, perform and to be maintained a few years and I prefer to use native features if it helps to solve my problems and it has more value than my few days.
I need more arguments to use and to trust standards like new EJB and JDO.

  Message #121210 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: David Jordan on May 08, 2004 in response to Message #121207
One advantage you get with JDO technology is that the JDO companies have true experts into how to most efficiently map object models into relational databases, people like Abe White. To respond to another post, yes I know SQL, I was promoting its use back in the early 1980s and I have used it on a variety of applications since then. But your average Java developer out there is not a SQL expert. And even if they are, they are often under very tight schedule constraints and spending time thinking about how to optimize their SQL is less important than being sure all the functionality of the application is working by the delivery date. With JDO, the optimal mapping strategies have been codified and made mechanical and automated in the JDO tool. Some of you love SQL and want to use SQL. That is fine, you can use SQL and you will not be able to leverage the benefits from defining an object model. But if you are building Java object models and handling their mapping by yourself, you are working in a very inefficient manner. Your facilities are not going to be as sophisticated as the JDO API and for each new class you want to make persistent, you have a lot more work to do. JDO lets you work with Java object models, JDBC lets you work with relational models through the SQL language. For some applications, SQL is an appropriate technology. But for other applications, ones that require the use of object-oriented facilities like encapsulation, inheritance, and polymorphism, JDO lets you base your application on those object models and automates the mapping of those models to the database. And it does so in a manner that also makes your application completely independent of the underlying database. If you use JDBC, you will quickly lock yourself into the SQL dialect of the database you are using. With JDO, the JDO implementation takes care of handling the various SQL dialects.

  Message #121213 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: David Jordan on May 08, 2004 in response to Message #121208
Yes, JDO implementations use the underlying database for locking, though they do some special things for handling optimistic concurrency control. Yes, I have heard a number of people complain about the kind of SQL generated by entity bean frameworks. I suggest you download an eval of a JDO implementation, give it a test drive, observe the SQL it generates, and see for yourself. Put together a simple object model with a few relationships. You should be able to get things up and running in an afternoon.

  Message #121214 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121210
We use SQL and have no problems to write it, all of my coworkers are SQL experts. If JDO is for "average Java developer" then is not for us and probably my coworkers are rigth about it. I thought we discuss about technologies for enterprice on the server side.
One advantage you get with JDO technology is that the JDO companies have true experts into how to most efficiently map object models into relational databases, people like Abe White. To respond to another post, yes I know SQL, I was promoting its use back in the early 1980s and I have used it on a variety of applications since then. But your average Java developer out there is not a SQL expert. And even if they are, they are often under very tight schedule constraints and spending time thinking about how to optimize their SQL is less important than being sure all the functionality of the application is working by the delivery date. With JDO, the optimal mapping strategies have been codified and made mechanical and automated in the JDO tool. Some of you love SQL and want to use SQL. That is fine, you can use SQL and you will not be able to leverage the benefits from defining an object model. But if you are building Java object models and handling their mapping by yourself, you are working in a very inefficient manner. Your facilities are not going to be as sophisticated as the JDO API and for each new class you want to make persistent, you have a lot more work to do. JDO lets you work with Java object models, JDBC lets you work with relational models through the SQL language. For some applications, SQL is an appropriate technology. But for other applications, ones that require the use of object-oriented facilities like encapsulation, inheritance, and polymorphism, JDO lets you base your application on those object models and automates the mapping of those models to the database. And it does so in a manner that also makes your application completely independent of the underlying database. If you use JDBC, you will quickly lock yourself into the SQL dialect of the database you are using. With JDO, the JDO implementation takes care of handling the various SQL dialects.


  Message #121215 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: David Jordan on May 08, 2004 in response to Message #121214
No one is asking or forcing you to stop doing SQL.

I assume you are not doing object models. If you don't care about having an object model, then don't use JDO. If you do want to use object models for your persistent information, then JDO is the JCP standard for doing it in Java.

Some of us feel that object models are appropriate for use in enterprise applications. And JDO is being used in enterprise applications.

  Message #121217 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: Juozas Baliuka on May 08, 2004 in response to Message #121215
No one is asking or forcing you to stop doing SQL.I assume you are not doing object models. If you don't care about having an object model, then don't use JDO. If you do want to use object models for your persistent information, then JDO is the JCP standard for doing it in Java.Some of us feel that object models are appropriate for use in enterprise applications. And JDO is being used in enterprise applications.
Yes, my objects are more data structures than objects models. I see code and ideas on forums, blogs and I am sure most of "enterprise" applications are implemented this way : Statefull services like session beans, DAO and DTA/value objects.
This is not "Object Model", as I understand JDO PersistenceManager is a set of "procedures" too. Evrything usel and domain model is RDBMS.
This discussion helps me understand it, It was very usefull for me and I have no more commens.

  Message #121218 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Abe White on May 08, 2004 in response to Message #121208
Every time I've used one (and this includes Entity Beans), I have to jump through hoops to get the concurrency right (or, at least, acceptable--it's almost never optimal), and they always generate SQL that just sucks.Now, if JDO will allow me to do native database locking, and not try to do it on its own (because I don't believe it can do it correctly without either being inefficient, just wrong, or more painful than the native database), then that's cool. I don't want it to "be my database"; I just want it for the brokering.Thanks,--Kevin
Of course, I can't speak for all JDO implementations, but I can address your concerns in relation to Kodo (http://www.solarmetric.com).

First, I think Kodo produces excellent SQL. This includes not only basics like only updating fields that have actually changed, inserting and deleting individual collection/map elements that have changed rather than deleting and re-inserting the entire contents (unless, due to the number of changes, that is more efficient), utilizing update counts to determine optimistic concurrency violations, and so forth, but also more advanced things like:
- Dynamically ordering SQL updates to meet all foreign key constraints, including circular constraints, with a minimum of trips to the DB.
- Dynamically ordering SQL to handle relations made to newly persistent objects with auto-incrementing primary keys, so that the final pk values aren't known until flush, also while minimizing DB trips.
- Maximizing statement batch sizes if statement batching is enabled.
- Uniquing query results using distinct keyword and subselects when necessary so that a to-many relational join made in a query doesn't mean you get N repeats of the same object in the results.
- Translation of JDOQL to efficient SQL.

As far as locking goes: of course you can control the JDBC isolation level Kodo initializes connections with, for a start. And we have multiple different versioning schemes you can use for optimistic locking policies. And we have runtime locking APIs for controlling how individual objects / queries are locked. And you can even completely take over the locking by implementing our LockManager interface. Or of course you can jump down to the JDBC level and lock rows yourself. Not all of this is covered in the same place since it's a little cross-cutting (optimistic versioning vs. locking vs. JDBC access), but here's a link to our reference guide's section on locking:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_locking.html

  Message #121219 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: David Jordan on May 08, 2004 in response to Message #121217
You could implement your DAO objects using JDO to do all the mapping work for you automatically. JDO lets you get this part of the task done much faster than coding this yourself. It automates this mapping behavior, and does so in a uniform manner throughout your object model. It also allows you to query relative to that object model. I doubt your handcrafted OR mapping supports queries at the object level. It is extremely rare for an application to undertake that level of sophistication. JDO also automatically tracks your updates, to fields and relationships and then automatically maps these updates back to the database, without a single line of code written by you. JDO is going to be much more productive than you coding this all yourself.

When I talk about persistent objects, I am not referring to the JDO PersistenceManager, that is not part of your domain model, that is an interface used to access services of the JDO interface. Yes, every object in an object model has a set of methods, a set of "procedures". I don't know what your statement about that is supposed to mean. You don't persist the PersistenceManager in JDO. JDO can persistent instances of the Java classes that you (or others) have defined. Your Java classes can be very thin with simple getters and setters, or they can have a very rich set of semantics and behavior, it is entirely up to you.

  Message #121220 Post reply Post reply Post reply Go to top Go to top Go to top

Misconception

Posted by: Cameron Purdy on May 08, 2004 in response to Message #121179
Hi Patrick,
the problem here is that JDO actually HAS a spec. Hibernate doesn't. If you were to write up a spec covering all peculairities of it, it would not be a pretty sight. It would be right up there with the JDO one.

Don't forget WHY hibernate is successful. Very few people chose between JDO and Hibernate, very few chooses between Hibernate and EJB. Hiberante is the default choice from the merit of, among other things, it being free, newAndCool and doesn't require an ejb container. Since there's no free ejb container (no, jboss does not count. It simply doesn't qualify as anything other than lots of code and stacktraces) hibernate is going to be picked. It used to be the Ofbiz entity engine (for the same reasons).

Another thing, this POJO bullshit has to end. There's nothing POJO about persistent objects in Hibernate. They're simply not Plain Old Java Objects. They have contracts with the hibernate persisters, their particulars are specified in configuration files, they are even "enhanced" by that cglib abomination of a tool.

Another thing that goes with the usage base hibernate has is the forgiving attitude. It's free and newAndCool, so people are going to forgive lots of irritating oddities they would never forgive WebSphere for. Write up specs for it and formalize it and people are going to realize what a bastard piece of software it really is in all its newAndCool:ness.

I predict that hiber..*cough*..EJB3 is going to end up the same route JDO has with noone using it. It's going to be too hard to implement, too hard to get stable and too hard to get any performance out of it, all the while the people who made hibernate the popular choice it is are all tugging at eachother's unmentionables to the next newAndCool persistence toy.

In closing, I'm not calling Hibernate bad. Really. I like hibernate and use it for three projects right now. I also like EJB very much. The fourth project uses EJB (including cmp entity beans). But these are all small projects where I have a lot of freedom to change decisions that turned out to be bad.
These are all interesting points, although I disagree on the EJB point:

- The reason that Hibernate exists (among others) is that there was a big chunk of the market that wasn't fulfilled by entity EJB, plain JDBC and expensive ORM products (remember - JDO wasn't really available back when Gavin got fed up with entity EJB.) In other words, Hibernate exists because there a natural space to fill.

- Previous to ORMs (including JDO implementations and Hibernate) there was no standard -- either "spec" or de facto -- for ORM. The closest was Toplink, which was both expensive and problem-plagued.

- I suggest that Entity EJBs would not have been used anywhere near as much if any other simpler solutions had existed.

- Unlike when EJB 1.0 was release, when Entity EJB 3.0 comes into a mature market, people won't feel that they *have* to use it, because there are other standard solutions available that are more suited to simple ORM tasks.

- Entity EJB 3.0 will get used for the same application pieces that would have / should have used Entity EJB 2.x if the apps had been built sooner.

Peace,

Cameron Purdy
Tangosol, Inc.
Coherence: Clustered JCache for Grid Computing!

  Message #121222 Post reply Post reply Post reply Go to top Go to top Go to top

Good question, I'd like to know too

Posted by: peter lin on May 08, 2004 in response to Message #121153
But rather than take our word for it, let's look at an example:Query q = pm.newQuery (Employee.class);q.setResult ("firstName, lastName, department"); q.setFilter ("age > 50 && !retired && department.name == 'Marketing' && projects.isEmpty ()"); q.orderBy ("employeeId ascending");We think it is pretty clear to anyone who knows Java exactly what this query does. It selects the first name, last name, and department object of every employee who is older than 50, not retired, in the marketing department, and who is not working on any projects.
Ok, it looks very cool. How DBA can tune it ?
I don't know hibernate or any of the JDO packages well enough to say how it is handled. On large financial projects, the DBA's tend to lock down the database and developers do not have access to write stored procedures. Many companies require that all queries go through the DBA, so that every single query is tested and profiled. For small projects with less than 10-15 million rows of data, it's probably ok to let the developers just write the queries. But when the database contains 100million+ rows of data, profiling the queries and creating views to optimize read queries is very important.

  Message #121223 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: Mark Nuttall on May 08, 2004 in response to Message #121215
Some of us feel that object models are appropriate for use in enterprise applications. And JDO is being used in enterprise applications.
One of the reasons for using an OO language in the first place. If it isn't appropriate in enterprise applications then it definitely isn't useful in non-enterprise applications (read: quick-and-dirty apps?).

  Message #121224 Post reply Post reply Post reply Go to top Go to top Go to top

On object models

Posted by: Robin Roos on May 08, 2004 in response to Message #121217
I've been following this thread with interest - thanks to all of those that have contributed.

Something so far overlooked in immediate coverage of the EJB 3.0 announcement is the removal of Container Managed Relationships (CMR) from the next reincarnation of entity beans. The term "object model", when applied to a persistent domain, covers a spectrum of possible designs. In a broad-brush treatment this spectrum goes from anaemic (state + property setters) through various degrees of behavioural richness (collaboration establishment + dissolution and collaboration/property validation) to behaviourally complete (all domain-relevant logic).

EJB 3.0's removal of CMR validates the approach taken by JDO - the object model knows how to manage itself and the persistence service merely synchronizes the in-memory object model with the database. The exception that JDO makes is the explicit support of cascade deletion for obvious performance reasons.

So finally, with EJB 3.0, what might be called the "main stream" of enterprise developers will be forced by technology to move away from the anaemic model towards having some degree of behaviour in their persistent objects.

How much behaviour is too little? How much is too much?

The theorists agree that those objects which are business abstractions should hold behaviour appropriate to those abstractions. There is much published empirical work on how to allocate that behaviour across the model.

Symptomatically, if you have different applications working on the same model and domain-relevant behaviour is being duplicated then it should be in the domain objects themselves. Equally, if you have behaviour in the domain objects used by one application, and this behaviour is counter to the requirements of a new application using the same domain, then you've inadvertently put application-relevant behaviour into the domain object model and this must be corrected.

JDO lets the designer choose, and always has. But whichever design approach you choose, JDO will faithfully persist the object model you have designed.

Kind regards, Robin.

  Message #121225 Post reply Post reply Post reply Go to top Go to top Go to top

Good question, I'd like to know too

Posted by: Mark Nuttall on May 08, 2004 in response to Message #121222
But rather than take our word for it, let's look at an example:Query q = pm.newQuery (Employee.class);q.setResult ("firstName, lastName, department"); q.setFilter ("age > 50 && !retired && department.name == 'Marketing' && projects.isEmpty ()"); q.orderBy ("employeeId ascending");We think it is pretty clear to anyone who knows Java exactly what this query does. It selects the first name, last name, and department object of every employee who is older than 50, not retired, in the marketing department, and who is not working on any projects.
Ok, it looks very cool. How DBA can tune it ?
I don't know hibernate or any of the JDO packages well enough to say how it is handled. On large financial projects, the DBA's tend to lock down the database and developers do not have access to write stored procedures. Many companies require that all queries go through the DBA, so that every single query is tested and profiled. For small projects with less than 10-15 million rows of data, it's probably ok to let the developers just write the queries. But when the database contains 100million+ rows of data, profiling the queries and creating views to optimize read queries is very important.
Any wonder applications are so expensive to develop and maintain? The problem is trying to code in a OO world and persist in a relational. Nothing is 100% (yet) and so something has to give. ORM tools are a great middle ground. From what I've seen, the queries generated are as good as a DBA will write (we had ours looked at).

  Message #121226 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: Mark Nuttall on May 08, 2004 in response to Message #121217
No one is asking or forcing you to stop doing SQL.I assume you are not doing object models. If you don't care about having an object model, then don't use JDO. If you do want to use object models for your persistent information, then JDO is the JCP standard for doing it in Java.Some of us feel that object models are appropriate for use in enterprise applications. And JDO is being used in enterprise applications.
Yes, my objects are more data structures than objects models. I see code and ideas on forums, blogs and I am sure most of "enterprise" applications are implemented this way : Statefull services like session beans, DAO and DTA/value objects.This is not "Object Model", as I understand JDO PersistenceManager is a set of "procedures" too. Evrything usel and domain model is RDBMS. This discussion helps me understand it, It was very usefull for me and I have no more commens.
That clears up why you don't understand the beauty of ORM.

And it makes me wonder why you are using Java? Why not C/C++. Especially if speed is concern. Why not .Net? It integrates great with the vendor platform giving performance and superior integration on that platform.

  Message #121227 Post reply Post reply Post reply Go to top Go to top Go to top

How banks implement Queries

Posted by: Robin Roos on May 08, 2004 in response to Message #121222
On large financial projects, the DBA's tend to lock down the database<snip>
Banks like to compartmentalize things. They get developers to use named queries (supported directly by JDO 2.0) but they facade invocation of the query by their own query factory. This query factory runs locally (not remotely) and it knows to delegate to the underlying named query in most cases - pure delegation. But it also knows that in one or two particular instances, specific named queries are invoked in a "special" way, usually involving a stored proc or custom SQL and perhaps combined with elements of object model navigation.

In JDO 2.0 the "special" query may still be executed as SQL through the javax.jdo.Query API, and the result is the same persistent objects that would have been retrieve using the named query without "special" treatment; just make sure that the requisite primary key fields are part of the select.

Alternatively, if you wanted just field values and not persistent objects, that's supported through the aggregation and projection capabilities of the Query interface. And if you don't want an Object[] of fields per returned row from your projected query, just set the query result to an instance of your own custom JavaBean and you'll get one of those per returned row instead. Each of these permutations is supported by the named query capability, and each can have its usual implementation subverted through interception by a Query factory.

The approach described above works without vendor lock-in but does require some homegrown infrastructure. The alternative is to implement a plug-in for your JDO implementation to achieve the same end - less effort overall but a lock-in to the vendor's plug-in architecture.

Alternatively, if all you want to do is substitute SQL for the JDOQL of a named query, you can merely alter the query metadata to be SQL-based.

That is how banks approach the issue.

  Message #121228 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Mileta Cekovic on May 08, 2004 in response to Message #121195
Why not let JDO 2.0 have a text-based declarative query language too (something like HQL) and leave existing Java-based JDOQL as an alternative. There are situations where one is better then onother and vice versa. Actually, the JDO implementation could parse text-based query and invoke methods to construct Java-based query.

If there would be existing JDO 2.0 implementation now, I would use it rather then Hibernate, but if I have to choose now, the Hibernate would be the choice.

Mileta

  Message #121229 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 and JDO 2.0: Views from both sides

Posted by: Brian Miller on May 08, 2004 in response to Message #121147
q.setFilter ("age > 50 && !retired && department.name == 'Marketing' && projects.isEmpty ()"); q.orderBy ("employeeId ascending");
I don't understand why setFilter(), orderBy(), etc take string arguments?! Why for example does java.lang.Comparable not need string parameters, yet setFilter() does?! Why the need to subvert Java's static typing? Has Java hit its syntactic limit? Are POJOs that difficult to checkpoint? Would a little Groovy do more here? I personally believe that static typing is more important than the EJB 3 expert group seems to. Sigh.

As for field interception, it's mechanical overkill, and unecessary for object checkpointing.

  Message #121232 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: ABC DEF on May 08, 2004 in response to Message #121167
Can anyone explain the tradeoffs between using the JDOQL v. SQL in a typical JDO implementation?I think that tuning SQL is a fundamental part of any developer's work with a relational database. Further, there is quite a bit of difference between effective SQL in one database v. another, and it is very important that you use SQL that works best with your database (if you want your application to perform, that is).I personally don't see any advantage to learning another query language because SQL works very well--unless there are framework-related advantages to JDOQL. Further, I think it's much easier to write a query in a SQL query tool than to write a query as shown above (which to me is much harder to understand and much more error prone, though I haven't ever used JDO); another advantage of normal SQL, I think.Thanks for any explanations or contradictions.--Kevin
I totally agree with you. It's amazing that some "Java developers" think it's OK to be dimwits and complete morons when it comes to database design and query optimizaton, and relagate this vital responsibility to DBA's.

A DBA is a database administrator, not a developer. It's really appalling that these so-called developers should be involved in anything that touches a database. No wonder why their applications perform like snails, and they blame Java for being slow rather than their crappy coding.

  Message #121233 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 and JDO 2.0: Views from both sides

Posted by: Robin Roos on May 08, 2004 in response to Message #121229
Hi Brian

Java has the notion of Employee.class but no notion of Employee.name.field. This makes it difficult to render field-level information in a typesafe way without getting into heaps of code generation with the necessary constant definitions.

Anyway, with SQL and EJBQL generally working in a similarly un-typed way I don't think it's a competitive issue. Of course, if you externalize your queries as metadata-defined "named queries" you could have a tool run through the definitions and validate them against your object model if you wished.

If you have better ideas about typing queries then let us know for JDO 2.1/2.2.

Thanks, Robin.

  Message #121234 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: tom tarb on May 08, 2004 in response to Message #121168
I'm glad I'm not the only one who shares that opinion. All the [^S]QLs are great at quick development, but fall flat on their face when it comes to complex SQL and tuning. Its similar to the "do everything in configuration" mentality. You look at the code and you have no idea what is happening. And of course, the configuration file is conveniently burried in layers of jar files so that "change is easy" :)

  Message #121236 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Robin Roos on May 08, 2004 in response to Message #121234
Then you'll be really impressed that JDOQL supports SQL invocation for the times that it is needed. A better approach, though, is to intercept named query execution as per my "how banks do queries" response. This allows you to keep the SQL, which is brittle to schema changes, out of the application which is mapped to (but insulated from) the schema.

That way you get the best of both worlds - speed of development and tuning. It also helps people to avoid the pre-optimization anti pattern by getting hung up on queries which have not yet been identified as a source of performance constraint.

Kind regards, Robin.

  Message #121243 Post reply Post reply Post reply Go to top Go to top Go to top

Best DAO is... (and ... I don't like what Hibernate did either)

Posted by: Vic Cekvenich on May 08, 2004 in response to Message #121147
For Hibrenate to give a community open source to commericalize it, so we pay for it, it's not good for commnutiy.

PartII:
The best DAO by far is ibatis v2.
Here is an example:
<sqlMap namespace='Content'>

<cacheModel id="content_cache" type="MEMORY" >
<flushInterval minutes= "2"/>
<flushOnExecute statement = 'Content.blogInsert' />
 </cacheModel>

<select id='selectAll' resultClass='java.util.HashMap'
cacheModel='content_cache'>
SELECT
*
FROM
content
order by
id desc
limit 5
 </select>

then you just say
List l = sqlMap.querryForList("selectAll");

It simple, fast and people that don't know Java can tune it.

KISS
.V

  Message #121244 Post reply Post reply Post reply Go to top Go to top Go to top

JDO versus Hibernate versus NewAndCool

Posted by: Matthew Adams on May 09, 2004 in response to Message #121192
I would encourage the Hibernate folks and the JDO folks not to fight, but to work both collaboratively and competitively, while not being overwhelmed by egos, to develop the most generally useful technical solution. And understand that we are still a long way from that goal, if we look outside of the individual camp that often colors our perspective, preventing us from recognizing the needs of the larger Java community.
The JDO EG purposely relaxed the binary compatibility requirement (the requirement to implement javax.jdo.spi.PersistenceCapable, usually done via bytecode enhancement) and made it optional primarily so that Hibernate and TopLink could very easily become JDO2-compliant. I think the JDO EG has shown a willingness to work with others to advance the state of the art in transparent object persistence.

--matthew

  Message #121245 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121226
That clears up why you don't understand the beauty of ORM. And it makes me wonder why you are using Java? Why not C/C++. Especially if speed is concern. Why not .Net? It integrates great with the vendor platform giving performance and superior integration on that platform.
Why do you think I do not use C++ ? I will use .NET too if it will work on UNIX,
JAVA, OOP is not a religion. If relational model is better for domain model then I use it and I use OOP then it makes sence.

  Message #121246 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: geoff hendrey on May 09, 2004 in response to Message #121167
Can anyone explain the tradeoffs between using the JDOQL v. SQL in a typical JDO implementation?I think that tuning SQL is a fundamental part of any developer's work with a relational database. Further, there is quite a bit of difference between effective SQL in one database v. another, and it is very important that you use SQL that works best with your database (if you want your application to perform, that is).I personally don't see any advantage to learning another query language because SQL works very well--unless there are framework-related advantages to JDOQL. Further, I think it's much easier to write a query in a SQL query tool than to write a query as shown above (which to me is much harder to understand and much more error prone, though I haven't ever used JDO); another advantage of normal SQL, I think.Thanks for any explanations or contradictions.--Kevin
Let's remember that if you are using JDO, you are freeing your code to be deployed against virtually any datastore. Could be relational, could be OODBMS, whatever. Having SQL in your application code 1) ties you to a SQL database and 2) forces your applicaiton code to have knowledge of the database schema. By using JDOQL, you allow the the application to be easliy targeted to other datastores without changing your application code. To anyone who knows Java, learning JDOQL is trivial - JDOQL virtually IS standard java syntax.

  Message #121247 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: geoff hendrey on May 09, 2004 in response to Message #121208
Hi, Abe.Thanks for your list.In my view, the only reason to use one of these frameworks is to get my objects in and out of the database. Every time I've used one (and this includes Entity Beans), I have to jump through hoops to get the concurrency right (or, at least, acceptable--it's almost never optimal), and they always generate SQL that just sucks.Now, if JDO will allow me to do native database locking, and not try to do it on its own (because I don't believe it can do it correctly without either being inefficient, just wrong, or more painful than the native database), then that's cool. I don't want it to "be my database"; I just want it for the brokering.Thanks,--Kevin
Yes, of course JDO delegates locking (and transactions, in general) to the database.

  Message #121252 Post reply Post reply Post reply Go to top Go to top Go to top

leveraging the mapping expertise of experts

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121219
I thougth, I am do it wrog and I am tired to find some "OOP way". Now I see I was not wrong, This discussion proved it for me, object model on top of relational model is useless. All JDO/EJB advokates say O/R is very good for objects and domain model, but nobody can explain why it I need this object model on top on relational model, I found nothing wrong in relational model, data structures and procedures aka DAO and DTO. Why do I need to create object model on top of relation model and to hide this object model with procedures and data structures ? RDBMS -> Mapping -> Object Model -> DAO (procedures), Is something better than RDBMS -> DAO (procedures), how this object design can be more productyve and performant ?
You could implement your DAO objects using JDO to do all the mapping work for you automatically. JDO lets you get this part of the task done much faster than coding this yourself. It automates this mapping behavior, and does so in a uniform manner throughout your object model. It also allows you to query relative to that object model. I doubt your handcrafted OR mapping supports queries at the object level. It is extremely rare for an application to undertake that level of sophistication. JDO also automatically tracks your updates, to fields and relationships and then automatically maps these updates back to the database, without a single line of code written by you. JDO is going to be much more productive than you coding this all yourself.When I talk about persistent objects, I am not referring to the JDO PersistenceManager, that is not part of your domain model, that is an interface used to access services of the JDO interface. Yes, every object in an object model has a set of methods, a set of "procedures". I don't know what your statement about that is supposed to mean. You don't persist the PersistenceManager in JDO. JDO can persistent instances of the Java classes that you (or others) have defined. Your Java classes can be very thin with simple getters and setters, or they can have a very rich set of semantics and behavior, it is entirely up to you.


  Message #121255 Post reply Post reply Post reply Go to top Go to top Go to top

WTF?

Posted by: geoff hendrey on May 09, 2004 in response to Message #121147
I used to write apps that used heaps of Entity beans with container managed relationships. EB's were complex, but nevertheless HEAVILY promoted as a "best practice" by both Sun and all the app server vendors. So I was feeling pretty good about the nifty apps I'd built on EJB when I went to JavaOne '02. I attended a presentation on JDO.

I remember a mix of fear and confusion as I left the presentation. It was almost immediately clear to me that the Entity Bean model was all wrong for persistence. I felt cheated, in a way, that I had made such a long investment in EJB and that there seemed to be political machinations that had kept JDO largely from seeing the light of day. I was also worried that it would be really hard to learn JDO. Mainly this worry was based on my experience with the complexity of Entity Beans.

Anyway, that was 2 years ago and I am stoked that I have not written a single entity bean since then. JDO is so much better, and was very easy to learn. I LOVE the fact that JDO is NOT part of J2EE and that it strives to remain fundamentally simple and developer friendly. A few intrenched vendors have shunned JDO and are trying to spread FUD -- it gives JDO a great Underdog status. Frankly, those that shun JDO today were the folks responsible for the real "abomination": the Entity Bean.

  Message #121256 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121218
First, I think Kodo produces excellent SQL. This includes not only basics like only updating fields that have actually changed, inserting and deleting individual collection/map elements that have changed rather than deleting and re-inserting the entire contents (unless, due to the number of changes, that is more efficient), utilizing update counts to determine optimistic concurrency violations, and so forth, but also more advanced things like:- Dynamically ordering SQL updates to meet all foreign key constraints, including circular constraints, with a minimum of trips to the DB.- Dynamically ordering SQL to handle relations made to newly persistent objects with auto-incrementing primary keys, so that the final pk values aren't known until flush, also while minimizing DB trips.
... .

Does this autopersistence algorythm know about concurently executed transactions ?
It sounds like looking for a problem ( dealock ).

  Message #121259 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Erik Bengtson on May 09, 2004 in response to Message #121256
JDO speeds up your development process and provides good performance for most of your scenarios. JDO can easily run stored procedures where you need. If it's a not religion, you can balance the facilities of JDO together with the performance in stored procedures.

  Message #121261 Post reply Post reply Post reply Go to top Go to top Go to top

OO vs. RestOfTheWorld debate

Posted by: christophe hartwig on May 09, 2004 in response to Message #121252
Hi all !
This discussion proved it for me, object model on top of relational model is useless. All JDO/EJB advokates say O/R is very good for objects and domain model, but nobody can explain why it I need this object model on top on relational model, I found nothing wrong in relational model, data structures and procedures aka DAO and DTO...
I guess it's the good old "OO vs. RestOfTheWorld debate"...
The same arguments against OO :
- lack of performance
- lack of productivity, lack of maturity
- why should I trust you ?
The same arguments towards OO :
- it's cleaner, more maintainble, it holds more semantic
- it will improve, it's the future
- try it

OORM just starts the debate over again. RTFM if you're looking for answers, give it a try, and join the league of happy OO developers... or not... it's up to you.
Sometimes I wonder if we can really convince people that OO thinking is better, since it's a paradigm shift. Anyway, I wonder why people choose Java if they don't intend to adopt object orientation... I really can't see a good reason.

My reasons for using OO: mental health and fun. Procedural languages and relational models drive me crazy: lack of clear semantics. Too much complexity to handle for me, I'm not that smart. I enjoy object-oriented thinking.

Chris

  Message #121263 Post reply Post reply Post reply Go to top Go to top Go to top

Where is advantage?

Posted by: Pavel Tavoda on May 09, 2004 in response to Message #121147
I don't see difference for programmer or for runtime between proposed query syntax and pure SQL. For me thigs like this make sense:
q.setResult (new DbFields[] {Cls1.FirstNameField, Cls1.SecondNameField});
q.setFilter(new AndCond[] {new GreatThan(Cls1.AgeField, 50), new Not(retired), new Equal(Cls1.DepartmentField.NameField, 'Marketing'), IsEmpty(Cls1.ProjectsField)});
q.setOrder(new Order[]{new AscOrder(Cls1.employeeIdField}));

We already have query handler which is translating this pure object queries to Database queries. For really complex queries (agregations with more than 10 relations) we have stored procedures for every database we support. We achieved high flexibility for all queries except really complex queries (which usually took only 10-15% of all application).
Advantages:
- Naming check at compile time - when we remove or rename field we will only compile don't retest everything because all those check are done at compile time)
- Data type check at compile time - when we do datatype change we again don't have to retest everything
- Open doors to areas like in-memory databases, OODBMS, future RDBMS with better object support

Why we aren't using full power of Java when we come to database?
Am I alone with this opinion?

  Message #121265 Post reply Post reply Post reply Go to top Go to top Go to top

OO vs. RestOfTheWorld debate

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121261
RTFM if you're looking for answers, give it a try, and join the league of happy OO developers... or not... it's up to you.Sometimes I wonder if we can really convince people that OO thinking is better, since it's a paradigm shift. Anyway, I wonder why people choose Java if they don't intend to adopt object orientation... I really can't see a good reason.My reasons for using OO: mental health and fun. Procedural languages and relational models drive me crazy: lack of clear semantics. Too much complexity to handle for me, I'm not that smart. I enjoy object-oriented thinking. Chris
Yes, OOP is very cool and I like it, but I do not know "happy OO developers", see hibernate forums, design patterns on this site. Looks like evrybody use old good
record type/struct aka "bean" and prcedure/function aka facade or DAO. Ant I see smart people using this "anti OOP", some people use it as workaruond for EJB performance, some use it without EJB, J2EE Blue Prints are about it too, see PetStore.
Can somebody explain the value of new JDO and future EJB without religions, buzzwords and dreams like OOP, Transparent Persistence, Independance and for "average JAVA deveper".
Are JDO and EJB are rigth tools retrieve "stuct" from DB ? I think they are not, there are better tools implemet procedures and to persist records without new QL.

  Message #121266 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: David Tinker on May 09, 2004 in response to Message #121167
Hi Kevin
there is quite a bit of difference between effective SQL in one database v. another, and it is very important that you use SQL that works best with your database
If you are using JDO then a lot of this responsibility is passed on to the implementation. Developers can concentrate implementing functionality. In a large application there will be some generated queries that need to be replaced with hand written SQL or a stored procedure. This work can be done by the best SQL people on the team. On the prior-to-JDO projects I have worked on the "SQL gurus" spent a lot of time fixing slow/broken queries written by the average developers.

My contention is that using JDO raises the overall quality of the SQL used by the application. The implementation will produce SQL that is at least as good as what the typical developer codes and is always correct (no missing join conditions etc). The SQL gurus can concentrate on making sure that the really important 5% of queries run as fast as possible.

Cheers
Davidplay with JDOQWL

  Message #121267 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121266
I am sure "average SQL developer" can not write better than average JAVA code too. EJB 1, EJB 2, JDO 1 have promissed it too, now it is absolete and "architects" going to help for "typical developer" with JDO 2 and EJB 3.
There is only way to write better than "average" code, lern to write it better.
Hi Kevin
there is quite a bit of difference between effective SQL in one database v. another, and it is very important that you use SQL that works best with your database
If you are using JDO then a lot of this responsibility is passed on to the implementation. Developers can concentrate implementing functionality. In a large application there will be some generated queries that need to be replaced with hand written SQL or a stored procedure. This work can be done by the best SQL people on the team. On the prior-to-JDO projects I have worked on the "SQL gurus" spent a lot of time fixing slow/broken queries written by the average developers.My contention is that using JDO raises the overall quality of the SQL used by the application. The implementation will produce SQL that is at least as good as what the typical developer codes and is always correct (no missing join conditions etc). The SQL gurus can concentrate on making sure that the really important 5% of queries run as fast as possible.CheersDavidplay with JDOQWL


  Message #121270 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: David Jordan on May 09, 2004 in response to Message #121267
People much more knowledgeable than myself on EJB have indicated that there were big changes required between EJB 1.0 and EJB 2.0, and there will be major differences between EJB 2.0 and EJB 3.0. So with each major release, there is a lot of work to do to migrate to the new release.

That is not going to be the case with the JDO 1.0 to JDO 2.0 migration. Your current code will not become obsolete. You will have 99% compatibility. JDO 2.0 is standardizing the OR mapping syntax, adding a huge number of extensions to the query language, and adding attach/detach functionality. It is my personal view that these new features of JDO 2.0 are the reason that the EJB community has sprung into action to try and directly compete with JDO, they see what is coming in JDO 2.0 and understand their current EJB model is doomed.

EJB 1.0 and EJB 2.0 may now become obsolete. But an investment in JDO will not become obsolete.

  Message #121271 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121270
EJB 1.0 and EJB 2.0 may now become obsolete. But an investment in JDO will not become obsolete.
This stuff is more populistic than pragmatic, I agrre, JDO probably did no damage,
but it will do damage too if "Big JAVA players" will promote it. Everything usefull developer needs is on inet for free, just take it and use it. SQL and RDBMS are standards in enterprise and I do not believe JDO or EJB can change it, but Hibernate is a better tool for "typical" or "complex" web applications (I know it from hibernate forum) and try to learn from it. I want, but I do not use Hibernate to implement my procedures and to persist my structs (I have reasons and I talked about it in this forum), Hibernate 3 is going to be more pragmatic and probably I will use it. I am sure JDO will be a usefull framework for me in the future too, but I think it will take a lot of time, I will wait for it, but I continue to code my procedures :)

  Message #121273 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Robin Roos on May 09, 2004 in response to Message #121267
Juozas

Why are you participating in this debate? You evidently have no faith in the concept of ORM persisting an Object to a Database. Yet this is the approach currently taken by JDO 1.0 and proposed for EJB 3.0.

This debate concerns those two technologies. You have no interest in either.

  Message #121275 Post reply Post reply Post reply Go to top Go to top Go to top

Both EJB3 and JDO2 Will Be Backwards Compatible

Posted by: Scott Crawford on May 09, 2004 in response to Message #121270
So with each major [EJB] release, there is a lot of work to do to migrate to the new release... That is not going to be the case with the JDO 1.0 to JDO 2.0 migration.
Sorry David, but this is just anti-EJB FUD. The EJB3 specification will preserve backwards compatibility for existing 1.x and 2.x users. It will be entirely up to users whether and when to start using the 3.0 API.

In other places in this discussion, JDO advocates have said that our insistence on backwards compatibility is some sort of anti-competitive plot. Here you try to say that we don't insist upon it and users will suffer. The JDO camp can't have it both ways: in fact we will provide compatibility precisely to avoid the scenario you describe.

Both EJB 3 and JDO 2 are doing the right thing in this regard. Both are making sure they look after existing users while adding new capability.

  Message #121276 Post reply Post reply Post reply Go to top Go to top Go to top

Status

Posted by: Robin Roos on May 09, 2004 in response to Message #121255
A few intrenched vendors have shunned JDO and are trying to spread FUD -- it gives JDO a great Underdog status.


Yes. I can see that this is going to be fun indeed!

  Message #121277 Post reply Post reply Post reply Go to top Go to top Go to top

in J2EE land, KISS is not allowed

Posted by: Rolf Tollerud on May 09, 2004 in response to Message #121243
Hi Vic,

How does it feel to be all alone and still be sure that you are right?
Nobody answered your post despite the fact that you are quite right.

A Kafkaean feeling is it not?

In the future academic institutions will publish work on "the public Opinion", case studies of popular opinions in The Server Side community 1999-2005.

I know that you are a project recovery doctor. Care to share with us how many customers you have saved from the sicknesses of the "EJB Craze" and "ORM Mania"?

Regards
Rolf Tollerud

  Message #121278 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Robin Roos on May 09, 2004 in response to Message #121275
Hi Scott

To take advantage of EJB 3.0's new persistence architecture a client will essentially have to rewrite their existing Entity Bean investments.

To build a J2EE-compliant implementation, new vendors will have to provide support for superseded persistence architectures.

These statements are clear and unambiguous. I suggest that you introduce the JSR-220 group to the concept of the "optional feature"; a well specified capability which guarantees portability amongst the subset of compliant implementations which choose to support that feature, but which not every vendor will necessarily choose to implement.

I'm glad you're following these discussions. By the way, does EJB 3.0 refer to its new persistence capability with the term "transparent persistence" or "POJO persistence"?

Kind regards, Robin.

  Message #121279 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121273
JuozasWhy are you participating in this debate? You evidently have no faith in the concept of ORM persisting an Object to a Database. Yet this is the approach currently taken by JDO 1.0 and proposed for EJB 3.0.This debate concerns those two technologies. You have no interest in either.
I like ORM, I just can not use it. I asked people to help me sell it for enterprise, but JDO advocates started to talk about average and typical JAVA developers with no SQL knowlege, Do you think somebody can let me to use my faworite innovation for the real projects ?

  Message #121280 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Scott Crawford on May 09, 2004 in response to Message #121278
Hi Robin,
To take advantage of EJB 3.0's new persistence architecture a client will essentially have to rewrite their existing Entity Bean investments.
Why? We aim to provide high interoperability between the 2.x and 3.0 APIs. There may end up being some devil in the detail but it's a goal. And in any case it likely that within the same company, some projects will use the 2.x API and others will use the 3.0 API.
...superseded persistence architectures...
Interesting choice of words. Note that "superceded" does not mean dropped or even deprecated. The 2.x API will continue to be supported and enhanced. With all the buzz about the new 3.0 API, many have missed that some new features will enhance the existing 2.x API *and* the new 3.0 API.
...concept of the optional feature...
A few have been mooted so far. We may end up having some, but they won't affect backwards compatibility.
Does EJB 3.0 refer to its new persistence capability with the term "transparent persistence" or "POJO persistence"
We tend to use the term POJO Entity Beans but not for any scientific reason. It was just that we started by looking at how to do a POJO-oriented session bean and then moved on to apply that approach to entities.

Best
Scott

  Message #121281 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Robin Roos on May 09, 2004 in response to Message #121279
Do you think somebody can let me to use my faworite innovation for the real projects?
Well, I'm maintaining a small list of features which I want to pursue for JDO 2.1. I hope to discuss these with the JDO 2.0 expert group members when we meet in Cannes this month to prepare the draft JDO 2.0 spec.

If you know of technical shortcomings in JDO which prevent you from using it in your organization then let me know so that I can either show you how they are addressed by JDO 2.0 or consider adding them to JDO 2.1.

Thanks, Robin.

  Message #121282 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Robin Roos on May 09, 2004 in response to Message #121280
Hi Scott

Indeed, Entity Beans 2.0/2.1 have not been dropped or deprecated. Instead they have been superceded (apologies for the spelling error!). They have been superceded because of endemic design problems which could not be worked around and which put the community base off their use to a large degree.

So why must a new entrant to your marketplace support and interoperate with them? Presumably a new entrant would be touting for new business with POJO-Entity Beans. I don't see how this would make things difficult for the users of Entity Beans 2.0/2.1? There would still be established vendors providing a migration path in order to preserve (or perhaps poach) customer relationships.

Thanks for the clarification of your terminology - let us know how it evolves.

Kind regards, Robin.

  Message #121283 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121279
BTW, enterprise is not "typical" it is "mission critical". How can I sell ORM for "mission critical" with obsolete versions and with future visions only ?

  Message #121284 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Robin Roos on May 09, 2004 in response to Message #121283
What is obsolete? JDO 1.0? Sorry - not the case. JDO 2.0 merely standardizes some already available features in terms of O/R mapping and Queries. I guess you could say Detachment is the "new" feature, but it's not exactly a fundamentally required concept, and it's already being trialled in production versions prior to standardization.

JDO 1.0 is far from obsolete, just don't use the makeTransient() method too much (it's been deprecated). Juozas, just what are you getting at?

  Message #121285 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Scott Crawford on May 09, 2004 in response to Message #121282
So why must a new entrant to your marketplace support and interoperate with [the EJB 2.x API]?
Various reasons, but the most important is this: the new simplified API will achieve its goals by staying simple. It is designed to make the most common cases really easy. But there are advanced EJB features which people find useful in more specialised situations. For these cases, the people can fall back on the existing 2.x API.

Best
Scott

ps Cannes? Boy, you JDO guys must be loaded. EJB is a no-frills group. ;-)

  Message #121286 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: John Harby on May 09, 2004 in response to Message #121280
To take advantage of EJB 3.0's new persistence architecture a client will essentially have to rewrite their existing Entity Bean investments.
I think clients using tools such as Weblogic workshop won't have to face
these issues as they will be abstracted by the tools.

  Message #121287 Post reply Post reply Post reply Go to top Go to top Go to top

Cannes JDO meeting

Posted by: David Jordan on May 09, 2004 in response to Message #121285
The Cannes meeting is to coincide with some conference taking place there. It turns out a few of the expert group members will be there, so they set up a JDO meeting. Most of those attending were going to the conference anyway, or were living near by. Trust me, many will not be there, including me...

  Message #121288 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Robin Roos on May 09, 2004 in response to Message #121285
Scott:
Cannes? Boy, you JDO guys must be loaded. EJB is a no-frills group. ;-)
David:
The Cannes meeting is to coincide with some conference taking place there
Yea, JAOO. I hope everyone else enjoys it. Personally I thought I might give it a skip and get some culture instead - Cannes Film Festival, Monaco Grand Prix, drop in on David (Coulthard), you know the scene.... ;-)

  Message #121289 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Robin Roos on May 09, 2004 in response to Message #121285
It is designed to make the most common cases really easy. But there are advanced EJB features which people find useful in more specialised situations. For these cases, the people can fall back on the existing 2.x API.
Interesting. I'll have to think about that for a while.

By the way, Scott, is anyone addressing JAOO in Cannes on EJB 3.0? If so I may have to ditch my pre-JDO social agenda and come along to the conference after all. Based in the UK I'm one of those who live close enough for Cannes to be little more than a day-trip and I wasn't planning to actually attend JAOO....

Kind regards, Robin.

  Message #121291 Post reply Post reply Post reply Go to top Go to top Go to top

EJB 3.0 should learn about Optional Features from JDO

Posted by: Scott Crawford on May 09, 2004 in response to Message #121289
By the way, Scott, is anyone addressing JAOO in Cannes on EJB 3.0?
Sorry, I dunno. But say hello to the film stars for me.

Scott

  Message #121292 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121284
Yes, JDO 1.0 is probably more unknown than obsolete in "mission critical" projects ( I am not sure about all, but this is true in my country ). I need O/R for smart people and for the real "persistent store". You sell JDO as some kind of dream for average developers, but I can not sell O/R this way.
What is obsolete? JDO 1.0? Sorry - not the case. JDO 2.0 merely standardizes some already available features in terms of O/R mapping and Queries. I guess you could say Detachment is the "new" feature, but it's not exactly a fundamentally required concept, and it's already being trialled in production versions prior to standardization.JDO 1.0 is far from obsolete, just don't use the makeTransient() method too much (it's been deprecated). Juozas, just what are you getting at?


  Message #121295 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: David Jordan on May 09, 2004 in response to Message #121292
I believe what I said was that the SQL generated by a JDO implementation is going to be better than what an average developer would handcraft. But I am not going to claim that it is impossible for some SQL experts to generate more efficient SQL than a JDO implementation. The point is that the JDO vendors have expertise in producing very efficient SQL code and this knowledge has been incorporated into the SQL they generate to support the access of your Java object models. Smart people out there ARE using JDO, even people that know how to generate SQL code. JDO lets you very quickly get an object model persisted in a database. Just try it out, it should not take more than an afternoon to make a few classes persistent and write some code that accesses them and does some navigation. In my presentations I give on JDO, and I am sure in presentations that Robin Roos gives, people that have been introduced to the technology for the first time and see the simplicity with which you can persist your object models and access your data, they come up to me after the presentation all excited and exclaim about how great JDO is and that they can't wait to use it. Try it out before trying to find excuses not to use it.

  Message #121297 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: Juozas Baliuka on May 09, 2004 in response to Message #121295
I have experimented with JDO, Hibernate, I have used OJB for "pilot" too, but it does not count, I do not care about PetStores, all tools are good to implement it (I think PHP is the best technology to implement PetStore).
 JDOQL is unreadable for me and I can not tune ( probably I am not so smart as I think )
I need support for update/delete queries and give me SQL please.
I will try it, how can I download JDO 2.0 specification and RI ?
BTW The last time I have tried to download RI, SUN said I am from a bad country, so I have tried closed source 1.0 implentations, binari RI was about flat files.

  Message #121298 Post reply Post reply Post reply Go to top Go to top Go to top

Query Language Tradeoffs?

Posted by: David Jordan on May 09, 2004 in response to Message #121297
You will get delete queries in JDOQL 2.0. Currently in JDOQL 2.0, updates are not supported, and I doubt they will. JDO 2.0 public draft spec hopefully should be released by JavaOne. You will see commercial implementations of it before Sun has the reference implementation completed, which will support relational databases. Oh, and by the way, if JDOQL and the Java navigational and update capabilities of JDO do not support your needs, JDO 2.0 provides a means for you to get a SQL connection. So you can use either SQL, JDOQL, or JDO navigational access.

  Message #121300 Post reply Post reply Post reply Go to top Go to top Go to top

Not true

Posted by: Giedrius Trumpickas on May 09, 2004 in response to Message #121292
Juozas It's not true that in Lithuania nobody i using OEM.
I know companies who used ORM or even OODBMS :) in 2000 (companies like NoMagic I worked for them). So stop that bulshit :).
Regarding OOD and "procedural" systems aproaches there is a use for both.
If you have complex business logic (insurance for example) to have rich domain makes sense (pricing - scary stuff) and then ORM makes sense to map that domain to the database. But if your system performs CRUD on data with no complicated business rules around it then of course rich domain model does not make any sense at all (80% of application in Lithuania). And then vanila SQL and SP is excellent candidate for implementation.

Even in rich domain model implementations some parts of domain may be "mapped" to RDBMS by using hand written SQL or SP and this mapping is hidden by using "Domain Object Mapper" abstraction.

Piece,

Giedrius

  Message #121301 Post reply Post reply Post reply Go to top Go to top Go to top

Simple Question

Posted by: