Re: [Hibernate] Be Amazed and Delighted by the Wondrous SpecialOneToOneType

2005-02-10 Thread Christian Bauer
On Feb 10, 2005, at 1:35 PM, Gavin King wrote:
Isn't that great, huh? See how flexible our product is! Who needs 
expert groups and specifications when you have us open source 
developers to design such intuitive syntax?
Ugh. I took me about 30 seconds to understand it, weird stuff. I'll 
file this as "faking polymorphism a little bit".

--
Christian Bauer
callto://christian-bauer
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


[Hibernate] Be Amazed and Delighted by the Wondrous SpecialOneToOneType

2005-02-10 Thread Gavin King
This is something I've wanted for months:
   
   
   
   name
   'HOME'
   
   
   name
   'MAILING'
   
   
  
   
   check="addressType in ('MAILING', 'HOME', 'BUSINESS')">
   
   
   column="personName"/>
   
   column="addressType"/>
   
   
   
   
   

All made possible by the aptly named SpecialOneToOneType.
But that's not all!
So, for a long time its been possible to map an association with one to 
one multiplicity using . Well, for the sake of symmetry, it 
is now possible to use  to map an association with many to 
one multiplicity. Isn't that great, huh? See how flexible our product 
is! Who needs expert groups and specifications when you have us open 
source developers to design such intuitive syntax?

hmmm
--
Gavin King
+61 410 534 454
+1 404 822 8349
callto://gavinking
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] Is it worth contributing this code or posting it somewhere?

2005-02-10 Thread Christian Bauer
On Feb 10, 2005, at 9:05 AM, Gavin King wrote:
There is a difference between multiple collection roles that are
"parallel" to each other, and when they are in "series".
Series Good. Parallel Bad.
OK, got it now :)
--
Christian Bauer
callto://christian-bauer
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


RE: [Hibernate] Is it worth contributing this code or posting it somewhere?

2005-02-10 Thread Gavin King
Correct. This is a current limitation that will be solved “soon”. 
Meaning right after 3.0 final release. Its fairly straightforward.


*From:* [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] *On Behalf Of 
*Jordan Laughlin
*Sent:* Thursday, 10 February 2005 6:46 PM
*To:* hibernate-devel@lists.sourceforge.net
*Subject:* RE: [Hibernate] Is it worth contributing this code or posting 
it somewhere?

Hello, I just wanted to jump in because I'm really not clear on how the 
queries produced could result in a cartesian product. Since every level 
of the graph contains an on clause that references the table before it, 
each level of the tree is limited (by its particular join type) and the 
amount of results returned at each level will be the amount of rows in 
the largest subset that meets its join condition.

For instance,
[SQL QUERY]
Select * from A join B on A.id = B.id join C on C.id = B.id join D on 
D.id = C.id left join E on E.id = D.id

This is exactly what our queries do: this does not result in a cartesian 
product, it returns at a maximum the number of rows in the largest table 
that meets a join condition. Now in each of our queries we may join any 
number of properties by left join since we know each join will return 
only one row (criteria does this as well). The cartesian product would 
show its ugly head if we instead attempted to load multiple collections 
per query,* **which is not what we are doing*: instead we are doing one 
query per collection.

For instance, if we wish to load A, its B* **property*, and the 
collections C and D of property B, we would issue two different queries:

[HIBERNATE QUERIES]
Select A from A left join fetch B on A.id = B.id left join fetch C on 
C.id = B.id;

And
Select B from A left join fetch B on A.id = B.id left join fetch D on 
D.id = B.id;

Since B is a property, it's left join returns only one row. By issuing 
the above queries in order in the same session, we get A, it's B 
property loaded, and the collections C and D for the B in A fully loaded.

As far as we know Hibernate currently does not allow for object graph 
loading (loading a collection of a collection, etc.). The purpose of our 
code was to do that: if you can suggest a better way of doing this, or a 
way to split up the above queries when loading the graph, which avoids 
n+1 selects, please point us to the documentation.

Thanks,
Jordan
-Original Message-
From: Adrian Ridner [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 09, 2005 8:16 PM
To: 'hibernate-devel@lists.sourceforge.net'
Cc: [EMAIL PROTECTED]
Subject: Re: [Hibernate] Is it worth contributing this code or posting 
it somewhere?

On Feb 7, 2005, at 9:17 PM, Christian Bauer wrote:


 On Feb 7, 2005, at 11:08 PM, Adrian Ridner wrote:



> Did we miss something? I'll be optimistic and hope we didn't reinvent

> the wheel, but if we did, it was a fun exercise :)



 Read up on the docs some more. What you try to do would create a

 Cartesian product and be slower than two queries (which is what you

 discovered will happen). This is documented in every other place and a

 sensible limitation. You can write a custom SQL query in very special

 cases, if you are sure the product is faster than two queries.


Thanks for the reply. Sorry I didn't see it before, it got lost in my
mailbox. I appreciate your feedback. I guess that answers my original
question. We'll read up the docs more to see if we find anything. I am
wondering if I didn't communicate what we are doing correctly though,
because we are running this on tables with 5,000,000 rows each, and it
is faster than anything else we tried.
In any case, thank you for a great product!
Adrian
--
Gavin King
+61 410 534 454
+1 404 822 8349
callto://gavinking
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


RE: [Hibernate] Is it worth contributing this code or posting it somewhere?

2005-02-10 Thread Gavin King
There is a difference between multiple collection roles that are 
"parallel" to each other, and when they are in "series".

Series Good. Parallel Bad.
-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of 
Christian Bauer
Sent: Thursday, 10 February 2005 7:03 PM
To:  

Subject: Re: [Hibernate] Is it worth contributing this code or posting 
it somewhere?

On Feb 10, 2005, at 8:45 AM, Jordan Laughlin wrote:
> return only one row (criteria does this as well). The cartesian
> product would show its ugly head if we instead attempted to load
> multiple collections per query, which is not what we are doing:
> instead we are doing one query per collection.
> As far as we know Hibernate currently does not allow for object graph
> loading (loading a collection of a collection, etc.). The purpose of
> our code was to do that: if you can suggest a
Aren't those two statements contradictory? First you say: We do it like 
Hibernate, one collection per query in an OUTER JOIN, no product.

Then you say "Hibernate doesn't allow several collections in a query, 
thats what we are adding".

I still don't understand what you are trying to achive.
--
Christian Bauer
callto://christian-bauer
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide Read honest & candid 
reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

--
Gavin King
+61 410 534 454
+1 404 822 8349
callto://gavinking
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] Is it worth contributing this code or posting it somewhere?

2005-02-10 Thread Christian Bauer
On Feb 10, 2005, at 8:45 AM, Jordan Laughlin wrote:
return only one row (criteria does this as well). The cartesian 
product would show its ugly head if we instead attempted to load 
multiple collections per query, which is not what we are doing: 
instead we are doing one query per collection.

As far as we know Hibernate currently does not allow for object graph 
loading (loading a collection of a collection, etc.). The purpose of 
our code was to do that: if you can suggest a
Aren't those two statements contradictory? First you say: We do it like 
Hibernate, one collection per query in an OUTER JOIN, no product.

Then you say "Hibernate doesn't allow several collections in a query, 
thats what we are adding".

I still don't understand what you are trying to achive.
--
Christian Bauer
callto://christian-bauer
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel