Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring + Hibernate

 
Aravind M Jay
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This error is a combination of Spring + Hibernate. I have a FK in one of the tables which can accept null. But when this field is left blank the data is not saved in the DB.

This is the error message from the logs -



Table Details -



Hibernate Mapping -



POJO <excerpt> -



Please let me know where am I going wrong.

Thanks,
MJ
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the data type of the column?
 
Aravind M Jay
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Datatype is Integer.
Tried an alternative -
Replaced <column> with <formula> but this always saves NULL in the DB even though a value is entered.
Please let me know your inputs.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your DDL and data insertion code.
 
Aravind M Jay
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Edvins Reisons
Ranch Hand
Posts: 364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aravind,

I would say that you need to IsolateTheProblem first; I am sure that this behavior can be reproduced without Spring, and without DAOs. The things that are needed, precise and complete, are the Java classes, hibernate mappings, and table definitions (the SQL "create table" statements).
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Did you try adding an type column saying it is integer like this,



Iam not sure. What Iam guessing is that, since you have not specified any type for the column mapping, may be it is trying to insert it as a String or something.
 
Aravind M Jay
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried even declaring the type but to no avail..
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic