-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Can't Correctly load Dates
PostPosted: Wed Oct 01, 2003 3:28 pm 
Beginner
Beginner

Joined: Thu Sep 04, 2003 11:02 am
Posts: 20
Location: Montevideo, Uruguay
Hi...

I have a project class with With 2 Calendar atributes.

publishdate and deadline.

I have mapped them like this:

<property name="publishDate">
<column name="PUBLISHDATE" sql-type="date" not-null="true"/>
</property>
<property name="deadline">
<column name="DEADLINE" sql-type="date" not-null="true"/>
</PROPERTY>
------------------

When I run my test code... the Dates are not showing correctly; although thrumg phpMyAdmin (and MySqlfront) I see they have been saved correctly into the Database.

Ideas? Or Similar problems?

Cheers
Mata

PS: Saveing as a Timestamp type turns the same output.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2003 9:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not enough information. Need java and sample main showing the output. In anycase, I always set the type (not always necessary) in the mapping, eg,
<property name="publishDate">
<column name="PUBLISHDATE" type="date" not-null="true"/>
</property>
as the sql-type is for ddl generation. This will generate an a java Date object.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 11:46 am 
Beginner
Beginner

Joined: Thu Sep 04, 2003 11:02 am
Posts: 20
Location: Montevideo, Uruguay
Hi,

Thanks for your reply.

Here are my testcode and output

TestData:
INSERT INTO projects VALUES("2c909994f7f9f18400f7f9f1b7300001", "Dumie Project", "Dumic Description content 2", "2c909994f7f3c04f00f7f3c17dd90001", "10 dias", "2003-10-01", "2003-12-12", "0");

INSERT INTO projects VALUES("2c909994f7fa0ffc00f7fa10083c0001", "Project Two", "Description content 3", "2c909994f7f3c04f00f7f3c5414a0005", "Short", "2003-10-01", "2003-10-12", "0");

INSERT INTO projects VALUES("2c909994f7fa23cd00f7fa23d8230001", "Project Two + two", "Description content 3", "2c909994f7f3c04f00f7f3c17dd90001", "Short", "2003-10-01", "2003-10-12", "0");

------------------------------------------
TestCode:
IProject proj;
ProjectProxy pp = ProxyPool.getProjectProxy();
List l = pp.getAllProjects();
List lattach;
for (int i = 0; i< l.size(); i++){
/* Some other Assertions */
System.out.println(proj.getDeadline());
System.out.println(proj.getPublishDate());

//Just to see how TODAY is displayed
System.out.println(new GregorianCalendar());
}

----------------------------------------------------------
Test Output:

java.util.GregorianCalendar[time=61029360000000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=3903,MONTH=11,WEEK_OF_YEAR=50,WEEK_OF_MONTH=2,DAY_OF_MONTH=12,DAY_OF_YEAR=346,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=0]

java.util.GregorianCalendar[time=1065050289000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2003,MONTH=9,WEEK_OF_YEAR=40,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=274,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=18,SECOND=9,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]

java.util.GregorianCalendar[time=1065123513671,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2003,MONTH=9,WEEK_OF_YEAR=40,WEEK_OF_MONTH=1,DAY_OF_MONTH=2,DAY_OF_YEAR=275,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=0,HOUR_OF_DAY=12,MINUTE=38,SECOND=33,MILLISECOND=671,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]



Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 8:18 pm 
Beginner
Beginner

Joined: Thu Sep 04, 2003 11:02 am
Posts: 20
Location: Montevideo, Uruguay
I have,somehow, solved the problem by defineing sql-type as Timestamp.

Hope It is of help to anybody.

And I[m open to explanations as to why it did not work with date.

-------


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.