Hi All,
I am getting a strange SQL if executed the below scala-query code-
database.withSession { implicit db:Session =>
//TODO: Optimize
//var jds:List[JD] = List()
//ids.foreach(id => findByID(id).map(a => {jds = jds ::: List(a)}))
//Logger.debug("Q for all JD by ID has records:" + jds.size)
//jds
val l = for{o <- JDs if o.jobId inSet ids } yield(o)
Logger.debug("Q for all JD by ID:" + l.selectStatement)
l.list()
}
Query dump shows me below output-
SELECT `t1`.`id`,`t2`.`job_date`,`t2`.`job_title`,`t2`.`job_industry`,`t2`.`job_function`,`t2`.`job_prof`,`t2`.`skills`,`t2`.`ctc`,`t2`.`education`,`t2`.`location`,`t2`.`status`,`t2`.`description`,`t2`.`experience`,`t1`.`owner`,`t1`.`created_on` FROM `job_description` `t1`,`job_description` `t2` WHERE (`t1`.`id` in (1,2))
Why is it generating t1 and t2 aliases for same table `job_description` and showing same results two times?
Is the code wrong?
Can someone please help?
Thanks
Pawan