2016-08-21 2 views
0

나는 '기술 작가 MASTHANVALI'와 같은 출력을 얻기 위해 다음을 수행하려합니다.JPAQL CONCAT 작업

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 

어떻게하면 좋을까요?

+0

오류 메시지가 당신에게 잘못된 3 가지를 알려줍니다 뒤에 공백을 추가합니다. "ename"이 인식되지 않습니다. "deg"는 인식되지 않습니다. "employee"다음에 별명이 필요합니다. –

답변

0

단일 qoutes에 따옴표를 교체 시도하고 닫는 대괄호

Query query = 
    em.createQuery("select concat(upper(ename) , ' - ', deg) from employee");