| Author |
Date Mapping
|
Yoo-Jin Lee
Ranch Hand
Joined: Nov 01, 2000
Posts: 119
|
|
Hi, In hibernate 3.0 is there a way to map a varchar (in database) to a java.util.Date for your DTO? The simplest solution I know is to add the following to your hbm.xml class and DTO: (1) private field with private getter/setter that hibernate will populate - the setter will convert the format for (2) (2) public field with public getter/setter that users will use Any other ideas? Thanks in advance. Yoo-Jin [ May 04, 2005: Message edited by: Yoo-Jin Lee ]
|
 |
Yoo-Jin Lee
Ranch Hand
Joined: Nov 01, 2000
Posts: 119
|
|
|
Ah just found UserType.... Excellent.
|
 |
Neerajplus Kumarplus
Greenhorn
Joined: May 05, 2005
Posts: 5
|
|
I'm not sure what's your requirement but I find UserType a heavy weight solution which should be used when hibernate doesn't support the data type natively. In your case, with my limited understanding of the problem, I would set the field as varchar and would define as "access" = "field". In this way you can have yout getValue() method that would return date field.
|
----------------------------------<br />Neeraj Kumar<br /><a href="http://www.neeraj.name" target="_blank" rel="nofollow">www.neeraj.name</a>
|
 |
Neerajplus Kumarplus
Greenhorn
Joined: May 05, 2005
Posts: 5
|
|
I'm not sure what's your requirement but I find UserType a heavy weight solution which should be used when hibernate doesn't support the data type natively. In your case, with my limited understanding of the problem, I would set the field as varchar and would define as "access" = "field". In this way you can have yout getValue() method that would return date field.
|
 |
 |
|
|
subject: Date Mapping
|
|
|