2
votes

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
stackoverflow.com/questions/14703697/… Could you check this one I think you will get some clarification.Fahad Anjum

1 Answers

1
votes

Got it.... using the annotation:

@org.hibernate.annotations.Entity(
        dynamicInsert = true
)