ORMLite: How to join two tables without foreign ke

2019-02-19 20:25发布

I have to join two independent tables in sqlite. They don't have any foreign key relationship.

Example:

  • Table A has a field name
  • Table B has a field primaryName

I want to do something like

select A.* from A inner join B on A.name = B.primaryName
    where A.id = 10 and B.address is null

ORMLite enforces foreign key, is there a way to do this in ORMLite?

1条回答
可以哭但决不认输i
2楼-- · 2019-02-19 21:10

Unfortunately the short answer is "not at this time". You can certainly use the raw query functionality to support this:

http://ormlite.com/docs/raw-queries

Edit:

This has [finally] been added ORMLite. It has been checked into trunk and will be in version 4.49. Here's the check-in on github:

https://github.com/j256/ormlite-core/commit/b37914d76fbbbbbc70d473be1cf1b6de19b847f5

查看更多
登录 后发表回答