I am doing a project with jpa
and spring
, and i need to do a query
like this:
Select models.dto.dealCalendarDTO(d, c) from deal d left outer join calendar c on calendar.deal_id=deal.id;
Or
Select d,c from deal d left outer join calendar c on calendar.deal_id=deal.id;
When I try the first one I have this error: java.lang.NullPointerException: null
When I use the second one, I have this one
Caused by: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode
\-[IDENT] IdentNode: 'c' {originalText=c}
I did it with classic SQL
without a problem, but I think I am missing something.
The NullPointerException
in the first query because you are doing a left join and this maybe cause that c Calendar
will be null
and you are trying to access it in the DTO
function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.