Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Deepak Kumar Jena
Ranch Hand
Posts: 68
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it might be more helpful if you posted the entire stack trace.
 
Deepak Kumar Jena
Ranch Hand
Posts: 68
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Updated post with Exception.
 
Ahsan Bagwan
Ranch Hand
Posts: 254
1
Java MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved the issue with the following modification in the source code.

Form Bean (UserForm)



hbm file

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic