TemporalType.Date在Oracle中节省时间

时间:2015-12-15 16:46:07

标签: oracle hibernate jpa jboss jboss7.x

我在使用JPA的TemporalType.Date时出现问题。它似乎也在保存Time值,并在应用程序中选择值时从数据库中选择它。这特别在Oracle DB中

我正在使用Hibernate版本4.2.20.Final-redhat-1。 Oracle版本是11.2.0.3.0 JBoss版本6.4.3.GA 模块包括:jboss-as-jpa-hibernate4-7.5.3.Final-redhat-2和jboss-as-jpa-hibernate3-7.5.3.Final-redhat-2 Oracle驱动程序:12.1.0.2.0

数据库配置:

使用SELECT:

select * from nls_database_parameters;
select * from nls_instance_parameters;
select * from nls_session_parameters;

配置:

PARAMETER                      VALUE                                  
------------------------------ ----------------------------------------
NLS_LANGUAGE                   AMERICAN                                 
NLS_TERRITORY                  AMERICA                                  
NLS_CURRENCY                   $                                        
NLS_ISO_CURRENCY               AMERICA                                  
NLS_NUMERIC_CHARACTERS         .,                                       
NLS_CHARACTERSET               AL32UTF8                                 
NLS_CALENDAR                   GREGORIAN                                
NLS_DATE_FORMAT                DD-MON-RR                                
NLS_DATE_LANGUAGE              AMERICAN                                 
NLS_SORT                       BINARY                                   
NLS_TIME_FORMAT                HH.MI.SSXFF AM                           
NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM                 
NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR                       
NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR             
NLS_DUAL_CURRENCY              $                                        
NLS_COMP                       BINARY                                   
NLS_LENGTH_SEMANTICS           BYTE                                     
NLS_NCHAR_CONV_EXCP            FALSE                                    
NLS_NCHAR_CHARACTERSET         AL16UTF16                                
NLS_RDBMS_VERSION              11.2.0.3.0                               

 20 linhas selecionadas 

PARAMETER                      VALUE                                  
------------------------------ ----------------------------------------
NLS_LANGUAGE                   AMERICAN                                 
NLS_TERRITORY                  AMERICA                                  
NLS_SORT                                                                
NLS_DATE_LANGUAGE                                                       
NLS_DATE_FORMAT                                                         
NLS_CURRENCY                                                            
NLS_NUMERIC_CHARACTERS                                                  
NLS_ISO_CURRENCY                                                        
NLS_CALENDAR                                                            
NLS_TIME_FORMAT                                                         
NLS_TIMESTAMP_FORMAT                                                    
NLS_TIME_TZ_FORMAT                                                      
NLS_TIMESTAMP_TZ_FORMAT                                                 
NLS_DUAL_CURRENCY                                                       
NLS_COMP                       BINARY                                   
NLS_LENGTH_SEMANTICS           BYTE                                     
NLS_NCHAR_CONV_EXCP            FALSE                                    

 17 linhas selecionadas 

PARAMETER                      VALUE                                  
------------------------------ ----------------------------------------
NLS_LANGUAGE                   BRAZILIAN PORTUGUESE                     
NLS_TERRITORY                  BRAZIL                                   
NLS_CURRENCY                   R$                                       
NLS_ISO_CURRENCY               BRAZIL                                   
NLS_NUMERIC_CHARACTERS         ,.                                       
NLS_CALENDAR                   GREGORIAN                                
NLS_DATE_FORMAT                DD/MM/RR                                 
NLS_DATE_LANGUAGE              BRAZILIAN PORTUGUESE                     
NLS_SORT                       WEST_EUROPEAN                            
NLS_TIME_FORMAT                HH24:MI:SSXFF                            
NLS_TIMESTAMP_FORMAT           DD/MM/RR HH24:MI:SSXFF                   
NLS_TIME_TZ_FORMAT             HH24:MI:SSXFF TZR                        
NLS_TIMESTAMP_TZ_FORMAT        DD/MM/RR HH24:MI:SSXFF TZR               
NLS_DUAL_CURRENCY              Cr$                                      
NLS_COMP                       BINARY                                   
NLS_LENGTH_SEMANTICS           BYTE                                     
NLS_NCHAR_CONV_EXCP            FALSE                    

在MySQL和SQLServer中工作得很好,MySQL中的5.5 / 5.6和SQLServer中的2008/2012/2014。

拜托,我能得到的所有帮助都很珍贵= D

感谢。

1 个答案:

答案 0 :(得分:0)

似乎这个主题有答案:

http://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html

但是,如果数据库是Oracle 11g,问题也会出现,只需要使用驱动程序Oracle 12。

感谢您的帮助。