1

I have one table which contains one column 'details' as jsonb data type. The content is

{
 "name": "username",
 "value": "user1",
 "is_required": true
} 

for one row. I want to write one jpa hibernate query in spring boot to fetch this record when name == username for details column.

Something like this:

select details->>'value' from table where details->>'name' = 'username';

This syntax does not work in spring boot hibernate query.

asked Mar 28, 2019 at 9:16
2

1 Answer 1

1

I got the answer. Use

@Query(value="select details->>'value' from table where details->>'name' = 'username'", nativeQuery=true)
answered Mar 28, 2019 at 10:28
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.