Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Store empty sting in db using JPA  RSS feed

 
Theodore David Williams
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an oracle db and one of my tables has a varchar. That field is "NOT NULL". I want to be able to store a blank string in the field as a blank string is not null. However when i try I get

Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL

I am using hibernate. Is hibernate converting blank strings to null?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Oracle is. In Oracle a blank string == null.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!