This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Spring + Hibernate

 
Greenhorn
Posts: 15
  • 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
 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • 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
  • 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.
 
Ranch Hand
Posts: 364
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Edvins Reisons
Ranch Hand
Posts: 364
  • 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: 662
Eclipse IDE Spring Java
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried even declaring the type but to no avail..
 
    Bookmark Topic Watch Topic
  • New Topic