Let optional foreign key generator produce outer join
See original GitHub issue type ID = Array[Byte] // Oracle RAW
object Users extends Table[User]("TB_USER") {
def id = column[ID]("ID",O.PrimaryKey)
def agencyId = column[Option[ID]]("AGENCY_ID")
def inactive = column[Boolean]("INACTIVE", O.Default(false))
def disabled = column[Boolean]("IS_DISABLED", O.Default(true))
def agency = foreignKey("FK_TB_USER_AGENCY_ID",agencyId,Agencies)(_.id.?)
}
object Agencies extends Table[Agency]("TB_AGENCY") {
def id = column[ID]("ID",O.PrimaryKey)
def dataOutOfDate = column[Boolean]("IS_DATA_OUT_OF_DATE")
}
val q = for {
u <- Users
s <- u.agency // agencyId is Option[ID]; let this produce an outer join
} yield (u.disabled, u.inactive, s.dataOutOfDate.?.getOrElse(false))
Issue Analytics
- State:
- Created 10 years ago
- Reactions:12
- Comments:22 (3 by maintainers)
Top Results From Across the Web
Hibernate/JPA: ManyToOne to behave as LEFT OUTER JOIN ...
I have tried optional=true and nullable = true but it didn't help. My understanding is @JoinColumn is creating a Foreign Key relationship.
Read more >16715 (Wrong JOIN with nested null-able foreign keys)
I assume this is a bug in how Django selects whether to use a LEFT JOIN vs. an INNER JOIN in foreign key...
Read more >SQL OUTER JOINs: An overview of all types - IONOS
An SQL JOIN is a query operation that links several tables in a relational database and outputs their data records (tuples) filtered ...
Read more >SQL FOREIGN KEY - W3Schools
The following SQL creates a FOREIGN KEY on the "PersonID" column when the "Orders" table is created: MySQL: CREATE TABLE Orders ( OrderID...
Read more >SQL OUTER JOIN overview and examples
If there are any unmatched rows, it shows NULL values for them. We can understand efficiently using examples. Let's create a sample table...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 hi guys, I guess no update here?
@trevorsibanda if you ever feel the itch for hacking on something, here is something that may fall into your ballpark 😉