• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

,expected in select

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • 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



 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just select itc.
You want the whole entity, so select it:

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • 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[]>.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic