File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Spring + Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Spring + Hibernate" Watch "Spring + Hibernate" New topic
Author

Spring + Hibernate

Aravind M Jay
Greenhorn

Joined: Mar 16, 2006
Posts: 15
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

Joined: May 16, 2005
Posts: 508

what is the data type of the column?


If you are not laughing at yourself, then you just didn't get the joke.
Aravind M Jay
Greenhorn

Joined: Mar 16, 2006
Posts: 15
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

Joined: Dec 11, 2006
Posts: 364
Please post your DDL and data insertion code.
Aravind M Jay
Greenhorn

Joined: Mar 16, 2006
Posts: 15
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
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

Joined: May 16, 2005
Posts: 508



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

Joined: Mar 16, 2006
Posts: 15
I have tried even declaring the type but to no avail..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Spring + Hibernate
 
Similar Threads
Hibernate - Force foreign key lookup on insert
Could not synchronize database state with session
forum regarding insert data
Hibernate - Mapping foreign keys tables
Hibernate Bidirectional Mapping Problem.