• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

,expected in select

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i am trying to select two columns in the entity i am getting below error like

, expected in SELECT [select itc.interestTypeKey as interestTypeKey from com.org.state.dsl.btlds.admin.entities.InterestTypeCodeEntity itc ]

This is my java code , i am not able to figure out where iam doing mistake, Please help me in understanding the problem.





if i change the select query like as below it is working fine


String sql=" select new InterestTypeCodeEntity( itc.interestTypeKey , itc.interestTypeName) from InterestTypeCodeEntity itc where itc.endDate is null

i dont like to create any constructors in my class


Thanks
Amir



 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just select itc.
You want the whole entity, so select it:

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave,

Thanks for the reply.

i just want to select only the two columns not the whole entity.

Thanks
Amir
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But you're assigning it to the entity:

which is where the problem is.

If you only want those two columns (as in your original query) then the returned List is a List<Object[]>.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic