
How to Prevent Path Traversal in Java File Handling
Stop path traversal by resolving user-supplied names against a base directory, normalizing and checking the result, and avoiding user input in paths.
Everything you need to level up your coding skills.

Stop path traversal by resolving user-supplied names against a base directory, normalizing and checking the result, and avoiding user input in paths.

How the Hibernate first level cache and flush modes work: identity map behaviour, AUTO flush before queries, COMMIT and MANUAL modes and batch clearing.

Reproduce a lost update in JPA with two transactions, then fix it with a version column, an atomic update query or a pessimistic lock, and test the conflict.

Log SQL in Hibernate with the right categories, show bind parameters, count statements with statistics and avoid the show_sql pitfalls in production.

Use Hibernate natural ids and business keys: map @NaturalId, look up by business key with caching, implement equals and hashCode safely and add constraints.

Run bulk update and delete queries in JPA and Spring Data, clear the stale persistence context, keep versions right and delete huge tables in chunks.

Compare Redis, Hazelcast and Infinispan for shared caching and state in Java: deployment model, data structures, near caches, consistency and when each fits.

Compare Caffeine, Guava Cache and Ehcache for in process caching in Java: eviction, refresh, statistics, Spring support and when you need a shared cache.

Use DTO projections with Hibernate and Java records: constructor expressions in JPQL, Spring Data interface and class projections, and when to skip entities.

Implement multi tenancy with Hibernate: compare discriminator, schema and database per tenant, resolve the tenant per request and avoid cross tenant leaks.

Use optimistic locking with a JPA version column: map @Version, handle OptimisticLockException, retry safely and expose the version through a REST API.

Find and fix a slow SQL query behind a Java service: capture the statement, run EXPLAIN ANALYZE, read scans and joins, then add an index or rewrite it.
We send one email when a new post is published. No spam.