Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA - Default value for non-nullable column

 
Richard Holland
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OpenJPA seems to be causing a defect with an exception to be thrown if the application tries to persist a null value into a non-nullable column that has a default value.

For example: The table ABC_LKP has a column APPLE VARCHAR2(1 BYTE) DEFAULT 'N' NOT NULL

OpenJPA errors out complaining �Cannot insert null into non nullable column�

Has anyone come across this issue and if so, what solution did you use?

Thank you
[ December 04, 2008: Message edited by: Richard Holland ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haven't worked on OpenJPA, but i think OpenJPA is trying to validate the values before firing the query to the DB (which would have set the default value). Not sure if it behaves the same in Hibernate.

How about trying this in the Entity code:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic