-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes - newLearnings
24 lines (18 loc) · 1.63 KB
/
notes - newLearnings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-> storing live profile pic :
profile pic is saved in database, but it slows the application to load from there each time,
therefore will be generating & storing in an external directory,
so frontend can access it directly as a resource.
External directly - because storing new user uploads or img changes in 'src/resource/' folder is not recommended during runtime, it may work during development, but once it is packaged into a jar, any directory or files inside the src folder are not accessible for runtime operations like file creation or modification.
-> every small change asks demands for best user experience vs
-> making use of @OrderBy("[ColumnName] [SortDir]") on
Hibernate will return the list of seasons sorted by seasonNo in ascending order without requiring any manual sorting in Java or a custom query.
the @OrderBy annotation in JPA can only be applied to collection-based relationships (i.e. @OneToMany or @ManyToMany) that involve a parent-child mapping, such as @OneToMany or @ManyToMany relationships.
-> in this code :
```
@Formula(value = "(SELECT COALESCE(SUM(ep.runtime), 0) FROM episode AS ep"
+" WHERE ep.tmdb_id = tmdb_id"
+" AND ep.season_no > 0)")
private int totalRuntime = 0;
```
the Query in the formula returns a number or null if not used COALESCE, in case it returns null, then int cannot handle it even if it has default set to 0
When you have data that spans a wide range, such as counts ranging from under 10 to over 1000, it can lead to visualization issues with bar and pie charts, as large numbers overshadow smaller ones. One solution to handle this effectively is to use a Logarithmic Scale for your axis.