I am trying to do following to get output like 'MASTHANVALI - Technical Writer'
Query query = em.createQuery("select concat(upper(ename) , \" - \", deg )from employee");
But having following error.
Exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Syntax error parsing [select concat(upper(ename) , " - ", deg )from employee].
[20, 25] The encapsulated expression is not a valid expression.
[37, 40] The expression 'deg' is not valid expression.
[54, 54] An identification variable must be provided for a range variable declaration.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605)
at com.tutorialspoint.eclipselink.service.ScalarandAggregateFunctions.main(ScalarandAggregateFunctions.java:14) Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.JPQLException
Any idea how to do this?