marți, 20 iunie 2023

Debugging (and understanding) Hibernate

Put a breakpoint inside each method of org.hibernate.EmptyInterceptor and hit Debug. 

UPDATE: If we will inspect any Hibernate operation, or more technically chain of Hibernate method calls, we will always find a e method of Interceptor interface (implemented by EmptyInterceptor). In this way placing a breakpoint in EmptyInterceptor methods and inspecting breakpoint neighborhoods we will favor finding the solution.

Also if you want to know which part of your code generated a specific query, then put a conditional break point (e.g. statement.contains("from <my_table>")) inside SqlStatementLogger.logStatement(String statement) method.

Also if you want to know from which cache was the entity loaded

- set log level trace for org.hibernate.event.internal.DefaultLoadEventListener

- set log level debug for org.hibernate.SQL

vineri, 19 mai 2023

Despre un aspect din cartile sci-fi

Imi plac cartile sci-fi pentru ca deseori prezinta societati in care lipseste un anumit aspect ce exista in abundenta in societatea de azi. 

Iar prin prezentarea (si urmarirea de catre cititor) a consecintelor lipsei acestuia se face un exercitiu mintal (de excludere) foarte util. 

Dar cred ca cel mai bine transmite ideea aceasta formula:

card(A - B) = cardA - card(A ∩ B)