Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff Session in JDBC and Hibernate #204

Open
jashan0360 opened this issue Jan 21, 2024 · 0 comments
Open

Diff Session in JDBC and Hibernate #204

jashan0360 opened this issue Jan 21, 2024 · 0 comments

Comments

@jashan0360
Copy link

jashan0360 commented Jan 21, 2024

Description
In Spring application, I am using spring-boot-started-jta-atomikos version 2.6.4 dependency for transactions. I have created an interface to use jdbc and hibernate both. While using the query to fetch the sessionId of connection in both jdbc and hibernate it looks like they are using different sessions to connect. Not only this, But if I am trying dml/updation queries on normal tables via jdbc it is also reflected in the hibernate query for normal tables, if they have different sessions then why is it happening, is it due to local session commit?.
I am facing problem in executing statements for the global temporary tables, updations/insertion done by jdbc is not reflected in the hibernate which i want to see.
Is there any way to have the same sessionId within a single job having multiple DB operations? If yes, then how, If not then how this should be go for GlobalTemp tables as they are working for the normal tables.

To Reproduce
Steps to reproduce the behavior:

-> I am trying to do some operations via procedure on global temp tables and that operations should be reflected to hibernate also.
-> Also used hibernate logs:
[TRACE] o.h.i.SessionFactoryImpl$SessionBuilderImpl - Opening Hibernate Session. tenant=null
[DEBUG] o.h.r.t.b.j.i.JtaTransactionCoordinatorImpl - Hibernate RegisteredSynchronization successfully registered with JTA
platform
[TRACE] org.hibernate.internal.SessionImpl - Opened Session [18c3ee06-bb7d-4cf9-90da-bdf79ff74a2c] at timestamp:
1704368982687
-> expect the updations/DMLs done in single transaction is visible to all within scope of job.
-> using spring-boot-started-jta-atomikos version 2.6.4. Also tried to use some properties like local-transaction-mode=true and serial-jta-transactions=true

Properties used:
allowSubTransaction=false

Additional context
Previously using bitronix I ve found this different sessionId but could be solved by using property share-transaction-connections = true. Is there any property/configuration in atomikos to handle this scenario?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant