You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/documentation/orm.html.md.erb
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -140,6 +140,7 @@ In the realm of O/R mapper, the hallmark feature lies in its ability to effortle
140
140
141
141
[This test code](https://github.com/scalikejdbc/scalikejdbc/tree/master/scalikejdbc-orm/src/test/scala/basic_test/accounts) provides invaluable insights for learning. If you're unable to find specific examples here, referring to the code will be greatly helpful.
142
142
143
+
<hr/>
143
144
#### hasOne
144
145
145
146
The `hasOne` relationship signifies that table A is referenced from table B via table A's primary key. Your code aims to include table B's data within the entity of table A. In the following example, the `Member` entity (representing table A) includes a `name` property, which can be resolved using the `member_id` column within the `Name` entity (representing table B).
@@ -198,6 +199,7 @@ object Member extends CRUDMapper[Member] {
198
199
199
200
This `#byDefault` method is available for all other association APIs.
200
201
202
+
<hr/>
201
203
#### belongsTo
202
204
203
205
The `belongsTo` relationship indicates that table B is referenced from table A via table B's primary key. Your code aims to incorporate table B's data into the entity of table A. In the following example, the `Member` entity (representing table A) includes a `company` property, which can be resolved using the `company_id` column within the entity. From another perspective, the `Company` entity (representing table B) does not contain any information about `Member` (table A).
@@ -243,6 +245,7 @@ val member: Option[Member] =
243
245
244
246
As mentioned above, once you add `byDefault` call to the `belongsTo` code line, you can omit `.joins(Member.company)` in the code.
245
247
248
+
<hr/>
246
249
#### hasMany
247
250
248
251
The `hasMany` relationship denotes that table A is referenced from table B via table A's primary key. Your code seeks to include multiple rows from table B into the entity of table A. In the following example, the `Company` entity (representing table A) contains a `members` property, which can be resolved using the `company_id` column on the `Member` entity side (representing table B).
@@ -336,11 +339,12 @@ Here is a code snippet demonstrating how to perform join queries:
336
339
337
340
```scala
338
341
val alice: Option[Member] =
339
-
Member.joins(Member.skills).findById(123)
342
+
Member.joins(Member.skills).findById(123)
340
343
```
341
344
342
345
The `alice.map(_.skills)` should be a list of `Skill` entities if some skills are saved in the "member_skill" table.
343
346
347
+
<hr/>
344
348
#### includes (Eager Loading)
345
349
346
350
When enabling eager loading via the `includes` API, it's necessary to define both the `belongsTo` etc. and `includes` within the same association claim.
@@ -389,4 +393,6 @@ Please note that eager loading of more deeply nested entities is not currently s
389
393
390
394
While it could be feasible with a dynamic programming language like Ruby, achieving the same functionality with a strictly typed language like Scala is quite challenging. At present, we don't have any plans to enhance this feature unless the Scala language provides a revolutionary hack for us to leverage.
391
395
396
+
<hr/>
397
+
392
398
For more examples and hands-on learning, please refer to [this example working code](https://github.com/scalikejdbc/scalikejdbc/tree/master/scalikejdbc-orm/src/test/scala/basic_test/accounts). If you have any questions or feature requests, don't hesitate to submit them on GitHub!
Copy file name to clipboardExpand all lines: source/index.html.md.erb
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,17 @@
1
1
# ScalikeJDBC
2
2
3
3
<hr/>
4
-
## Just write SQL and get things done
4
+
## Just Write SQL And Get Things Done 💪
5
5
<hr/>
6
6
7
-

8
-
9
7
This library seamlessly wraps JDBC APIs, offering intuitive and highly flexible functionalities. With QueryDSL, your code becomes inherently type-safe and reusable.
10
8
11
9
ScalikeJDBC is not just practical; it's production-ready. Utilize this library confidently in your real-world projects.
12
10
13
-
### Working on the JDBC layer
11
+

12
+
13
+
<hr/>
14
+
### Working on JDBC Layer
14
15
15
16
Whether you prefer it or not, JDBC stands as a steadfast standard interface. Given its widespread support across most RDBMS, accessing databases remains consistent. We adhere to this standard rigorously, ensuring each release passes through comprehensive unit tests across various RDBMS platforms:
16
17
@@ -21,11 +22,12 @@ Whether you prefer it or not, JDBC stands as a steadfast standard interface. Giv
21
22
22
23
We firmly believe that ScalikeJDBC seamlessly integrates with a variety of RDBMS, including Oracle, SQL Server, and others. Its robust design ensures compatibility and reliability across different database platforms.
23
24
24
-
### Amazon Redshift, Facebook Presto also supports JDBC
25
+
#### Amazon Redshift, Facebook Presto also supports JDBC
25
26
26
27
If you can access a datastore via the JDBC interface, you can also seamlessly access it through ScalikeJDBC. For instance, [Amazon Redshift](https://docs.aws.amazon.com/redshift/latest/dg/c_redshift-postgres-jdbc.html) and [Facebook Presto](https://prestodb.io/docs/current/installation/jdbc.html) have added support for the JDBC interface, enabling easy integration with ScalikeJDBC.
27
28
28
-
### Few dependencies
29
+
<hr/>
30
+
### Less Dependencies
29
31
30
32
The core of ScalikeJDBC boasts minimal dependencies, sparing you from the woes of dependency hell. Enjoy a streamlined development experience without unnecessary complications.
31
33
@@ -35,7 +37,7 @@ The core of ScalikeJDBC boasts minimal dependencies, sparing you from the woes o
35
37
36
38
Certainly, you have the flexibility to utilize c3p0 or other connection pool libraries instead of commons-dbcp with ScalikeJDBC. While ScalikeJDBC doesn't offer a default ConnectionPool implementation for these alternatives, you have the freedom to integrate them seamlessly according to your project requirements.
37
39
38
-
### Non-blocking?
40
+
### No Non-Blocking?
39
41
40
42
While JDBC drivers inherently block on socket IO, making them potentially unsuitable for async event-driven architectures, it's worth noting that most real-world applications currently don't require such architecture. JDBC remains a crucial infrastructure for JVM-based apps.
0 commit comments