Filtering on children entities

Sources https://stackoverflow.com/questions/26684361/filter-child-object-in-spring-data-query https://stackoverflow.com/questions/42857947/jpa-with-specification-how-to-filter-an-entity-by-a-child-collection-content https://stackoverflow.com/questions/47867124/spring-data-jpa-specification-how-to-filter-a-parent-object-by-its-children-obj https://www.baeldung.com/jpa-and-or-criteria-predicates?fbclid=IwAR0vao7fFrB_NghXBEesu-cCFN9HS4WfPcmCXvTkKIvO72sIWu2Nz2aST4A https://stackoverflow.com/questions/55629512/how-to-filter-parent-object-which-has-list-of-children-and-a-child-has-list-of-g https://tousu.in/qa/?qa=873798/ https://stackoverflow.com/questions/25627484/how-to-filter-child-entities-collections-with-predicate?noredirect=1&lq=1 Fetch Joins https://stackoverflow.com/questions/71840199/how-to-fix-jpa-specification-api-with-join-on-condition-returns-2-query-instead More detail - Multiselect https://www.initgrep.com/posts/java/jpa/select-values-in-criteria-queries Subquery https://stackoverflow.com/questions/53678146/jpa-2-1-predicate-criteria-for-child-entity\ Matching against a list https://stackoverflow.com/questions/13940249/jpa-criteria-api-matching-against-a-list-in-spring-data-jpa-specifications Further Info https://stackoverflow.com/questions/47469861/what-is-the-difference-between-a-criteria-a-predicate-and-a-specification

April 28, 2022 · 26 words · Peter Dieleman

Db Locking

https://dzone.com/articles/concurrency-and-locking-with-jpa-everything-you-ne https://www.baeldung.com/jpa-pessimistic-locking https://blog.arnoldgalovics.com/jpa-optimistic-locking/ It’s also possible to lock multiple rows at the same time, this can be done by executing a custom select query and setting the lock mode. Exclusive lock table https://stackoverflow.com/questions/64224014/include-additional-columns-in-where-clause-of-hibernate-jpa-generated-update-que https://stackoverflow.com/questions/65049057/spring-data-jpa-insert-into-multiple-tables-to-avoid-locking-tables @Query(value = "LOCK TABLE SKU IN EXCLUSIVE MODE", nativeQuery = true) @Modifying void lockTable();

April 23, 2022 · 48 words · Peter Dieleman

Http status codes

SO discussions on appropriate codes https://stackoverflow.com/questions/3825990/http-response-code-for-post-when-resource-already-exists

April 22, 2022 · 6 words · Peter Dieleman

Customize error message Spring Boot

Sources https://stackoverflow.com/questions/62561211/spring-responsestatusexception-does-not-return-reason https://www.baeldung.com/global-error-handler-in-a-spring-rest-api https://www.amitph.com/spring-rest-api-custom-error-messages/ https://auth0.com/blog/get-started-with-custom-error-handling-in-spring-boot-java/ https://stackoverflow.com/questions/45317638/how-to-catch-accessdeniedexception-in-spring-boot-rest-api https://stackoverflow.com/questions/59302621/custom-message-in-spring-accessdeniedexception https://dzone.com/articles/best-practice-for-exception-handling-in-spring-boo @ControllerAdvice annotation Note AccessDeniedException needs to be taken care of in filter chain

April 12, 2022 · 21 words · Peter Dieleman

Switching Spring Boot Application.yml properties from IntelliJ

Use: --spring.config.name=myproject, where myproject is the name of the *.yml or *.properties file that is stored under the default /config directory. The extension is not required. https://docs.spring.io/spring-boot/docs/2.1.13.RELEASE/reference/html/boot-features-external-config.html Further Documentation https://www.baeldung.com/spring-yaml https://baeldung-cn.com/spring-yaml-vs-properties https://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/html/howto-properties-and-configuration.html https://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/html/howto-properties-and-configuration.html#howto-change-configuration-depending-on-the-environment need: spring.config.activate.on-profile: “profile_name” example: spring: # default config without profile name . . . --- spring: config: activate: on-profile: "profile name" In conjunction with: ./gradlew run --args='--spring.profiles.active=profile_name' Can make this even more complicated when activating multiple profiles at once with overlapping properties, in that case the precedence order of profiles needs to be defined....

March 28, 2022 · 107 words · Peter Dieleman

Setting a default format for Java 8 Date types

https://www.baeldung.com/spring-boot-formatting-json-dates https://stackoverflow.com/questions/66694406/spring-boot-rest-offsetdatetime-returned-as-float

March 24, 2022 · 2 words · Peter Dieleman

Using ModelMapper for a Count Field

Baeldung GameDTO contains only two fields, but the field types and names perfectly match the source. In such a case, ModelMapper handles the conversion without additional configuration: https://www.baeldung.com/java-modelmapper Use a converter, as outlined above.

March 24, 2022 · 34 words · Peter Dieleman

Debugging Spring Security AAD

Disabling Spring Security https://github.com/Azure/azure-sdk-for-java/pull/12645/files

March 23, 2022 · 4 words · Peter Dieleman

Empty Hash MSAL React

BrowserAuthError: hash_empty_error: Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. Given Url: ... https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/3638 https://stackoverflow.com/questions/67788651/microsoft-authentication-react-hash-empty-error-when-using-loginpopup https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/4573 We’ve resolved this in our application. For us, we had our redirect URL as the home page of our application. This caused an issue where our router (in Next.js) took over the routing in the popup, stripping the hash and redirecting it to the login page - before the window that launched the popup had time to extract it....

March 21, 2022 · 118 words · Peter Dieleman

Pronunciation

Vowels (Bold indicates identical pronunciaton) Duits Nederlands Beispiel Uitspraak / Hint a a missing missing a aa missing missing ä e Bäcker [bekker] ee Mädchen [meedchjen] o o missing missing oo missing missing ö eu stören [steuren] u oe Mutter [Moeter] ü u missing missing uu missing missing q kwaa Aquarium [Aak-waa-rie-oem] Diphtongs / Consonant Cluster (Bold indicates identical pronunciaton) Duits Nederlands Beispiel Uitspraak / Hint ei ai mein [main] eu oi heute [hoite] äu oi Bäume [boime] Consonants that differ in Pronunciation from Dutch Duits Nederlands Beispiel Uitspraak / Hint c ts CD [tsee-dee] s s messen [messen] (see details below) sj Sport [Sjport] (see details below) z Sommer [zommer] (see details below) z ts tanzen [tantsen] y u typisch [tuu-pisj] v f Vater soft ‘f’ w v/w Wind Wind - although pronounced closer to a v sch sj/ch Schokolade chocolade tsch tsj kitsch [kietsj] - als in Tsjechie ch ich als in ‘wiegje’ (see details below) Nacht nacht (see details below) g gerne als in ‘golf’ (Engels) Pronunciation Rules Vowels that are followed directly by ck or ch are ‘short’, e....

March 21, 2022 · 417 words · Peter Dieleman