Hibernate与Oracle数据库连接

Hibernate和JPA的Dialect方言基础 在开发过程中,大多数开发者都会使用Hibernate或者JPA来处理持久层数据库访问。通过配置对应的数据库方言Dialect,可以很好地解决不同数据库之间的细节差异,让开发者更专注于业务逻辑的实现,而不用过多关注相关底层细节。这样一来,开发者可以更高效地完成项目开发,提高开发效率。Hibernate和JPA的使用,不仅简化了数据库访问的操作,还提供了更高的灵活性和可扩展性,使开发工作变得更加轻松和便捷。 阅读详情

          比较详细的hibernate与Oracle连接的小例子吧~     直接上代码。

1、首先需要的jar包列出来~

附上jar包和项目   有需要的小伙伴自行下载哦~

jar:https://pan.baidu.com/s/1UFpNF0AwC6_XRPDNvWQXRg

项目代码:https://pan.baidu.com/s/1JNKrqFi1nInzciLRDmtCBQ

2、目录结构也看一下吧~

3、先编写一个用户的实体类,给定属性和get,set方法。

package cn.com.entity;

public class User {
	private int uids;
	private String username;
	private String password;
	private String adress;
	public int getUids() {
		return uids;
	}
	public void setUids(int uids) {
		this.uids = uids;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getAdress() {
		return adress;
	}
	public void setAdress(String adress) {
		this.adress = adress;
	}
	

}

然后编写实体类的映射文件,一般命名规则是类名.hbm.xml。例如我这个叫User.hbm.xml。到这里感觉应该都能看懂吧~ 在xml里面也写了注释。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="cn.com.entity.User" table="h_user">
		<!-- 配置实体类id和表的字段对应 
			hibernate要求实体类有一个属性唯一值
			hibernate要求表有字段作为唯一值
		-->
		<!-- name属性:实体类里面id属性名称     column属性:生成的表字段名称 -->
		<id name="uids" column="uids">
			<!-- 设置数据库表id增长策略
				native:生成表主键值就是自动增长
			 -->
			<generator class="native"></generator>
		</id>
		<!-- 配置其他属性和表的字段对应 -->
		<property name="username" column="username"></property>
		<property name="password" column="password"></property>
		<property name="adress" column="adress"></property>
	</class>
</hibernate-mapping>

4、核心配置文件的编写,可以先写核心配置文件再写对应的实体类映射文件(数据库的配置不想写在这里的就写个jdbc.properties文件引进来哦~  这都不是关键^_^)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
	<session-factory>
            <!-- 加载数据库驱动 -->
		<property name="hibernate.connection.driver_class">
                    oracle.jdbc.driver.OracleDriver
                </property>
            <!-- 提供url,我的数据库安在本机就是localhost,如果不在本机就写上相应的ip地址 -->
	 	<property name="hibernate.connection.url">
                    jdbc:oracle:thin:@localhost:1521:orcl
                </property>
               <!-- 登录数据库时用的用户名和密码 -->
	 	<property name="hibernate.connection.username">用户名</property>
	 	<property name="hibernate.connection.password">密码</property>
	 	
	 	<!-- 第二部分配置hibernate信息(可选的) -->
		 <!-- 输出底层的sql语句 -->
		 <property name="hibernate.show_sql">true</property>
		 <!-- 对底层SQL语句进行格式化 -->
		 <property name="hibernate.format_sql">true</property>
		 <!-- hibernate配置之后自动创建表
		 	  update:如果已经有表了就更新,如果没有表就创建,不加这个就不会自动创建表
		  -->
		 <property name="hibernate.hbm2ddl.auto">update</property>
		 <!-- 配置数据库方言,11g也是这么配,不影响使用 -->
		 <property name="hibernate.dialect">
             org.hibernate.dialect.Oracle10gDialect
         </property>
		  <!-- 第三部分把实体类映射文件放到核心配置文件中去  必须做的 -->
		 <mapping resource="cn/com/entity/User.hbm.xml"/>
	</session-factory>
</hibernate-configuration>

5、到这里我们的hibernate就算是已经配置完成了,是不是很简单呢~,下一步就是编写测试类啦~

这个是我编写的一个工具类,用来获得sessionFactory,可以写也可以不写,看个人喜好。

package cn.com.utils;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtils {
	static Configuration cfg = null;
	static SessionFactory sessionFactory = null;
	//静态代码块实现 只用一个sessionFactory
	static {
		//加载核心配置文件
		cfg = new Configuration();
		cfg.configure();
		sessionFactory = cfg.buildSessionFactory();
	}
	//提供方法返回sessionfactory
	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	
	public static void main(String[] args) {
		
	}

}

然后是编写测试的HibernateTest类

package cn.com.test;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.Test;

import cn.com.entity.User;
import cn.com.utils.HibernateUtils;

public class HibernateTest {
	@Test
	public void testAdd() {
		//加载配置文件  与上面工具类的作用相同
//		Configuration cfg = new Configuration();
//		cfg.configure();
//		SessionFactory sessionFactory = cfg.buildSessionFactory();
		
                //利用工具类获得sessionFactory对象
                SessionFactory sessionFactory = HibernateUtils.getSessionFactory();
                //得到Session对象
		Session session = sessionFactory.openSession();
		Transaction tx = session.beginTransaction();
		
		User user = new User();
		user.setUsername("举个栗子");
		user.setPassword("123456");
		user.setAdress("localhost");
		session.save(user);
		
		tx.commit();
		session.close();
		sessionFactory.close();
	}
}

好啦~   到这里就完美收工啦! 右击runAs测试类看看你的数据库里是不是多了张表吧~     有什么问题欢迎私信哦~

使用Hibernate在Oracle数据库中生成表时遇到的问题及解决方法 在使用Hibernate与Oracle数据库进行交互时,生成表不正确的问题可以通过指定适用于Oracle数据库的方言来解决。通过配置文件指定方言需要修改Hibernate配置文件中与方言相关的配置项的值。这可能是由于Hibernate默认使用的数据库方言不适用于Oracle数据库,导致生成的表结构与预期不符。要解决这个问题,我们需要告诉Hibernate使用适用于Oracle数据库的方言。希望本文提供的解决方法能帮助你解决在Oracle数据库中使用Hibernate生成表不正确的问题。 阅读详情

相关推荐

Allegro File菜单实战指南:从导入网表到导出BOM的完整流程

PCB设计离不开对EDA软件菜单体系的深入理解。在Cadence Allegro中,File菜单是数据流转的中枢,它不仅是新建、打开、保存的基础入口,更是连接原理图与版图、设计与制造的关键桥梁。工程师常遇到的“导入网表报错”“导出BOM为空”“板框不闭合”等高频问题,大多源于对File菜单中Import与Export功能的理解不到位。从基础概念出发,先厘清Import(网表、DXF、IPC)与Export(BOM、ODB++、DXF)的工作原理,再结合版本兼容、封装库路径、单位设置等工程细节,即可构建完整的

weixin_32950759的博客 310

Hibernate 3.6.5 SQL 方言(hibernate.dialect)

RDBMS Dialect DB2 org.hibernate.dialect.DB2Dialect DB2 AS/400 org.hibernate.dialect.DB2400Dialect DB2 OS390 org.hibernate.dialect.DB2390Dialect PostgreSQL org.hib...

jbutton的专栏 1405

camera 知识速查

本文总结了Camera开发中的常见问题排查方法和关键技术点。主要内容包括:I2C/MIPI不通的排查步骤、时序问题分析方法、Sensor/AF/Flash/PDAF的Bring Up流程、OTP调试方法、PDAF原理及调试、CTS/ITS问题解决思路、AE震荡解决方案、Systrace性能分析方法、Flicker产生原理、Tombstone问题定位等。还涉及V4L2框架解析、问题定位分层方法、Sensor Setting注意事项、时钟信号概念、第三方应用卡顿排查、大光圈概念、Monkey测试方法。

qq_41665131的博客 787

hibernate 链接oracle数据库 笔记

持久化概念: 数据从内存到硬盘进行永久保存   持久层框架: mybaits(ibaits),hibernate mybaits对数据的操作对应的表和表的列(insert,update,delete,select) hibernate对应的是实体(添加:save(),删除delete(),更新:update(), 查询:get(),load()) Entity hibernate

qq_19816777的博客 357

PostgreSQL+PostGIS空间数据入库实战:从矢量栅格到GeoServer发布全流程

本文详细介绍了将矢量与栅格空间数据导入PostgreSQL并利用PostGIS扩展进行管理的完整流程。内容涵盖环境搭建、使用shp2pgsql和raster2pgsql工具进行数据入库、基础空间查询验证,以及最终通过GeoServer发布为地图服务的实战步骤,为构建空间数据平台提供清晰指引。

weixin_29268267的博客 295

华为/H3C/锐捷交换机配置命令对比表:一张图搞定VLAN划分与端口设置

本文详细对比了华为、H3C、锐捷三大品牌交换机在VLAN划分与端口设置中的配置命令差异,提供从基础配置到高级功能的横向对比表,帮助网络工程师快速掌握多品牌设备混用环境下的配置技巧,提升工作效率。

rust6ferris的博客 711

Hibernate的org.hibernate.dialect.Oracle9Dialect错误

新学Hibernate,连接mySQL一切正常,连接oracle时出错提示: 2012-09-05 11:02:17,055 WARN [org.hibernate.dialect.Oracle9Dialect] - The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10

1万+

LabVIEW与三菱PLC通讯实战:ActiveX控件在FX5U上的应用技巧

本文深入探讨了如何利用三菱MX Component中的ActiveX控件,在LabVIEW中实现与FX5U系列PLC的高效、稳定通讯。文章从环境配置、ActiveX控件生命周期管理、数据读写性能优化及容错机制等实战角度,分享了构建工业级健壮通讯程序的核心技巧与架构设计思路。

qsc9012345的博客 897

连接Oracle数据库的Hibernate配置…

连接Oracle数据库的Hibernate配置文件 连接Oracle的Hibernate配置文件有两种格式,一种是xml格式的,另一种是Java属性文件格式的。下面分别给出这两种格式配置文件的代码。 1.xml格式的配置文件 下面将给出连接本地Oracle服务器上的db_database02数据库时Hibernate配置文件hibernate.cfg.xml的代码。 例程2-5:光盘/mr

专注大规模数据处理 1277

一步步带你用C#开发Modbus通信上位机(附完整代码与工程思路)

Modbus上位机开发指南(C#实现) 本文详细介绍使用C#开发Modbus上位机系统的全过程,覆盖RTU和TCP两种协议。内容包含:1)需求分析与技术选型(WinForms+NModbus4);2)分层架构设计(UI/业务/通信层);3)通信层核心代码实现(串口/以太网连接、数据读写);4)功能模块开发(设备管理、数据采集、远程控制)。提供可直接复用的Modbus RTU客户端代码示例,包含连接管理、线圈读写、寄存器操作等工业场景必备功能。通过系统化的开发流程,帮助开发者快速构建稳定可靠的Modbus监控

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 831

基于FPGA的UDP 通信(一)

手头的FPGA开发板上有一个千兆网口,最近准备做一下以太网通信的内容。本文先介绍基本的理论知识。 FPGA芯片型号:xc7a35tfgg484-2 网口芯片:RTL8211 网络接口:RJ45

记录所学,分享知识,结识挚友 8364

连接Oracle数据库的Hibernate配置文件

连接Oracle数据库的Hibernate配置文件连接Oracle的Hibernate配置文件有两种格式,一种是xml格式的,另一种是Java属性文件格式的。下面分别给出这两种格式配置文件的代码。1.xml格式的配置文件下面将给出连接本地Oracle服务器上的db_database02数据库时Hibernate配置文件hibernate.cfg.xml的代码。例程2-5:光盘/mr/02/

xrt95050的专栏 4万+

ARM6818嵌入式视频播放器:硬解加速与Framebuffer渲染实战

嵌入式Linux音视频系统是智能座舱、工业HMI等场景的核心能力,其本质是软硬协同的实时多媒体处理系统。原理上需打通内核驱动(如VPU硬件编解码、FIMD多图层合成)、用户空间框架(GStreamer pipeline定制、SDL2硬件渲染)与应用层同步机制(PTS/HTS双时钟校准)。技术价值在于显著降低CPU负载(硬解可压至15%以下)、提升启动速度(<1.2s首帧)并保障音画同步精度(±3ms级)。典型应用场景包括车载信息娱乐、边缘AI终端及无X11的工控显示设备。本文基于ARM6818平台,深入VP

weixin_32456485的博客 81

Hibernate连接oracle数据库的简单例子

Hibernate连接oracle数据库的简单例子 一、Hibernate连接数据库 由于最近学习hibernate时,与oracle数据库发生交互时总是出错!网上关于如何详细hibernate连接数据库的例子也不多,所以在这里写一写例子,以供交流和总结! 二、配置Hibernate开发环境 本人进行Hibernate学习时是使用MyEclipse2014,一切的Hiberna

捡垃圾的人的随笔 3232

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Hibernate连接oracle数据库的配置文件

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> oracle.jdbc.driver.OracleDriver jdbc:

IT of Myeye 997

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Hibernate与Oracle数据库的连接

hibernate环境下载好后,需要与数据库进行配置。 第一,将hibernate所使用的相关jar包导入: 1.\lib\required中的全部jar包 2.连接数据库所用的驱动jar包:\db_1\jdbc\lib\ojdbc14.jar 第二,导入log4.properties,以及hibernate.cfg.xml(在\project\etc中 )配置hi

拉格朗日的忧桑 2342

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

通过hibernate配置连接oracle数据库

之前使用的是MySQL数据库,现在准备迁移到Oracle。 记录一下项目所使用的数据库配置 hibernate.cfg.xml <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernat

deCoin的专栏 1123

hibernate连接oracle数据库注意事项

1.     导入oracle-jar包(在oracle安装目录中找到jar包,推荐ojdbc14.jar)     2.     hibernate中修改配置文件,注意端口号为1521 Hibernate配置文件 --> hibernate-configuration>     session-factory>        数据库驱动 -->        p

Java面试辅导-海龟老师 2687

oracle dlink查询 提交,hibernate连接oracle数据库进行查询

按主键查询dao层public Emp get(Serializable id){//通过session的get方法根据加载指定对象return (Emp)HibernateUtil.currentSession().get(Emp.class,id);}service层public Emp findEmpById(Integer id){Transaction tx=null;Emp resul...

weixin_39531780的博客 225
上一篇: 任意正整数转十六进制
下一篇: 重写equals()和hashcode()方法笔记
Grace_QC
博客等级 码龄8年 1粉丝 3原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值