• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Collection search with many to many association

 
Ranch Hand
Posts: 77
Eclipse IDE Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two POJOs as below.

Assuming ID and all other hbm xml mapping works fine as I am able to save and update the objects perfectly fine.
I want to search those companies having particular master comapnies associated with it.
I write below code for searching the company:

When I see the query generated by hibernate, it is as below.

select company0_.COMPANY_ID as COMPANY1_0_, company0_.COMPANY_NAME as COMPANY2_0_, company0_.ADDRESS as ADDRESS0_, company0_.CITY as CITY0_, company0_.DISTRICT as DISTRICT0_, company0_.STATE as STATE0_, company0_.PHONE as PHONE0_, company0_.MOBILE as MOBILE0_, company0_.EMAIL as EMAIL0_, company0_.URL as URL0_, company0_.COUNTRY as COUNTRY0_ from COMPANY company0_ inner join MASTER_CLIENT mastercomp1_ on company0_.COMPANY_ID=mastercomp1_.COMPANY_ID inner join MASTER_COMPANY mastercomp2_ on mastercomp1_.MASTER_COMPANY_ID=mastercomp2_.MASTER_COMPANY_ID where mastercomp2_.MASTER_COMPANY_NAME in (?)

Above query seems ok to me but I get following error.

Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'company0_.COMPANY_ID=mastercomp1_.COMPANY_ID inner join MASTER_COMPANY mastercomp2_ on mastercomp1_.MASTER_COMPANY_ID=mastercomp2_.MASTER_COMPANY_ID'.

I googled all the examples and they are giving the same query as above.

Can any one please help what is wrong with it.
I wasted whole day but didnt get solution.
 
I'm thinking about a new battle cry. Maybe "Not in the face! Not in the face!" Any thoughts tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic