Solved it... Had to divide my query in two different queries...
Thanks for everything, Dale. Daniel.Rodriguez wrote: > > Dale, > > Forgot to mention that we must support two different versions of MySQL > (3.23 and 5) Our clients are in a shared hosting server and use 3.23, and > other clients are in a dedicated server using MySQL v.5..... that means > that HQL must not produce nested queries..... > > (I know it sucks.. but the clients with MySQL 3.23 don't want to update... > they say that they must keep that version for legacy software) > > Thanks anyway, I'll keep trying. > > EDIT: > > Tried the following HQL : > > select cat > from Categoria cat > left outer join cat.subcategorias sc > where cat not in sc > > -- Weird, it works in MySQL 3.23 (the query returns 1 result) and in MySQL > 5 , the query turns up empty.... > > > DNewfield wrote: >> >> Daniel.Rodriguez wrote: >>> I have a Class called Categoria (Category) that has a List of categories >>> (sub-categories). >>> >>> I'm trying to build a HQL query that can gives me all the Categories >>> that >>> are not a subcategory of another category. >>> >>> In SQL is dead simple : >>> >>> SELECT cat.id >>> FROM Categoria cat >>> LEFT OUTER JOIN subCategoria sc >>> ON cat.id != sc.padre_id >> >> select cat >> from Categoria cat, Categoria parent >> where parent.id = :theParentId >> and cat not in elements(parent.subCategoria); >> >> -Dale >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- View this message in context: http://www.nabble.com/SQL-v.s.-HQL-%28plz-help%29-tf4002808s2369.html#a11373945 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
