Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate query with Hardcoded result  RSS feed

Navanethan Muthusamy
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can you tell how do I write a hibernate query like

String name = "John";

List list = session.createSQLQuery("Select '+ name +' as Name from Emp")

FYI: In EmpBean class I have String getter and setter method for name.

In this query expecting char setter and getter in EmpBean class, because of single quote.

and when i try to add addScalar("name", Hibernate.STRING) its showing that deprecated.

Can you please let me know how do i manage this case.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!