val table: Table[T] only works if I also define T as a type, and then the child classes cause compiler errors when they try to provide a table of a different type.
You can do this with a self type. I'm not sure I'd recommend it, but it should work:
class BaseEntity[T] {
self: T =>
val table: Table[T]
}
Then your implementation would look like:
class MyEntity extends BaseEntity[MyEntity]
Using findTablesFor is probably a better solution. There is nothing stopping you from mapping a Class to multiple tables within a Squeryl schema. You could have:
val tableA = table[MyEntity]
val tableB = table[MyEntity]
Hence the reason to return an Iterable for all of the matching tables. If you know you aren't going to do this though, you can just use the first result:
val table = MySchema.findTableFor(this).head
Note that this will throw an exception if no relevant tables are found.