> However, my code implements an "implicit" typecast;
> I don't need any special syntax at all. This is a Bad
> Thing, I guess, and we should try to figure out how to
> develop that into an explicit typecast operator.

I intend to agree with you on explicit cast.

Using implicit, what do you do to in such cases
B <- B1 (having prop1)
B <- B2 (having prop2)

from A as a join a.b as cast where cast.prop1 = :val1 or cast.prop2 = :val2

This should fail as a ClassCastException or something like that, but not
very understandable for the common user.
Explicit cast clarify it.

Now the syntax, I can't do the above sample with your syntax, because I
need to cast in the where clause.
What could be doable is something like that
from A as a join a.b as b where (b NARROW B1).prop1 = :val1 and (b NARROW
B2).prop2 = :val2

But this lead to ClassCastException too, because I can't be B1 and B2 the
same time.

A conditional processing + instanceof operator is needed. But this is way
more complex.
from A as a join a.b as b where (IF b instanceof B1 THEN (b NARROW
B1).prop1 = :val1) AND (IF b instanceof B2 THEN (b NARROW B2).prop2 =
:val2)

Well not trivial!

Emmanuel Bernard
[EMAIL PROTECTED]


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to