best way to insert JSON object into DB table?
hey guys. i want to construct a json in my java code and insert it into a DB table. can i just use json in a string and replace needed values?
9 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
what do you mean by replace here
can you please provide example here.
id have json in my resources:
and then id do this in my code:
and it would work fine. i did the same with xml and it works fine.
ok.
it would be better using a Entity for that i think.
iban, fromDate, toDate as attributes/table columns
Also response_id column as Primary key
we can call it response table.
And response id as foreign key in your main table.
but how can i use json as a string?
bc now i have json file in my resources folder
Deserialize into entity with jackson or smth, then use save with repository
Oh no no no no
That's just asking for security issues. Just make a DTO, fill it and send 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.