求助!The method connection() is undefined for the type Session问题怎么解决?

解决Session中connection()未定义问题

代码部分如下:

		// 删除购物车中的所有选购记录(通过JDBC进行批量删除)
		Connection con = session.connection();
		Statement stat = con.createStatement();
		String sql = "delete from Cartselectedmer where cart=" + cartid;
		tx = session.beginTransaction();
		stat.executeUpdate(sql);
		tx.commit();
		if (stat != null)
			stat.close();
		status = true;
	} catch (Exception ex) {
		if (tx != null)
			tx.rollback();
		logger.info("在执行CartServiceImpl类中的clearCart方法时出错:\n");
		ex.printStackTrace();
	} finally {
		MySessionFactory.closeSession();
	}
	return status;
}

Description	Resource	Path	Location	Type

The method connection() is undefined for the type Session CartServiceImpl.java /Eshop/src/com/service line 186 Java Problem
遇到的错误,提示我connection()未定义,但是又找不到原因在哪,在线求助大佬!!!

内容由 AI 生成 clickable Avatar: undefined [root@hd-slave2 hive]# schematool -initSchema -dbType derby SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/local/src/hive/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/ impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/local/src/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7 .25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.chec kArgument(ZLjava/lang/String;Ljava/lang/Object;)V at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357) at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338) at org.apache.hadoop.mapred.JobConf.setJar(JobConf.java:518) at org.apache.hadoop.mapred.JobConf.setJarByClass(JobConf.java:536) at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:430) at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:5144) at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:5107) at org.apache.hive.beeline.HiveSchemaTool.<init>(HiveSchemaTool.java:96) at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1473) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
最新发布
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值