{"action":"created","issue":{"url":"https://api.github.com/repos/slick/slick/issues/1040","labels_url":"https://api.github.com/repos/slick/slick/issues/1040/labels{/name}","comments_url":"https://api.github.com/repos/slick/slick/issues/1040/comments","events_url":"https://api.github.com/repos/slick/slick/issues/1040/events","html_url":"https://github.com/slick/slick/issues/1040","id":53960177,"number":1040,"title":".delete does not work for JdbcProfile","user":{"login":"cvogt","id":274947,"avatar_url":"https://avatars.githubusercontent.com/u/274947?v=3","gravatar_id":"","url":"https://api.github.com/users/cvogt","html_url":"https://github.com/cvogt","followers_url":"https://api.github.com/users/cvogt/followers","following_url":"https://api.github.com/users/cvogt/following{/other_user}","gists_url":"https://api.github.com/users/cvogt/gists{/gist_id}","starred_url":"https://api.github.com/users/cvogt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvogt/subscriptions","organizations_url":"https://api.github.com/users/cvogt/orgs","repos_url":"https://api.github.com/users/cvogt/repos","events_url":"https://api.github.com/users/cvogt/events{/privacy}","received_events_url":"https://api.github.com/users/cvogt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/slick/slick/labels/wontfix","name":"wontfix","color":"c0c0c0"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/slick/slick/milestones/11","labels_url":"https://api.github.com/repos/slick/slick/milestones/11/labels","id":625032,"number":11,"title":"3.0.0 (formerly 2.2.0)","description":"","creator":{"login":"cvogt","id":274947,"avatar_url":"https://avatars.githubusercontent.com/u/274947?v=3","gravatar_id":"","url":"https://api.github.com/users/cvogt","html_url":"https://github.com/cvogt","followers_url":"https://api.github.com/users/cvogt/followers","following_url":"https://api.github.com/users/cvogt/following{/other_user}","gists_url":"https://api.github.com/users/cvogt/gists{/gist_id}","starred_url":"https://api.github.com/users/cvogt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvogt/subscriptions","organizations_url":"https://api.github.com/users/cvogt/orgs","repos_url":"https://api.github.com/users/cvogt/repos","events_url":"https://api.github.com/users/cvogt/events{/privacy}","received_events_url":"https://api.github.com/users/cvogt/received_events","type":"User","site_admin":false},"open_issues":128,"closed_issues":13,"state":"open","created_at":"2014-04-09T12:08:59Z","updated_at":"2015-01-13T10:00:12Z","due_on":"2016-02-01T05:00:00Z","closed_at":null},"comments":3,"created_at":"2015-01-10T14:46:24Z","updated_at":"2015-01-13T19:00:35Z","closed_at":"2015-01-12T10:45:54Z","body":"```\r\nimport scala.slick.driver.JdbcProfile\r\n\r\ntrait DBComponent {\r\n\r\n  val profile: JdbcProfile\r\n\r\n  import profile.simple._\r\n\r\n  def dbObject(): Database\r\n}\r\n\r\ntrait QueryExecutor { this: DBComponent =>\r\n\r\n  import profile.simple._\r\n\r\n  def execute[T <: Rep[_], F, C[_]](query: Query[T, F, C]): List[F] =    dbObject.withSession { implicit session: Session => query.list }\r\n\r\n  def executeUpdate[T <: Rep[_], F, C[_]](query: Query[T, F, C], value: F): Int = dbObject.withSession { implicit session: Session => query.update(value) }\r\n\r\n  def executeInsert[T <: Rep[_], F, C[_]](query: Query[T, F, C], value: F): Int = dbObject.withSession { implicit session: Session => query.insert(value) }\r\n\r\n  def executeDelete[T <: Rep[_], F, C[_]](query: Query[T, F, C]): Int = dbObject.withSession { implicit session: Session => query.delete }*/\r\n  //getting error => delete is not a member of QueryExecutor.this.profile.simple.Query[T,F,C]\r\n}\r\n```\r\n\r\nAnd `queryToDeleteInvoker(query).delete` leads to `QueryExecutor.this.profile.simple.Query[T,F,C] [error] (which expands to) scala.slick.lifted.Query[T,F,C] [error] required: scala.slick.lifted.Query[QueryExecutor.this.profile.Table[_], _, ?] `\r\n\r\nSee http://stackoverflow.com/questions/27730397/how-to-write-generic-query-executor-method-for-delete?noredirect=1#comment44148425_27730397"},"comment":{"url":"https://api.github.com/repos/slick/slick/issues/comments/69798769","html_url":"https://github.com/slick/slick/issues/1040#issuecomment-69798769","issue_url":"https://api.github.com/repos/slick/slick/issues/1040","id":69798769,"user":{"login":"satendrakumar06","id":4868292,"avatar_url":"https://avatars.githubusercontent.com/u/4868292?v=3","gravatar_id":"","url":"https://api.github.com/users/satendrakumar06","html_url":"https://github.com/satendrakumar06","followers_url":"https://api.github.com/users/satendrakumar06/followers","following_url":"https://api.github.com/users/satendrakumar06/following{/other_user}","gists_url":"https://api.github.com/users/satendrakumar06/gists{/gist_id}","starred_url":"https://api.github.com/users/satendrakumar06/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satendrakumar06/subscriptions","organizations_url":"https://api.github.com/users/satendrakumar06/orgs","repos_url":"https://api.github.com/users/satendrakumar06/repos","events_url":"https://api.github.com/users/satendrakumar06/events{/privacy}","received_events_url":"https://api.github.com/users/satendrakumar06/received_events","type":"User","site_admin":false},"created_at":"2015-01-13T19:00:35Z","updated_at":"2015-01-13T19:00:35Z","body":"thanks @szeiger and @cvogt\r\n\r\nIt is working fine with Table[_].\r\n It working fine for single  table. When join mutliple table. I did not work.\r\nIs any way do this ?\r\n\r\n ` def findEmpAndDeptByEmpId(id: Int) = execute {\r\n    empTableQuery.filter(_.id === id) join deptTableQuery on (_.deptId === _.id)\r\n  }`\r\n\r\nIdea is do not want to write 'dbObject.withSession { implicit =>}' again and again.I want to write in a single place for all kind of query.Is this make sense ?\r\nor any other better way ?\r\n\r\n See full example.\r\n`import scala.slick.driver.JdbcProfile`\r\n\r\n`trait DBComponent {\r\n\r\n  val profile: JdbcProfile\r\n\r\n  import profile.simple._\r\n\r\n  def dbObject(): Database\r\n}\r\n\r\ntrait QueryExecutor { this: DBComponent =>\r\n\r\n  import profile.simple._\r\n\r\n  def execute[T <: Rep[_], F, C[_]](query: Query[T, F, C]): List[F] = dbObject.withSession { implicit session: Session => query.list }\r\n\r\n  def executeUpdate[T <: Table[_], F, C[_]](query: Query[T, F, C], value: F): Int = dbObject.withSession { implicit session: Session => query.update(value) }\r\n\r\n  def executeInsert[T <: Table[_], F, C[_]](query: Query[T, F, C], value: F): Int = dbObject.withSession { implicit session: Session => query.insert(value) }\r\n\r\n  def executeDelete[T <: Table[_], F, C[_]](query: Query[T, F, C]): Int = dbObject.withSession { implicit session: Session => query.delete }\r\n\r\n}\r\n\r\ntrait EmployeeRepository extends DepartmentRepository { this: DBComponent with QueryExecutor =>\r\n\r\n  import profile.simple._\r\n\r\n  class EmpTable(tag: Tag) extends Table[Emp](tag, \"emp\") {\r\n    def id = column[Int](\"id\", O.PrimaryKey, O.AutoInc)\r\n    def deptId = column[Int](\"dept_id\")\r\n    def name = column[String](\"name\")\r\n    val dept = foreignKey(\"emp_dept\", deptId, deptTableQuery)(_.id)\r\n    def * = (id, name, deptId) <> (Emp.tupled, Emp.unapply)\r\n\r\n  }\r\n\r\n  val empTableQuery = TableQuery[EmpTable]\r\n\r\n  def create(emp: Emp) = executeInsert(empTableQuery, emp)\r\n\r\n  def update(emp: Emp) = executeUpdate(empTableQuery, emp)\r\n\r\n  def delete(id: Int) = executeDelete { empTableQuery.filter(_.id === id) }\r\n\r\n  def findById(id: Int) = execute { empTableQuery.filter(_.id === id) }\r\n\r\n  def findEmpAndDeptByEmpId(id: Int) = execute {\r\n    empTableQuery.filter(_.id === id) join deptTableQuery on (_.deptId === _.id)\r\n  }\r\n\r\n}\r\n\r\ntrait DepartmentRepository { this: DBComponent with QueryExecutor =>\r\n\r\n  import profile.simple._\r\n\r\n  class DeptTable(tag: Tag) extends Table[Dept](tag, \"emp\") {\r\n    def id = column[Int](\"id\", O.PrimaryKey, O.AutoInc)\r\n    def name = column[String](\"name\")\r\n    def * = (id, name) <> (Dept.tupled, Dept.unapply)\r\n  }\r\n\r\n  val deptTableQuery = TableQuery[DeptTable]\r\n\r\n}`\r\n\r\n`case class Emp(id: Int, name: String, deptId: Int)`\r\n`case class Dept(id: Int, name: String)`\r\n\r\n\r\n\r\n"}}