inside « Interceptor « JPA Q&A





1. How to get Hibernate session inside a Hibernate Interceptor?    stackoverflow.com

How to get Hibernate session inside a Hibernate Interceptor? I'm trying to use Hibernate to enforce data access by organization id transparently. I have set a global Filter to filter all queries ...

2. Getting a session inside an interceptor    forum.hibernate.org

3. How to do new query inside Interceptor    forum.hibernate.org

Hi, I have Tables A and B (not related). When I save or load or insert in A, a new record needs to be inserted in B. I was looking at the Interceptor to handle this (no triggers). However, seems that the Session is not accessible in Interceptor . There seems to be hack around it by creating a new session ...

4. Stop update inside Interceptor.onFlushDirty    forum.hibernate.org

Is it possible to stop an update inside an Interceptor.onFlushDirty call? I would like to use this to method to detect dirty objects, but I need to do some processing on these objects before the changes are committed(I really want to persist the objects using a brand new ID, instead of overwriting the old version) As far as I know there ...

5. querying inside the Interceptor onSave() method.    forum.hibernate.org

hello, I have a requirement to query the DB for a sequence and append a string to it to form a business Id. This is not the technical Id, so I cannot use a generator tag in the mapping file. Is it possible to execute a SQLQuery like "select CURRENT_SERVER from SYSIBM.SYSDUMMY1"? Code inside the onSave(): Code: String generationQuery = ...