Querydsl-sql produced invalid SQL for fullJoin()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Querydsl |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The following code sniplet generates invalid SQL code:
QQueues q = QQueues.queues;
QQueueDoctors qd = QQueueDoctors.
QAppointments a = QAppointments.
List<Object[]> rows = session.
fullJoin(
list(q.name, qd.doctorId, a.id);
The generated SQL is missing "full join" before the "on" keyword:
SELECT QUEUES.NAME, QUEUE_DOCTORS.
FROM QUEUES QUEUES, QUEUE_DOCTORS QUEUE_DOCTORS, APPOINTMENTS APPOINTMENTS
ON QUEUE_DOCTORS.
WHERE QUEUES.ID = ? "; SQL statement:
select QUEUES.NAME, QUEUE_DOCTORS.
from QUEUES QUEUES, QUEUE_DOCTORS QUEUE_DOCTORS, APPOINTMENTS APPOINTMENTS
on QUEUE_DOCTORS.
where QUEUES.ID = ?
The problem is that fullJoin() notices that from() already contains the tables being joined-on so it omits "full join". I've never really used SQL joins before so it's possible I'm missing something but I'm expecting querydsl-sql to prevent me from generating invalid SQL. Either the dsl should make it impossible or I should get some runtime exception from querydsl explaining what I did wrong.
IllegalStateExc eptions are now thrown in these cases. You need to use a different alias in your join.