In general it can't figure out the type. Consider:

from foo in class Foo where foo.floatValue + 1 = ?
from foo in class Foo where someUserFunction( foo.value ) = ?

etc....

On the other hand, Query.setParameter() has some hueristics for guessing the
type from the given object, which is not 100% reliable, but its pretty good.
If we would have already had the Query interface when I designed the Session
interface, we could have made a good argument for letting the convenience
methods on Session use those same hueristics. But we didn't, so it wasn't an
option at the time.


----- Original Message -----
From: "Chris Nokleberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 25, 2002 5:40 AM
Subject: [Hibernate] Are types really needed for queries?


> Just a thought...shouldn't Hibernate be able to infer the Type or Type[]
> needed in find/findIdentifiers/iterate calls from the query itself?
>
> e.g.
>
> List moreCats = sess.find(
>     "from cat in class eg.Cat where " +
>     "cat.name = 'Fritz' or cat.id = ? or cat.id = ?",
>     new Object[] { id1, id2 },
>     new Type[] { Hibernate.LONG, Hibernate.LONG }
> );
>
> I think Hibernate already knows that these need to be LONGs.
>
> Maybe there are cases where there is some ambiguity, but if so I would
> guess it could be resolved by looking at the actual types of the
> argument objects (id1, id2).
>
> -Chris
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Influence the future
> of Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0003en
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0003en
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to