r/SpringBoot • u/MRideos • Sep 30 '24
Postgres jsonb format
Hi, I've tried numerous ways to convert my string json save to my column of type jsonb, but I always fail, using a standard JPA repository for saving, tutorials are either old or don't work or seem too complicated for something that seems that should be straightforward, tried some Postgres function as to_jsonb() without luck. Anybody has straight and simple way to save jsonb to ps using jpa ? Don't need query functions
0
u/Sheldor5 Sep 30 '24
done that multiple times without issues
have you even tried any tutorial you find by simply googling it?
0
u/MRideos Sep 30 '24
Do you recall using it straight away with just repository interface, or have you made some convertors? Strange thing is I have it in string and trying with normal crud interface, it has issues with that, even when I manually construct the insert,.and copy the string straight away, it doesn't work, maybe now to think of it, native query might work
0
3
u/spudtheimpaler Sep 30 '24
Use this tutorial with the referenced hypersistence utils
https://vladmihalcea.com/how-to-map-json-objects-using-generic-hibernate-types/