hibernate中的一对多关联关系

Hibernate 单向多对一、单向一对多、双向一对多关联关系详解 一对多关系是最普遍的映射关系。比如部门和职工 一对多:从部门的角度,一个部门对应多个职工 多对一:从职工的角度,多个职工对应一个部门 数据库表中结构: 表 department:did departname 表 Employee:eid   ename   esex   did 工具类:SessionFactoryUtils .java,用来创建session工厂,后面的测试类的代码中 阅读详情

   在我的上一篇博客中已经写过那个多对一的关系了,其实在开发中我们把多对一从另一个角度来看就是一对多关联关系了,这个关系其实是对多对一的一中扩充,程序结构几乎没有什么变化,我们从“作者”的角度来看,“作者”和“文章”就是“一对多”。说到这里我们先来看一下这个比较常见的hibernate异常。如下所示:

java.lang.ExceptionInInitializerError
	at org.lxh.test.Test.save(Test.java:22)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.MappingException: Association references unmapped class: org.hibernate.test.annotations.Article
	at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2503)
	at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2782)

看他的根本原因,我们可以知道“Article”这个类没有被映射过去,也就是说“类全名”有问题。照着这个改就OK了。异常看过了,那么就开始来写程序吧

1.同样写2个vo类,代码如下所示

package org.lxh.vo;

import java.util.Set;

public class Author {
	private int id;
	private String name;
	private Set<Article> art;
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setArt(Set<Article> art) {
		this.art = art;
	}

	public Set<Article> getArt() {
		return art;
	}

	

	
}

在这里,所有的文章构成了一个set集合,也可以是list,这个无关紧要的,我个人觉得使用set比较方便

package org.lxh.vo;

public class Article {
	private int id;
	private String name;
	private Author author;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Author getAuthor() {
		return author;
	}

	public void setAuthor(Author author) {
		this.author = author;
	}

}

2.hibernate映射文件

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.test.annotations">

    <class name="org.lxh.vo.Author" table="author">

        <id name="id" column="id">
            <generator class="increment"/>
        </id>

        <property name="name" column="name"/>
        <set name="art">  <!-- 在一对多的关系中使用set集合这里写list也是OK的 -->
          <key column="author_id"/>   <!-- 让author的id和article里的author_id关联 -->
          <one-to-many class="org.lxh.vo.Article"/>  <!-- 这里的class是必须的
          没有的话java进行反射的时候就找不到这个类 -->
        </set>
    </class> 

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.test.annotations">

    <class name="org.lxh.vo.Article" table="article">

        <id name="id" column="id">
            <generator class="increment"/>
        </id>

        <property name="name" column="name"/>
       
        <many-to-one name="author" column="author_id"/>  <!-- 这里的author就是Article里的那个 -->
         
    </class> 

</hibernate-mapping>

从上面可以看出,配置文件没有太大变化。

3.写一个Junit来进行测试。

package org.lxh.test;


import java.util.Set;

import org.hibernate.Session;
import org.hibernate.Transaction;
import org.junit.BeforeClass;
import org.lxh.vo.Article;
import org.lxh.vo.Author;

import util.HibernateUtil;

public class Test {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}
    @org.junit.Test public void save(){
    	Session ses=null;
    	
    	Transaction tr=null;
    	try{
    		ses=HibernateUtil.getSession();
    		tr=ses.beginTransaction();
    		Author author=new Author();
    		author.setName("chenwill4");
    		
    		Article article1=new Article();
    		article1.setAuthor(author);  //建立2个对象的关联
    		article1.setName("老鹰抓小鸡3");
    		Article article2=new Article();
    		article2.setAuthor(author);  //建立2个对象的关联
    		article2.setName("老鹰抓小鸡3");
    		//author.setArt(article1);
    		
    		ses.save(author);  //将author信息保存
    		ses.save(article1);
    		ses.save(article2);
    		tr.commit();      //将事务提交,否侧数据不会被保存
    	}catch(Exception e){
    		e.printStackTrace();
    	}finally{
    		if(ses!=null){
    			ses.close();  //关闭连接,否则会把数据库卡死
    		}
    	}
    	
    }
    @org.junit.Test public void queryByAuthor(){
    	Session ses=null;
    	
    	Transaction tr=null;
    	try{
    		ses=HibernateUtil.getSession();
    		tr=ses.beginTransaction();
    		Article art=(Article)ses.get(Article.class, 2);
    		
    		
    		System.out.println("作者的姓名是:"+art.getAuthor().getName());  //通过文章查询作者
    		Author au=(Author)ses.get(Author.class, 1);
    		Set<Article> all=au.getArt();
    		System.out.println(all.size());
    		tr.commit();      //将事务提交
    	}catch(Exception e){
    		e.printStackTrace();
    	}finally{
    		if(ses!=null){
    			ses.close();  //关闭连接,否则会把数据库卡死
    		}
    	}
    	
    }
}

到这里程序就结束了,看一下运行截图吧








在我后续的文章中,我会接着把关联关系写完,有问题的告诉我,另外代码在我的资源里,有需要的可以自己去下载。


《Hibernate学习笔记九》:多对一和一对多的关联关系 《Hibernate学习笔记九》:多对一和一对多的单向关联关系前面介绍了一对一的关联关系在Hibernate应该如何来实现,这篇博文就来介绍下多对一和一对多的关联关系。多对一和一对多的关联关系在我们的生活中也比较常见,例如,在我们学生时代,一个班级可以有多个学生,而一个学生只能属于一个班级,这就是一个多对一(一对多)的例子;还有在我们的工作中,一个工作小组可以有多个用户,而一个用户只能属于一个小组, 阅读详情

相关推荐

霍尔编码器 vs 磁编码器:如何为你的电机控制项目选择最佳传感器(附实战对比)

本文深入对比了霍尔编码器和磁编码器在电机控制项目中的应用,从技术原理、性能参数、成本效益到实际场景选择提供了全面分析。通过实验室测试和项目案例,帮助工程师根据精度、环境抗性和预算选择最佳传感器方案,特别适合机器人、伺服驱动等领域的开发者参考。

weixin_28312391的博客 349

Hibernate关联关系

一、在hibernate中,包含的关联关系包括单向多对多,单向一对多,单向多对一,单向一对一,双向多对多,双向多对一,双向一对一 1、双向多对多       import java.io.Serializable; import java.util.Date; import java.util.Set; import javax.persistence.CascadeType; impor

xuxuchuan的博客 331

从SSD到UFS:3分钟搞懂存储技术进化史(含最新协议对比)

本文梳理了从SSD到UFS的存储技术演进历程,重点解析了eMMC与UFS在架构上的核心差异。UFS凭借高速串行全双工接口,实现了性能与能效的飞跃。文章还对比了最新的UFS 4.0与PCIe 5.0 SSD协议,并探讨了3D NAND、SLC缓存等底层技术,揭示了移动与PC存储技术融合的未来趋势。

weixin_29294597的博客 278

Hibernate中的关联关系

     初学 hibernate  时是被 hibernate 中的复杂的关系搞得晕头转向。 一对多 ,多对一,多对多。单向,双向等等 问题就出在,找不到参照方物,其实只要找准参照物,各种关系自然迎刃而解。在关系型数据库中 实际上通过主外键只支持多对一,或是一对一单向关联。1,多对一单向关联 : 以客户表 (customer) 和定单表(orders )为例。一个客户可以发出多个定单,而

Shine的专栏 1176

从零开始解析N-CMAPSS数据集:航空发动机健康管理的入门指南

本文详细解析了N-CMAPSS数据集在航空发动机健康管理中的应用,从数据集的构成、关键变量到实际数据分析方法,为初学者提供了全面的入门指南。通过Python代码示例,展示了如何加载、探索和建模这一复杂数据集,帮助读者掌握航空发动机性能预测的核心技术。

weixin_29063979的博客 319

【STM32G474实战】RS485通信的DMA优化策略与性能对比

本文深入探讨了在STM32G474微控制器上优化RS485通信的DMA策略。通过对比轮询、中断和DMA三种数据传输方式的代码实现与性能,揭示了DMA在解放CPU、降低占用率方面的巨大优势。文章提供了详细的DMA配置指南、高级应用技巧(如结合空闲中断)以及一个高可靠通信框架的实战思路,旨在帮助开发者构建高效、实时的工业控制系统。

weixin_29268331的博客 300

Hibernate入门第九讲——数据库中表与表之间的关系

Hibernate关联映射——对象的三种关系Hibernate框架基于ORM设计思想,它将关系型数据库中的表与我们java中的类进行映射,一个对象就对应着表中的一条记录,而表中的字段对应着类中的属性。数据库中表与表之间存在着三种关系,也就是系统设计中的三种实体关系。下面进行简单阐述。一对一创建表的原则有两种: 唯一外键对应 在任意一方添加一个外键来描述对应关系。如下图所示: 或者 主键对应

李阿昀的博客 6237

Cadence SKILL 语言实战指南:从函数列表到高效自动化脚本

本文是Cadence SKILL语言实战指南,旨在帮助芯片设计工程师从掌握核心函数列表出发,高效构建自动化脚本。文章详细解析了数据处理、数据库访问、流程控制及错误处理四类关键函数,并通过版图层批量修改与参数化单元生成两大实战场景,演示如何将函数组合成解决实际问题的自动化方案,从而显著提升Virtuoso环境下的工作效率。

beta5的博客 705

Hibernate关联关系配置(一对多、一对一和多对多)

Hibernate关联关系配置 第一种关联关系:一对多(多对一) "一对多"是最普遍的映射关系,简单来讲就如消费者与订单的关系。 一对多:从消费者角的度来说一个消费者可以有多个订单,即为一对多。 多对一:从订单的角度来说多个订单可以对应一个消费者,即为多对一。 一对多关系在hbm文件中的配置信息: 消费者(一方): <?xml version="1.0" e...

alva88888888的博客 384

飞凌OK3588-C Linux R4系统下MIPI YUV摄像头CSI尺寸错误排查与极性适配方案

本文详细介绍了在飞凌OK3588-C平台的Linux R4系统下调试MIPI YUV摄像头时遇到的'csi size err'错误排查与极性适配方案。通过分析信号极性、驱动参数调整及FPGA协同调试,提供了从硬件检测到系统级调试的完整解决方案,帮助开发者快速解决类似问题。

bean的博客 258

如何用SPSS做logistic回归

详细到只有作者本人能看懂的SPSS逻辑回归育儿经

qq_44794961的博客 2万+

Hibernate关联关系映射配置

1、配置多对一单向映射    //对 tab_people表进行配置,factory表不用配置 &lt;hibernate-mapping&gt;   &lt;class name="com.mr.people.People" table="tab_people"&gt;   &lt;!-- id值 --&gt;   &lt;id name="id" column="id&q

Carry_Jey 1001

黑猫带你学eMMC协议第33篇:eMMC CQE功能介绍——一种模仿UFS命令队列的发送机制

本文详细介绍了eMMC协议中的Command Queuing Engine (CQE)及其相关功能。CQE是eMMC 5.1版本引入的新特性,旨在通过硬件处理命令队列,简化软件代码的编写。文章首先介绍了CQE的基本概念,包括其与Host Controller Interface (HCI)的区别,以及CQE如何通过Task Descriptor List (TDL)管理任务。接着,文章详细描述了CQE如何发送命令和数据给eMMC,并解释了Task Descriptor和Transfer Descriptor

黑猫奥利奥的博客 980

Hibernate一对多关联关系

文章目录什么是关联关系Hibernate实现订单与订单项的一对多的增删改查标题 什么是关联关系 关联指的是类之间的引用关系。如果类A与类B关联,那么被引用的类B将被定义为类A的属性。 比如,B类作为A类的一个属性,那么就是B与A有关联关系 class B{ private String name; } public class A{ private B ...

阳某的博客 622

深度学习工具包 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")

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

Hibernate关联关系 之 一对多

Hibernate关联关系 之 一对多Hibernate关联关系Hibernate 一对多关联案例操作数据库实体类 entityxml 配置DemoDaoDemoDaoTestHibernate框架一对多的执行原理 Hibernate关联关系 什么是关联? (association) 关联指的是类之间的引用关系。 如果类A与类B关联,那么被引用的类B将被定义为类A的属性。 例如: class B...

qq_44641053的博客 346

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Hibernate关联关系一对多

Hibernate关联关系一对多什么是关联关系Hibernate实现订单与订单项的一对多的增删改查数据库实体类测试hibernate框架一对多的执行原理:懒加载 什么是关联关系 关联指的是类之间的引用关系。如果类A与类B关联,那么被引用的类B将被定义为类A的属性。 关联的分类:关联可以分为一对一、一对多/多对一、多对多关联 常见的订单与订单项就是典型的一对多 Hibernate实现订单与订单项的一...

qq_43514335的博客 456

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

hibernate之关联关系(一对多)

hibernate之关联关系(一对多)

weixin_43939301的博客 194

Hibernate一对多的关联关系

一、 什么是关联关系? a、关联指的是类之间的引用关系。 如果类A与类B关联,那么被引用的类B将被定义为类A的属性。 比如: class B{ private String name; } public class A{ private B b = new B; public A(){} } b、关联的分类:关联可以分为一对一、一...

byg 252

hibernate一对多的关联关系

一对多一对多why一对多的案例数据库中所需要的表工具类实体类与实体类的配置实体类实体类的配置把实体类的配置配置到核心配置文件中dao测试结果 一对多 why 1. 什么是关联(association) 1.1 关联指的是类之间的引用关系。如果类A与类B关联,那么被引用的类B将被定义为类A的属性。例如: public class A{ private B b = new B; public A(){} } 1.2 关联的分类:关联可以分为一对一、

TZyybhs的博客 197

hibernate关联关系一对多

1. 什么是关联(association)   1.1 关联指的是类之间的引用关系。如果类A与类B关联,那么被引用的类B将被定义为类A的属性。例如:       public class A{         private B b = new B;         public A(){}       }   1.2 关联的分类:关联可以分为一对一、一对多/多对一、多对多关联       关联是...

qq_41915592的博客 409

hibernate关联关系(一对多)

1. 什么是关联(association) 1.1 关联指的是类之间的引用关系。如果类A与类B关联,那么被引用的类B将被定义为类A的属性。 例如: t_hibernate_order t_hibernate_order_item 一个订单对应多个订单项 class Order{ private List<OrderItem> orderItems; } class OrderItem{ private Order order; } class B{ private String name; }

qiu_hyun的博客 180

Hibernate关联关系(一对多)

Hibernate的关联关系(一对多) 什么是关联关系(association)? 1.1 关联指的是类之间的引用关系。如果类A与类B关联,那么被引用的类B将被定义为类A的属性。 1.2 关联的分类:关联可以分为一对一、一对多/多对一、多对多关联 关联是有方向的 下面就以Order和OrderItem为例, order类 package com.tzp.three.entity; import ...

程 序 猿的博客 226
上一篇: hibernate中的多对一关联关系
下一篇: hiberbate的一对一关联关系
青蛙小王子
博客等级 码龄16年 239粉丝 311原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值