#Spring Boot JPA/JTA?
57 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @static inlet! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Are you using H2?
is the message a warning or an error?
Since you seem to be using Spring, can you share your application.properties and pom.xml?
Are you deploying to an application server?
and you might set it to org.springframework.transaction.jta.JtaTransactionManager
declaration: package: org.springframework.transaction.jta, class: JtaTransactionManager
Are you maybe using Spring without Spring Boot?
to me, that error looks like you are missing autoconfiguration
oh and the property might be called spring.jpa.properties.hibernate.transaction.jta.platform in your application.properties
@static inlet
Can you create a minimal reproducer?
Are you using the Spring Boot Gradle plugin?
Did you create the project with Spring Initializr?
Can you show the full build.gradle?
Did you make any modification to the build.gradle you got from Spring initializr?
How are you writing stuff to the DB?
And how do you access it?
How are you calling them?
Did you try @Transactional?
(needs to be in the component for gclib to activate)
oh so you are using EntityManager directly?
ok so crain would hate me if I don't tell you that @Transactional in controllers is maybe a bit questionable (see https://canary.discord.com/channels/648956210850299986/1095004115169443850)
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
but I think it's fine for testing
it's a design thing
entityManager.flush() might do more harm than good for you
Why are you even using EntityManager directly anyways?
I guess it also doesn't work without EntityManager?
You said it looks like it's cached in memory
Did you try doing some write operation and then (in another request) a read operation with a complex SQL statement?
complex meaning not just findById/findAll/etc
could be a https://shouldiblamecaching.com/ situation
also it might be a questionable design decision to use the same class both as a DTO and DBO/DAO/whatever
but if you want to discuss design of Spring or enterprise applications, you might want to talk to crain
yeah ig I would try making a write query and reading it in some future request and see whether that's persisted
well I can't really find the issue without a reproducer
like I also need reproducer when reporting bugs in Spring lol
Did you try the thing with a complex read operation in a subsequent request?
and use Spring repositories for that - for both the request and response
another thing you could try is manually comitting with entityManager.getTransaction().commit()
though I don't think that should be necessary unless something is reconfigured
I feel like the symptoms you mentioned are not what happened
that option just automatically creates the schema (which can be questionable in itself since you might want to write the SQL by yourself)
sure it was create and not drop-and-create-tables or something like that?
but yeah there are options that delete everything
which is useful for testing/quickly getting something running
in production, you probably want to set it to validate or similar and create the DB using a custom SQL script (I personally use flyway)
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use/help ping.
Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use/help ping.
Warning: abusing this will result in moderative actions taken against you.
if you still have questions about that, you'd need to ask
Ah ok - I thought so because you reopened it
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use/help ping.
Warning: abusing this will result in moderative actions taken against you.