This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate: IllegalArgumentException while trying to save object with date type valiable. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: IllegalArgumentException while trying to save object with date type valiable." Watch "Hibernate: IllegalArgumentException while trying to save object with date type valiable." New topic
Author

Hibernate: IllegalArgumentException while trying to save object with date type valiable.

Deepak Kumar Jena
Ranch Hand

Joined: Sep 08, 2010
Posts: 68

JSP (User Reistration)

Form Bean (UserForm)


Service Layer (UserDTO)
A copy of Form Bean

Action Class (UserAction)

Service Class (UserDAO)

In backend (DB Table) the datatype of the dob is date.

hbm file
<property column="DOB" name="dob" type="date"/>

Exception:


While saving getting IllegalArgumentException. Kindly suggest.


dkj4jdk
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

I think it might be more helpful if you posted the entire stack trace.
Deepak Kumar Jena
Ranch Hand

Joined: Sep 08, 2010
Posts: 68

Updated post with Exception.
Ahsan Bagwan
Ranch Hand

Joined: Oct 05, 2010
Posts: 157
I'm just guessing so take my reply with a grain of salt.



Shouldn't the above property be changed to,



I am assuming the bean is also declared with java.util.Date
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

I suspect the problem is when using BeanUtils in your UserAction class, I don't think your DAO is being hit which rules out any Hibernate problem.

Can you debug the UserAction class around where you call copyProperties and check the state of your UserForm and UserDTO objects.
Deepak Kumar Jena
Ranch Hand

Joined: Sep 08, 2010
Posts: 68

Resolved the issue with the following modification in the source code.

Form Bean (UserForm)



hbm file

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: IllegalArgumentException while trying to save object with date type valiable.
 
Similar Threads
org.springframework.beans.NotReadablePropertyException
Getting error on calling method belongs to java class.
spring+hibernate: insert data into database(one to many)
Struts JDBC inserting data
Null pointer Exception when insert new record to database using struts2 and hibernate3