The following comment has been added to this issue:
Author: Emmanuel Bernard
Created: Thu, 20 Nov 2003 6:44 AM
Body:
This can be useful for collections referencing a superclass and request using subclass properties.
Keeping the previous syntax
from A as a where ((a.super instanceof Sub1 and ((Sub1)a.super).property = ?)
or (a.super instanceof Sub2 and ((Sub2 a.super).property2 = ?))
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-33
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-33
Summary: instanceof statement
Type: New Feature
Status: Unassigned
Priority: Major
Project: Hibernate2
Assignee:
Reporter: Max Rydahl Andersen
Created: Sat, 3 May 2003 10:19 AM
Updated: Thu, 20 Nov 2003 6:44 AM
Description:
instanceof statement
Suppose I have class A and class B mapped in
Hibernate as (for example) joined-subclass:
public class A { int id; }
public class B extends A { String status; }
I wish to select all objects of class A and only those
objects of class B which have status = 'READY'.
In current HQL I can do it as:
select a from a in class A left outer join b in class B
where b.status is null or b.status = 'READY';
but SQL for select a from a in class A already has outer
joined subclass B and SQL becames ineffective!
I thik it will be nice to have instanceof statements and
type cast. So my HQL has to be looks like:
from a in class A where ((B)a).status is null or ((B)
a).status = 'READY';
or using aliases (which also doesn't works for one-to-
many, unfortunately):
from A as a, (B)a as b where b.status is null or b.status
= 'READY';
or using instanceof statement:
from A as a where (a instanceof A) or (a instanceof B
and ((B)a).status = 'READY')
Perhaps here can be anothe syntax for it.
With best regards1
Dmitry M.Ivlev
http://sourceforge.net/tracker/index.php?func=detail&aid=716573&group_id=40712&atid=428711
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|