hibernate4中HHH000273的错误

今天配置hibernate4,发现报

17:55:06,815  INFO AbstractPoolBackedDataSource:522 - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge16q9a8u2d4lyv35wl|5a6efc31, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.driver.OracleDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge16q9a8u2d4lyv35wl|5a6efc31, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:oracle:thin:@192.168.1.229:1521:WDRPT, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 5, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
  17:55:07,741  WARN TypeInfo:126 - HHH000273: Error accessing type info result set : java.sql.SQLException: 数字溢出

数字溢出,搜了一下,都说映射文件错误了,我把所有配置的映射文件都去掉,还是报错,跟代码一下,是c3p0的获取meta的问题

public static LinkedHashSet<TypeInfo> extractTypeInfo(DatabaseMetaData metaData) {
		final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();
		try {
			final ResultSet resultSet = metaData.getTypeInfo();
			try {
				while ( resultSet.next() ) {
					typeInfoSet.add(
							new TypeInfo(
									resultSet.getString( "TYPE_NAME" ),
									resultSet.getInt( "DATA_TYPE" ),
									interpretCreateParams( resultSet.getString( "CREATE_PARAMS" ) ),
									resultSet.getBoolean( "UNSIGNED_ATTRIBUTE" ),
									resultSet.getInt( "PRECISION" ),//commend by danielinbiti,blob字段时,这个数字超出了int的范围,用long是能够获取的
									resultSet.getShort( "MINIMUM_SCALE" ),
									resultSet.getShort( "MAXIMUM_SCALE" ),
									resultSet.getBoolean( "FIXED_PREC_SCALE" ),
									resultSet.getString( "LITERAL_PREFIX" ),
									resultSet.getString( "LITERAL_SUFFIX" ),
									resultSet.getBoolean( "CASE_SENSITIVE" ),
									TypeSearchability.interpret( resultSet.getShort( "SEARCHABLE" ) ),
									TypeNullability.interpret( resultSet.getShort( "NULLABLE" ) )
							)
					);
				}
			}
			catch ( SQLException e ) {
				LOG.unableToAccessTypeInfoResultSet( resultSet.getString( "TYPE_NAME" )+","+resultSet.getInt( "DATA_TYPE" ) );
				LOG.unableToAccessTypeInfoResultSet( e.toString() );
			}
			finally {
				try {
					resultSet.close();
				}
				catch ( SQLException e ) {
					LOG.unableToReleaseTypeInfoResultSet();
				}
			}
		}
		catch ( SQLException e ) {
			LOG.unableToRetrieveTypeInfoResultSet( e.toString() );
		}

		return typeInfoSet;
	}

于是,修改了一下该类

public static LinkedHashSet<TypeInfo> extractTypeInfo(DatabaseMetaData metaData) {
		final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();
		try {
			final ResultSet resultSet = metaData.getTypeInfo();
			try {
				while ( resultSet.next() ) {
					long precision = resultSet.getLong( "PRECISION" );//add by danielinbiti
					int int_p = precision>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)precision;//add by danielinbiti,这么修改反正基于目前该方法的逻辑是没问题的。
					typeInfoSet.add(
							new TypeInfo(
									resultSet.getString( "TYPE_NAME" ),
									resultSet.getInt( "DATA_TYPE" ),
									interpretCreateParams( resultSet.getString( "CREATE_PARAMS" ) ),
									resultSet.getBoolean( "UNSIGNED_ATTRIBUTE" ),
									int_p,
									resultSet.getShort( "MINIMUM_SCALE" ),
									resultSet.getShort( "MAXIMUM_SCALE" ),
									resultSet.getBoolean( "FIXED_PREC_SCALE" ),
									resultSet.getString( "LITERAL_PREFIX" ),
									resultSet.getString( "LITERAL_SUFFIX" ),
									resultSet.getBoolean( "CASE_SENSITIVE" ),
									TypeSearchability.interpret( resultSet.getShort( "SEARCHABLE" ) ),
									TypeNullability.interpret( resultSet.getShort( "NULLABLE" ) )
							)
					);
				}
			}
			catch ( SQLException e ) {
				LOG.unableToAccessTypeInfoResultSet( e.toString() );
			}
			finally {
				try {
					resultSet.close();
				}
				catch ( SQLException e ) {
					LOG.unableToReleaseTypeInfoResultSet();
				}
			}
		}
		catch ( SQLException e ) {
			LOG.unableToRetrieveTypeInfoResultSet( e.toString() );
		}

		return typeInfoSet;
	}
时间: 2024-07-29 14:32:40

hibernate4中HHH000273的错误的相关文章

Spring中的一个错误:使用Resources时报错(The annotation @Resources is disallowed for this location)

在学习Spring的过程中遇到一个错误:在使用注解@resources的时候提示:The annotation @Resources is disallowed for this location 后来来在学问Java网友的时候解决了. 原来的代码是这样的: 1 package com.show.biz; 2 3 import javax.annotation.Resources; 4 5 import com.show.biz.UserBiz; 6 import com.show.dao.Us

findViewById中NullPointerException的错误

最近在弄一个对话框的登录时,发现一个总是报NullPointerException的错误,折腾了两小时,一直没有发现细小的区别..先上图,一边说明原因 首先是 Activity类中定义的findViewById() * There are two methods almost all subclasses of Activity will implement: * * <ul> * <li> {@link #onCreate} is where you initialize you

GDI+中发生一般性错误的解决办法(转载)

今天在开发.net引用程序中,需要System.Drawing.Image.Save 创建图片,debug的时候程序一切正常,可是发布到IIS后缺提示出现"GDI+中发生一般性错误"的异常.于是开始"摆渡",并寻找到了解决办法:赋予 NETWORK SERVICE 帐户以写权限. 以下为晚上寻找到的资料: 在开发.NET应用中,使用 System.Drawing.Image.Save 方法而导致"GDI+ 中发生一般性错误"的发生,通常有以下三种

nodejs出现events.js:72中抛出错误

作为初学者,我在使用nodejs的过程中遇到了如下的运行错误: events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:901:11) at Server._listen2 (net.js:1039:14) at listen (net.js:1061:10) at Server.listen (net.js:1127:5) at Object.<

Eclipse中Tocat运行错误

今天总结一下Eclipse中Tocat运行错误的处理办法: 1.选中service框中的tomcat,右键点击-->clear;之后再添加项目运行: 2.右键点击tomcat-->AddAndRemove-->将tomcat中的项目移除: 3.进入tomcat安装路径,将work里的缓存全部清空: 4.如果以上处理还不能解决,就是java编译时出现问题,可以检查一下Eclipse中的设置: Eclipse-->Project-->Buid AutoMatically选中该选项

[转]GDI+ 中发生一般性错误

在开发.NET应用中,使用 System.Drawing.Image.Save 方法而导致“GDI+ 中发生一般性错误”的发生,通常有以下三种原因:1. 相应的帐户没有写权限.解决方法:赋予 NETWORK SERVICE 帐户以写权限.2. 指定的物理路径不存在.解决方法:在调用 Save 方法之前,先判断目录是否存在,若不存在,则创建.if (!Directory.Exists(dirpath))Directory.CreateDirectory(dirpath);3. 保存的文件已存在并因

应用JSTL屏蔽页面中出现的错误,比如除数为0

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><%String path = request.getContextPath();String basePath = re

配置错误_“/”应用程序中的服务器错误。

配置错误 “/”应用程序中的服务器错误. 配置错误 说明: 在处理向该请求提供服务所需的配置文件时出错.请检查下面的特定错误详细信息并适当地修改配置文件. 分析器错误消息: 在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的.如果在 IIS 中没有将虚拟目录配置为应用程序,则可能导致此错误. 源错误: 行 20: </compilation> 行 21: 行 22: <authentication mode="

libxml2 在mingw中 xmlfree连接错误问题

libxml2 在mingw中 xmlfree连接错误问题 2013年10月02日 ⁄ 综合 ⁄ 共 1527字 ⁄ 字号 小 中 大 ⁄ 评论关闭 原地址:http://blog.csdn.net/hongqun/article/details/6009684 libxml2是一套非常好用的xml库,官网是http://www.libxml.org/,但是天知道是什么原因,此网页无法访问. 好不容易下载下来,在mingw中却问题多多. 第一个问题: 也就是说,编译通过了,但是在链接过程中找不到