I found this while trying to left join a table to my main table twice.
var q = db.From()
.LeftJoin<CASE_HISTORY>((c, ch1) => c.Id = ch1.CASE_HISTORY_ID, db.JoinAlias(“created”))
.LeftJoin<CASE_HISTORY>((c, ch2) => c.Id = ch2.CASE_HISTORY_ID, db.JoinAlias(“updated”))
.Select("*");
var result = db.SelectMulti<CASES, CASE_HISTORY, CASE_HISTORY)(q, new [] { “CASES.", "created.”, “updated.*” });
This, unfortunately won’t work since the table CASE_HISTORY has the column CASE_HISTORY_ID, and the JoinAlias will replace both the tablename AND the columnname with “created” and “updated”, resulting in a FromExpression looking like this
FROM CASES LEFT JOIN CASE_HISTORY created ON (CASES.Id = created.created_ID) LEFT JOIN CASE_HISTORY updated ON (CASES.Id = updated.updated_ID)
Of course the table doesn’t have a column name updated_ID or created_ID, it’s named CASE_HISTORY_ID, but the JoinAlias replaces the column name with the alias.
Didn’t know where I should report this other than here.
Using OrmLite 5.4.0 and in this case connecting to an Oracle DB.