• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Spring + Hibernate

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the data type of the column?
 
Aravind M Jay
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post your DDL and data insertion code.
 
Aravind M Jay
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried even declaring the type but to no avail..
 
reply
    Bookmark Topic Watch Topic
  • New Topic