2

I'm stuck with a weird programming problem. I've defined a schema where if no values are passed for a column (column name is Title) then a default value (Harry) will be used.

Title | character varying(64) | default 'Harry'::character varying

And, I'm trying to insert entries using hibernate through my java application.

What's happening is that hibernate is explicitly giving null value to that column in any query and thus the default value is not showing up in the table for those entries.

Just like to mention here that when I execute any insert sql query myself without passing any value for that column then I'm able to see the default value in the corresponding row !

So any pointer on how to handle this hibernate-postgres case ??

1

1 Answer 1

1

Got it.... using the annotation:

@org.hibernate.annotations.Entity(
        dynamicInsert = true
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.