• 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
Sheriff
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:
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!