Skip to content
This repository was archived by the owner on Jun 15, 2019. It is now read-only.

JSONB stores plain text #1

Open
cssatheesh opened this issue Oct 2, 2015 · 1 comment
Open

JSONB stores plain text #1

cssatheesh opened this issue Oct 2, 2015 · 1 comment

Comments

@cssatheesh
Copy link

Hi Pires,

I tried playing around with your hibernate-postgres-jsonb. I'm using Spring-JPA and I have a field like this.
@typedef(name = "jsonb", typeClass = JSONBUserType.class, parameters = {
@parameter(name = JSONBUserType.CLASS,
value = "java.lang.String")})
@entity
@table(name = "ENTITY")
class Entity{
@type(type = "jsonb")
private String label;
..
}
When I pass a json string as given below, it persists them.
entity.setLabel("{"label":"full name"}")

I was trying to test an invalid json and was expecting an error.
entity.setLabel("invalid json format");

But I see the above value getting persisted in label column in PostgreSQL db.I verified the datatype and the datatype is jsonb.

When I try Java jdbc standalone code to do the same, I get json validation error.
Do you have any idea?

@pires
Copy link
Owner

pires commented Oct 4, 2015

Can you provide with an example test/project I can test with?

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

No branches or pull requests

2 participants