RE: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread March, Andres
Well, couldn't it be reclassified as a bug fix?  Not being able to navigate 
associations because of a hard coded "this" in the construction of the order by seems 
like something many people would face.  I could be wrong.

Anyway this patch has been around a long time and as far as I can tell was submitted 
properly.  More importantly H3 is not even released and support for it in Spring is 
even farther off.

Any reason 2.1 is being abandoned so soon?  I'm not asking for another 2.1 release.  I 
don't see the harm in applying it to 2.1 CVS head but maybe I'm short-sighted.

> -Original Message-
> From: Emmanuel Bernard [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 29, 2004 12:59 PM
> To: March, Andres
> Cc: William Draï; Emmanuel Bernard; [EMAIL PROTECTED]
> Subject: Re: [Hibernate] Polymorphic queries, where and order by
> 
> Sorry, no new feature will be added to the 2.1 branch.
> 
> March, Andres wrote:
> 
> > We can't use H3 unfortunately because we do not have enough time to
> > add H3 support to Spring. Is there any way this patch can be applied
> > to H2?
> >
> > 
> >
> > *From:* William Draï [mailto:[EMAIL PROTECTED]
> > *Sent:* Wednesday, September 29, 2004 11:22 AM
> > *To:* Emmanuel Bernard
> > *Cc:* March, Andres; [EMAIL PROTECTED]
> > *Subject:* Re: [Hibernate] Polymorphic queries, where and order by
> >
> > I haven't yet tested with H3. I think there were no change logs
> > related to this.
> > I will try as soon as I have enough time.
> >
> > We can live without this "feature" for a few more weeks.
> >
> > Thank you for your anwser.
> >
> >
> > Speaking from memory,
> > Gavin did implement something on the (now dead 2.2 branch). It now has
> > been reporded on H3. Did you test it?
> > I can remembe, he'd implemented the transparent subclassing (no
> > special keyword).
> >
> > March, Andres wrote:
> >
> >I'm sorry if I expand the subject a little.  We pulled a patch off the
> forums some where that allows us to order by any association.  I was
> wondering why this patch never got applied.  It seems it would be useful
> in this situation as well.  I am really uncomfortable using a patched
> hibernate because there are less eyes on it and it makes upgrading harder.
> I can submit the patch as we've applied it if you like.  But also let me
> know if there is any reason for not allowing this type of functionality.
> It has been extremely useful to us in our searches as I think it would be
> to others.
> >
> >
> >
> >
> >
> >>-Original Message-
> >>
> >>From: [EMAIL PROTECTED] <mailto:hibernate-
> [EMAIL PROTECTED]> [mailto:hibernate-devel-
> >>
> >>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>] On
> Behalf Of William Draï
> >>
> >>Sent: Tuesday, September 28, 2004 1:31 AM
> >>
> >>To: [EMAIL PROTECTED] <mailto:hibernate-
> [EMAIL PROTECTED]>
> >>
> >>Subject: [Hibernate] Polymorphic queries, where and order by
> >>
> >>
> >>
> >>Let's say we have the following (simplified) mapping :
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>   
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>Now we can execute any HQL query on the class A using the field1, for
> >>
> >>example
> >>
> >>"from A a where a.field1 like 'anything%'" or "from A a order by
> a.field1"
> >>
> >>
> >>
> >>The problems come when we want to use the field2 with the same queries.
> >>
> >>Of couse in simple SQL it is possible to do
> >>
> >>select * from T order by field2
> >>
> >>
> >>
> >>But in HQL, "from A a order by a.field2" rightly fails because field2 is
> >>
> >>not defined
> >>
> >>for class A.
> >>
> >>
> >>
> >>This causes problems in sortable or filtered data tables where the user
> >>
> >>can sort or filter
> >>
> >>by any column he wants.
> >>
> >>There is currently only two options :
> >>
> >>- allowing to sort only on columns of class A : possible but my users
> >>
> >>won't be really happy
&

Re: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread Emmanuel Bernard




This is not a bug. HQL is an OO query language. You've queried the
superclass, not the subclass. It seems pretty natural to me that you
can't order by a subclass attribute.
What you want and the patch provided does work only in particular cases.
"from java.lang.Object o order by o.publicPrice" cannot be done in SQL
since java.lang.Object has to be queried in several SQL SELECTs
I recommend you order at the Java level

2.1 is *not* abandonned. We are actively providing bug fixes and
support of the 2.1 family.
We are working very hard on H3 to provide tons of new features, you can
understand we cannot backport and keep several branch of code in a
feature working process.

Spring integration of H3 should be pretty straightforward (import
update net.sf.hibernate -> org.hibernate) That's basically all you
need (maybe check for HibernateException since it moved to the
RuntimeException hierarchy).

March, Andres wrote:

  Well, couldn't it be reclassified as a bug fix?  Not being able to navigate associations because of a hard coded "this" in the construction of the order by seems like something many people would face.  I could be wrong.

Anyway this patch has been around a long time and as far as I can tell was submitted properly.  More importantly H3 is not even released and support for it in Spring is even farther off.

Any reason 2.1 is being abandoned so soon?  I'm not asking for another 2.1 release.  I don't see the harm in applying it to 2.1 CVS head but maybe I'm short-sighted.

  
  
-Original Message-
From: Emmanuel Bernard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 29, 2004 12:59 PM
To: March, Andres
Cc: William Draï; Emmanuel Bernard; [EMAIL PROTECTED]
Subject: Re: [Hibernate] Polymorphic queries, where and order by

Sorry, no new feature will be added to the 2.1 branch.

March, Andres wrote:



  We can't use H3 unfortunately because we do not have enough time to
add H3 support to Spring. Is there any way this patch can be applied
to H2?



*From:* William Draï [mailto:[EMAIL PROTECTED]]
*Sent:* Wednesday, September 29, 2004 11:22 AM
*To:* Emmanuel Bernard
*Cc:* March, Andres; [EMAIL PROTECTED]
*Subject:* Re: [Hibernate] Polymorphic queries, where and order by

I haven't yet tested with H3. I think there were no change logs
related to this.
I will try as soon as I have enough time.

We can live without this "feature" for a few more weeks.

Thank you for your anwser.


Speaking from memory,
Gavin did implement something on the (now dead 2.2 branch). It now has
been reporded on H3. Did you test it?
I can remembe, he'd implemented the transparent subclassing (no
special keyword).

March, Andres wrote:

I'm sorry if I expand the subject a little.  We pulled a patch off the
  

forums some where that allows us to order by any association.  I was
wondering why this patch never got applied.  It seems it would be useful
in this situation as well.  I am really uncomfortable using a patched
hibernate because there are less eyes on it and it makes upgrading harder.
I can submit the patch as we've applied it if you like.  But also let me
know if there is any reason for not allowing this type of functionality.
It has been extremely useful to us in our searches as I think it would be
to others.


  



  
  
-Original Message-

From: [EMAIL PROTECTED] <mailto:hibernate-

  

[EMAIL PROTECTED]> [mailto:hibernate-devel-


  
[EMAIL PROTECTED] ] On

  

Behalf Of William Draï


  
Sent: Tuesday, September 28, 2004 1:31 AM

To: [EMAIL PROTECTED] <mailto:hibernate-

  

[EMAIL PROTECTED]>


  
Subject: [Hibernate] Polymorphic queries, where and order by



Let's say we have the following (simplified) mapping :





   



   

  

   





Now we can execute any HQL query on the class A using the field1, for

example

"from A a where a.field1 like 'anything%'" or "from A a order by

  

a.field1"


  


The problems come when we want to use the field2 with the same queries.

Of couse in simple SQL it is possible to do

select * from T order by field2



But in HQL, "from A a order by a.field2" rightly fails because field2 is

not defined

for class A.



This causes problems in sortable or filtered data tables where the user

can sort or filter

by any column he wants.

There is currently only two options :

- allowing to sort only on columns of class A : possible but my users

won't be really happy

- "casting" the query to class B when the user sorts on a column of

class B : that means that the results

   count of the query is not th

Re: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread Emmanuel Bernard
Sorry, no new feature will be added to the 2.1 branch.
March, Andres wrote:
We can’t use H3 unfortunately because we do not have enough time to 
add H3 support to Spring. Is there any way this patch can be applied 
to H2?


*From:* William Draï [mailto:[EMAIL PROTECTED]
*Sent:* Wednesday, September 29, 2004 11:22 AM
*To:* Emmanuel Bernard
*Cc:* March, Andres; [EMAIL PROTECTED]
*Subject:* Re: [Hibernate] Polymorphic queries, where and order by
I haven't yet tested with H3. I think there were no change logs 
related to this.
I will try as soon as I have enough time.

We can live without this "feature" for a few more weeks.
Thank you for your anwser.
Speaking from memory,
Gavin did implement something on the (now dead 2.2 branch). It now has 
been reporded on H3. Did you test it?
I can remembe, he'd implemented the transparent subclassing (no 
special keyword).

March, Andres wrote:
I'm sorry if I expand the subject a little.  We pulled a patch off the forums some 
where that allows us to order by any association.  I was wondering why this patch 
never got applied.  It seems it would be useful in this situation as well.  I am 
really uncomfortable using a patched hibernate because there are less eyes on it and 
it makes upgrading harder.  I can submit the patch as we've applied it if you like.  
But also let me know if there is any reason for not allowing this type of 
functionality.  It has been extremely useful to us in our searches as I think it would 
be to others.

 

-Original Message-
From: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> [mailto:hibernate-devel-
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>] On Behalf Of William Draï
Sent: Tuesday, September 28, 2004 1:31 AM
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Subject: [Hibernate] Polymorphic queries, where and order by

Let's say we have the following (simplified) mapping :


   

   
  
   


Now we can execute any HQL query on the class A using the field1, for
example
"from A a where a.field1 like 'anything%'" or "from A a order by a.field1"

The problems come when we want to use the field2 with the same queries.
Of couse in simple SQL it is possible to do
select * from T order by field2

But in HQL, "from A a order by a.field2" rightly fails because field2 is
not defined
for class A.

This causes problems in sortable or filtered data tables where the user
can sort or filter
by any column he wants.
There is currently only two options :
- allowing to sort only on columns of class A : possible but my users
won't be really happy
- "casting" the query to class B when the user sorts on a column of
class B : that means that the results
   count of the query is not the same when it is sorted than when it is
not ; it completely breaks the
   semantics of sorting/filtering

I understand it does not follow the OO approach of HQL but it would be
really useful to have an additional
syntax to allow using fields of the subclass in HQL queries, something
like "select a from A+ a order by a.field2",
or maybe an option in the Query interface like
query.setUseInheritedProperties(true).

What do you think of this ?

Note : this is an extension of the JIRA HB-792 and could allow to
resolve this case in a better way


William



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
https://lists.sourceforge.net/lists/listinfo/hibernate-devel
   



---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
hibernate-devel mailing list
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

 


--
Emmanuel Bernard
01.55.21.52.14
Fnac - DSI
Direction France - Nouvelles technologies
67, boulevard du Gal Leclerc
92612 Clichy Cedex
--
Emmanuel Bernard
[EMAIL PROTECTED]
http://www.hibernate.org

---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanage

RE: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread March, Andres








We can’t use H3 unfortunately
because we do not have enough time to add H3 support to Spring.  Is there any
way this patch can be applied to H2?

 











From: William Draï [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 29,
2004 11:22 AM
To: Emmanuel Bernard
Cc: March, Andres;
[EMAIL PROTECTED]
Subject: Re: [Hibernate] Polymorphic
queries, where and order by



 

I haven't yet tested with H3. I think there were no
change logs related to this.
I will try as soon as I have enough time.

We can live without this "feature" for a few more weeks.

Thank you for your anwser.




Speaking from memory,
Gavin did implement something on the (now dead 2.2 branch). It now has been
reporded on H3. Did you test it?
I can remembe, he'd implemented the transparent subclassing (no special
keyword).

March, Andres wrote:



I'm sorry if I expand the subject a little.  We pulled a patch off the forums some where that allows us to order by any association.  I was wondering why this patch never got applied.  It seems it would be useful in this situation as well.  I am really uncomfortable using a patched hibernate because there are less eyes on it and it makes upgrading harder.  I can submit the patch as we've applied it if you like.  But also let me know if there is any reason for not allowing this type of functionality.  It has been extremely useful to us in our searches as I think it would be to others.   

-Original Message-From: [EMAIL PROTECTED] [mailto:hibernate-devel-[EMAIL PROTECTED]] On Behalf Of William DraïSent: Tuesday, September 28, 2004 1:31 AMTo: [EMAIL PROTECTED]Subject: [Hibernate] Polymorphic queries, where and order by Let's say we have the following (simplified) mapping :          Now we can execute any HQL query on the class A using the field1, forexample"from A a where a.field1 like 'anything%'" or "from A a order by a.field1" The problems come when we want to use the field2 with the same queries.Of couse in simple SQL it is possible to doselect * from T order by field2 But in HQL, "from A a order by a.field2" rightly fails because field2 isnot definedfor class A. This causes problems in sortable or filtered data tables where the usercan sort or filterby any column he wants.There is currently only two options :- allowing to sort only on columns of class A : possible but my userswon't be really happy- "casting" the query to class B when the user sorts on a column ofclass B : that means that the results    count of the query is not the same when it is sorted than when it isnot ; it completely breaks the    semantics of sorting/filtering I understand it does not follow the OO approach of HQL but it would bereally useful to have an additionalsyntax to allow using fields of the subclass in HQL queries, somethinglike "select a from A+ a order by a.field2",or maybe an option in the Query interface likequery.setUseInheritedProperties(true). What do you think of this ? Note : this is an extension of the JIRA HB-792 and could allow toresolve this case in a better way  William   ---This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170Project Admins to receive an Apple iPod Mini FREE for your judgement onwho ports your project to Linux PPC the best. Sponsored by IBM.Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php___hibernate-devel mailing list[EMAIL PROTECTED]https://lists.sourceforge.net/lists/listinfo/hibernate-devel    

  ---This SF.net email is sponsored by: IT Product Guide on ITManagersJournalUse IT products in your business? Tell us what you think of them. Give usYour Opinions, Get Free ThinkGeek Gift Certificates! Click to find out morehttp://productguide.itmanagersjournal.com/guidepromo.tmpl___hibernate-devel mailing list[EMAIL PROTECTED]https://lists.sourceforge.net/lists/listinfo/hibernate-devel   





-- Emmanuel Bernard01.55.21.52.14Fnac - DSIDirection France - Nouvelles technologies67, boulevard du Gal Leclerc92612 Clichy Cedex

 










Re: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread William Draï




I haven't yet tested with H3. I think there were no change logs related
to this.
I will try as soon as I have enough time.

We can live without this "feature" for a few more weeks.

Thank you for your anwser.


  
  
Speaking from memory,
Gavin did implement something on the (now dead 2.2 branch). It now has
been reporded on H3. Did you test it?
I can remembe, he'd implemented the transparent subclassing (no special
keyword).
  
March, Andres wrote:
  
I'm sorry if I expand the subject a little.  We pulled a patch off the forums some where that allows us to order by any association.  I was wondering why this patch never got applied.  It seems it would be useful in this situation as well.  I am really uncomfortable using a patched hibernate because there are less eyes on it and it makes upgrading harder.  I can submit the patch as we've applied it if you like.  But also let me know if there is any reason for not allowing this type of functionality.  It has been extremely useful to us in our searches as I think it would be to others.

  

  -Original Message-
From: [EMAIL PROTECTED] [mailto:hibernate-devel-
[EMAIL PROTECTED]] On Behalf Of William Draï
Sent: Tuesday, September 28, 2004 1:31 AM
To: [EMAIL PROTECTED]
Subject: [Hibernate] Polymorphic queries, where and order by

Let's say we have the following (simplified) mapping :





   



Now we can execute any HQL query on the class A using the field1, for
example
"from A a where a.field1 like 'anything%'" or "from A a order by a.field1"

The problems come when we want to use the field2 with the same queries.
Of couse in simple SQL it is possible to do
select * from T order by field2

But in HQL, "from A a order by a.field2" rightly fails because field2 is
not defined
for class A.

This causes problems in sortable or filtered data tables where the user
can sort or filter
by any column he wants.
There is currently only two options :
- allowing to sort only on columns of class A : possible but my users
won't be really happy
- "casting" the query to class B when the user sorts on a column of
class B : that means that the results
count of the query is not the same when it is sorted than when it is
not ; it completely breaks the
semantics of sorting/filtering

I understand it does not follow the OO approach of HQL but it would be
really useful to have an additional
syntax to allow using fields of the subclass in HQL queries, something
like "select a from A+ a order by a.field2",
or maybe an option in the Query interface like
query.setUseInheritedProperties(true).

What do you think of this ?

Note : this is an extension of the JIRA HB-792 and could allow to
resolve this case in a better way


William



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel




---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

  
  
  
  -- 
Emmanuel Bernard
01.55.21.52.14
Fnac - DSI
Direction France - Nouvelles technologies
67, boulevard du Gal Leclerc
92612 Clichy Cedex






RE: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread March, Andres
Let me know if these are enough to get you going (see: 
http://opensource.atlassian.com/projects/hibernate/browse/HB-132 and 
http://opensource.atlassian.com/projects/hibernate/browse/HB-822 ).  I am working on 
creating a more recent unified patch file.  It would help to know if this will be 
well-received by the hibernate team.

> -Original Message-
> From: Raphael Jean [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 29, 2004 10:25 AM
> To: March, Andres
> Subject: RE: [Hibernate] Polymorphic queries, where and order by
> 
> Hello,
> 
> Would you be kind enough to either send me the patch you mention below, or
> let me know where I can find it? I have a similar problem in my
> application
> that this patch may solve. I haven't been able to find any information in
> the forum.
> 
> Thanks in advance,
> Raphael Jean
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of March,
> Andres
> Sent: mercredi 29 septembre 2004 17:59
> To: [EMAIL PROTECTED]
> Subject: RE: [Hibernate] Polymorphic queries, where and order by
> 
> 
> I'm sorry if I expand the subject a little.  We pulled a patch off the
> forums some where that allows us to order by any association.  I was
> wondering why this patch never got applied.  It seems it would be useful
> in
> this situation as well.  I am really uncomfortable using a patched
> hibernate
> because there are less eyes on it and it makes upgrading harder.  I can
> submit the patch as we've applied it if you like.  But also let me know if
> there is any reason for not allowing this type of functionality.  It has
> been extremely useful to us in our searches as I think it would be to
> others.
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:hibernate-
> devel-
> > [EMAIL PROTECTED] On Behalf Of William Draï
> > Sent: Tuesday, September 28, 2004 1:31 AM
> > To: [EMAIL PROTECTED]
> > Subject: [Hibernate] Polymorphic queries, where and order by
> >
> > Let's say we have the following (simplified) mapping :
> >
> > 
> > 
> >
> > 
> >
> > 
> > 
> >
> > Now we can execute any HQL query on the class A using the field1, for
> > example
> > "from A a where a.field1 like 'anything%'" or "from A a order by
> a.field1"
> >
> > The problems come when we want to use the field2 with the same queries.
> > Of couse in simple SQL it is possible to do
> > select * from T order by field2
> >
> > But in HQL, "from A a order by a.field2" rightly fails because field2 is
> > not defined
> > for class A.
> >
> > This causes problems in sortable or filtered data tables where the user
> > can sort or filter
> > by any column he wants.
> > There is currently only two options :
> > - allowing to sort only on columns of class A : possible but my users
> > won't be really happy
> > - "casting" the query to class B when the user sorts on a column of
> > class B : that means that the results
> > count of the query is not the same when it is sorted than when it is
> > not ; it completely breaks the
> > semantics of sorting/filtering
> >
> > I understand it does not follow the OO approach of HQL but it would be
> > really useful to have an additional
> > syntax to allow using fields of the subclass in HQL queries, something
> > like "select a from A+ a order by a.field2",
> > or maybe an option in the Query interface like
> > query.setUseInheritedProperties(true).
> >
> > What do you think of this ?
> >
> > Note : this is an extension of the JIRA HB-792 and could allow to
> > resolve this case in a better way
> >
> >
> > William
> >
> >
> >
> > ---
> > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> > Project Admins to receive an Apple iPod Mini FREE for your judgement on
> > who ports your project to Linux PPC the best. Sponsored by IBM.
> > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> > ___
> > hibernate-devel mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/hibernate-devel
> 
> 
> ---
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, G

RE: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread March, Andres








Found the JIRA issues where we got the
patch (see: http://opensource.atlassian.com/projects/hibernate/browse/HB-132
and http://opensource.atlassian.com/projects/hibernate/browse/HB-822). 
We have been testing and using this patch for about a month.  We will be going
live with this if we cannot get it integrated into CVS.  Obviously we prefer it
get applied to CVS.  Is there any reason something like this would be stalled. 
It seems like a minor patch for decent improvement in functionality.  Anything
I can do to get this in?

 











From: Emmanuel Bernard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 29,
2004 9:30 AM
To: March, Andres
Cc:
[EMAIL PROTECTED]
Subject: Re: [Hibernate]
Polymorphic queries, where and order by



 

Speaking from memory,
Gavin did implement something on the (now dead 2.2 branch). It now has been
reporded on H3. Did you test it?
I can remembe, he'd implemented the transparent subclassing (no special
keyword).

March, Andres wrote:



I'm sorry if I expand the subject a little.  We pulled a patch off the forums some where that allows us to order by any association.  I was wondering why this patch never got applied.  It seems it would be useful in this situation as well.  I am really uncomfortable using a patched hibernate because there are less eyes on it and it makes upgrading harder.  I can submit the patch as we've applied it if you like.  But also let me know if there is any reason for not allowing this type of functionality.  It has been extremely useful to us in our searches as I think it would be to others.   

-Original Message-From: [EMAIL PROTECTED] [mailto:hibernate-devel-[EMAIL PROTECTED]] On Behalf Of William DraïSent: Tuesday, September 28, 2004 1:31 AMTo: [EMAIL PROTECTED]Subject: [Hibernate] Polymorphic queries, where and order by Let's say we have the following (simplified) mapping :          Now we can execute any HQL query on the class A using the field1, forexample"from A a where a.field1 like 'anything%'" or "from A a order by a.field1" The problems come when we want to use the field2 with the same queries.Of couse in simple SQL it is possible to doselect * from T order by field2 But in HQL, "from A a order by a.field2" rightly fails because field2 isnot definedfor class A. This causes problems in sortable or filtered data tables where the usercan sort or filterby any column he wants.There is currently only two options :- allowing to sort only on columns of class A : possible but my userswon't be really happy- "casting" the query to class B when the user sorts on a column ofclass B : that means that the results    count of the query is not the same when it is sorted than when it isnot ; it completely breaks the    semantics of sorting/filtering I understand it does not follow the OO approach of HQL but it would bereally useful to have an additionalsyntax to allow using fields of the subclass in HQL queries, somethinglike "select a from A+ a order by a.field2",or maybe an option in the Query interface likequery.setUseInheritedProperties(true). What do you think of this ? Note : this is an extension of the JIRA HB-792 and could allow toresolve this case in a better way  William   ---This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170Project Admins to receive an Apple iPod Mini FREE for your judgement onwho ports your project to Linux PPC the best. Sponsored by IBM.Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php___hibernate-devel mailing list[EMAIL PROTECTED]https://lists.sourceforge.net/lists/listinfo/hibernate-devel    

  ---This SF.net email is sponsored by: IT Product Guide on ITManagersJournalUse IT products in your business? Tell us what you think of them. Give usYour Opinions, Get Free ThinkGeek Gift Certificates! Click to find out morehttp://productguide.itmanagersjournal.com/guidepromo.tmpl___hibernate-devel mailing list[EMAIL PROTECTED]https://lists.sourceforge.net/lists/listinfo/hibernate-devel   





-- Emmanuel Bernard01.55.21.52.14Fnac - DSIDirection France - Nouvelles technologies67, boulevard du Gal Leclerc92612 Clichy Cedex








Re: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread Emmanuel Bernard




Speaking from memory,
Gavin did implement something on the (now dead 2.2 branch). It now has
been reporded on H3. Did you test it?
I can remembe, he'd implemented the transparent subclassing (no special
keyword).

March, Andres wrote:

  I'm sorry if I expand the subject a little.  We pulled a patch off the forums some where that allows us to order by any association.  I was wondering why this patch never got applied.  It seems it would be useful in this situation as well.  I am really uncomfortable using a patched hibernate because there are less eyes on it and it makes upgrading harder.  I can submit the patch as we've applied it if you like.  But also let me know if there is any reason for not allowing this type of functionality.  It has been extremely useful to us in our searches as I think it would be to others.

  
  
-Original Message-
From: [EMAIL PROTECTED] [mailto:hibernate-devel-
[EMAIL PROTECTED]] On Behalf Of William Draï
Sent: Tuesday, September 28, 2004 1:31 AM
To: [EMAIL PROTECTED]
Subject: [Hibernate] Polymorphic queries, where and order by

Let's say we have the following (simplified) mapping :





   



Now we can execute any HQL query on the class A using the field1, for
example
"from A a where a.field1 like 'anything%'" or "from A a order by a.field1"

The problems come when we want to use the field2 with the same queries.
Of couse in simple SQL it is possible to do
select * from T order by field2

But in HQL, "from A a order by a.field2" rightly fails because field2 is
not defined
for class A.

This causes problems in sortable or filtered data tables where the user
can sort or filter
by any column he wants.
There is currently only two options :
- allowing to sort only on columns of class A : possible but my users
won't be really happy
- "casting" the query to class B when the user sorts on a column of
class B : that means that the results
count of the query is not the same when it is sorted than when it is
not ; it completely breaks the
semantics of sorting/filtering

I understand it does not follow the OO approach of HQL but it would be
really useful to have an additional
syntax to allow using fields of the subclass in HQL queries, something
like "select a from A+ a order by a.field2",
or maybe an option in the Query interface like
query.setUseInheritedProperties(true).

What do you think of this ?

Note : this is an extension of the JIRA HB-792 and could allow to
resolve this case in a better way


William



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

  
  

---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

  


-- 
Emmanuel Bernard
01.55.21.52.14
Fnac - DSI
Direction France - Nouvelles technologies
67, boulevard du Gal Leclerc
92612 Clichy Cedex




RE: [Hibernate] Polymorphic queries, where and order by

2004-09-29 Thread March, Andres

I'm sorry if I expand the subject a little.  We pulled a patch off the forums some 
where that allows us to order by any association.  I was wondering why this patch 
never got applied.  It seems it would be useful in this situation as well.  I am 
really uncomfortable using a patched hibernate because there are less eyes on it and 
it makes upgrading harder.  I can submit the patch as we've applied it if you like.  
But also let me know if there is any reason for not allowing this type of 
functionality.  It has been extremely useful to us in our searches as I think it would 
be to others.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:hibernate-devel-
> [EMAIL PROTECTED] On Behalf Of William Draï
> Sent: Tuesday, September 28, 2004 1:31 AM
> To: [EMAIL PROTECTED]
> Subject: [Hibernate] Polymorphic queries, where and order by
> 
> Let's say we have the following (simplified) mapping :
> 
> 
> 
> 
> 
>
> 
> 
> 
> Now we can execute any HQL query on the class A using the field1, for
> example
> "from A a where a.field1 like 'anything%'" or "from A a order by a.field1"
> 
> The problems come when we want to use the field2 with the same queries.
> Of couse in simple SQL it is possible to do
> select * from T order by field2
> 
> But in HQL, "from A a order by a.field2" rightly fails because field2 is
> not defined
> for class A.
> 
> This causes problems in sortable or filtered data tables where the user
> can sort or filter
> by any column he wants.
> There is currently only two options :
> - allowing to sort only on columns of class A : possible but my users
> won't be really happy
> - "casting" the query to class B when the user sorts on a column of
> class B : that means that the results
> count of the query is not the same when it is sorted than when it is
> not ; it completely breaks the
> semantics of sorting/filtering
> 
> I understand it does not follow the OO approach of HQL but it would be
> really useful to have an additional
> syntax to allow using fields of the subclass in HQL queries, something
> like "select a from A+ a order by a.field2",
> or maybe an option in the Query interface like
> query.setUseInheritedProperties(true).
> 
> What do you think of this ?
> 
> Note : this is an extension of the JIRA HB-792 and could allow to
> resolve this case in a better way
> 
> 
> William
> 
> 
> 
> ---
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> ___
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel


---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel