> fthomas <thomas.faze...@gmail.com> wrote in news:e01e47a3-23bc-4911-8bcc-
> 2c7b1f873...@72g2000hsu.googlegroups.com:
[quoted text clipped - 69 lines]
> Dunno if it has to be java.util.Date or java.sql.Date or
> java.sql.Timestamp...
Thanks the tip but unfortunately it doesn't help.
The basic problem still remains, namely Struts and Hibernate require
different types for the accessor methods.
After some thinking I've came to realize that my approach might be
wrong,
I shouldn't use the same class for the Struts ActionForm and for the
Hibernate persistence objects. It might work for simple classes where
all
the members are Strings but this is not the way to go for other types.
I'm not sure though, so I would really appreciate if somebody
with experience with both Hibernate and Struts would weigh in on this.
Thanks,
Thomas
Deepak Srivastava - 27 Feb 2008 16:44 GMT
Hi Thomas,
The issue you addressed is simply of type conversion,
I suggest you to take the appropriate type at JAVA end,
i.e.; declare the "birthDate" as of type TimeStamp in corresponding
JAVA bean, and there's no need to explicitly mention the type in
hibernate mapping file for any of the property,
as this ORM tool is smart enough to handle the conversion between Java
type and DB type.
And other thing is, you shouldn't try to use the form beans as
persistence objects,
as both the things are supposed to serve different purposes. You can't
use these two interchangeably.
Will discuss more next time, till then solve this issue.
Hope this answers your question.
--Deepak
Deepak Srivastava - 27 Feb 2008 16:46 GMT
Hi Thomas,
The issue you addressed is simply of type conversion,
I suggest you to take the appropriate type at JAVA end,
i.e.; declare the "birthDate" as of type TimeStamp in corresponding
JAVA bean, and there's no need to explicitly mention the type in
hibernate mapping file for any of the property,
as this ORM tool is smart enough to handle the conversion between Java
type and DB type.
And other thing is, you shouldn't try to use the form beans as
persistence objects,
as both the things are supposed to serve different purposes. You can't
use these two interchangeably.
Will discuss more next time, till then solve this issue.
Hope this answers your question.
--Deepak