I am trying to duplicate an HQL join example from the manual as below
in my code but am having no luck

http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html
select cust
from Product prod,
    Store store
    inner join store.customers cust
where prod.name = 'widget'
    and store.location.name in ( 'Melbourne', 'Sydney' )
    and prod = all elements(cust.currentOrder.lineItems)

and am trying to do similar, and select data from both tables only for
a specific country.

I have two tables

DATATYPE :
hjid bigint NOT NULL                                              ( KEY )
hjtype character varying(255) NOT NULL
country character varying(255)
comments character varying(255)
programme character varying(255)

REVENUECOSTSFUELTYPE :
hjid    bigint  NOT NULL
hjtype  character varying(255)  NOT NULL
type    character varying(255)  
comments        character varying(255)  
value   real
samplingparams  bigint
datatype_revenuecostsfuel_hjid  bigint        ( FOREIGN_KEY FOR DATATYPE TABLE)
datatype_revenuecostsfuel_hjindex
grouping        bigint


My query is

'select data from generated.DATA data inner join
generated.REVENUECOSTSFUEL sub where data.hjid =
sub.datatype_revenuecostsfuel_hjid and data.COUNTRY where data.COUNTRY
= :countryid and data.hjid =spain

i get :
<java.lang.Exception: java.lang.Exception: java.lang.Exception: Error
looking for existing data :
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: where
near line 1, column 150 [select data from generated.DATA data inner
join generated.REVENUECOSTSFUEL sub where data.hjid =
sub.datatype_revenuecostsfuel_hjid and data.COUNTRY where data.COUNTRY
= :countryid] revenue_costs_fuel TEST2,revenue_costs_fuel
revenue_costs_fuel>


I would be glad for any assistance

Thanks

Paul.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to