Hi:
i write some hibernate3 program,i write the date field to oralce of
windows2000 ad server,it work ok,but when i use the same code to oracle8.1.5 of
aix4.3,the hibernate3 tell me some error:datatype error!!!
here is my code:
hbm.xml
Code:
.....
<property name="yhbgabtime" column="YHBGABTIME" type="java.sql.Timestamp" not-null="true" />
.....
POJOs
Code:
/**
* Return the value of the YHBGABTIME column.
* @return java.util.Date
*/
public java.sql.Timestamp getYhbgabtime()
{
return this.yhbgabtime;
}
/**
* Set the value of the YHBGABTIME column.
* @param date
*/
public void setYhbgabtime(java.sql.Timestamp date)
{
this.yhbgabtime = date;
}
in my application java code:
Code:
....
Jbxx objJbxx = new objJbxx();
.....
ParsePosition pos = new ParsePosition(0);
SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date objTest = bartDateFormat.parse(sSendTime, pos);
java.sql.Timestamp dateTime = new java.sql.Timestamp(objTest.getTime());//Timestamp
objJbxx.setYhbgabtime(dateTime);
sesson.save(objJbxx);
.......
Maybe,this question is because of some oracle instance setting,
In My Oracle8.1.7 the code runs ok!(oracle8.1.7,32Bit,
windows2000ADserver)
here is some oracle instance parameter!
Code:
NLS_CALENDAR GREGORIAN
NLS_CHARACTERSET ZHS16GBK
NLS_COMP BINARY
NLS_CURRENCY $
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_DUAL_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_LANGUAGE AMERICAN
NLS_NCHAR_CHARACTERSET ZHS16GBK
NLS_NUMERIC_CHARACTERS .,
NLS_RDBMS_VERSION 8.1.7.0.0
NLS_SORT BINARY
NLS_TERRITORY AMERICA
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
here is some oracle instance parameter(oracle8.1.5 64bit,
Unix-->aix4.3)
Code:
NLS_CALENDAR GREGORIAN
NLS_CHARACTERSET ZHS16GBK
NLS_COMP
NLS_CURRENCY $
NLS_DATE_FORMAT DD-MON-LL
NLS_DATE_LANGUAGE AMERICAN
NLS_DUAL_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_LANGUAGE AMERICAN
NLS_NCHAR_CHARACTERSET ZHS16GBK
NLS_NUMERIC_CHARACTERS .,
NLS_RDBMS_VERSION 8.1.5.0.0
NLS_SORT BINARY
NLS_TERRITORY AMERICA
NLS_TIMESTAMP_FORMAT DD-MON-LL HH.MI.SSXFF AM
NLS_TIMESTAMP_TZ_FORMAT DD-MON-LL HH.MI.SSXFF AM TZH:T
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
i think the time or timestamp parameter of oracle is the main question!but after i adjust all parameter oracle of aix,the error still happen(hibernate3 tell me:datatype error)!!!
some one who can help me?
if i use date variable(not timestamp),the oracle of nt and the oracle of aix both run ok!but the date variable can not remember the hour,can not remember minute,can not remember second info!so the java.sql.timestamp is my only choose!
thanks for you help!