Hibernate 使用详解
在现代的Java开发中,数据持久化是一个至关重要的环节。而在众多持久化框架中,Hibernate以其强大的功能和灵活性,成为了开发者们的首选工具。本文将详细介绍Hibernate的原理、实现过程以及其使用方法,希望能为广大开发者提供一些有价值的参考。
1. 什么是Hibernate
Hibernate是一个对象关系映射(ORM)框架,它将Java类与数据库表映射起来,从而实现数据持久化。Hibernate通过提供一种透明的持久化机制,使开发者可以通过面向对象的方式操作数据库,而无需编写大量的SQL代码。它支持多种数据库,并且能够根据需求自动生成SQL语句,大大简化了数据库操作的复杂性。
2. Hibernate的核心组件
要深入了解Hibernate,首先需要认识其核心组件:
- Configuration:配置Hibernate,加载Hibernate配置文件和映射文件,创建SessionFactory。
- SessionFactory:负责初始化Hibernate,创建Session对象。是线程安全的,可以被多个线程共享使用。
- Session:代表与数据库的一次会话,用于执行CRUD(增删改查)操作。Session不是线程安全的,每个线程应该有自己的Session实例。
- Transaction:用于管理事务。可以显式地开启、提交和回滚事务。
- Query:用于执行数据库查询,支持HQL(Hibernate Query Language)和原生SQL。
3. Hibernate的配置
在使用Hibernate之前,我们需要进行一些基本的配置。通常,Hibernate的配置文件有两种:hibernate.cfg.xml
和hibernate.properties
。下面我们来看看一个简单的hibernate.cfg.xml
示例:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration><session-factory><!-- JDBC Database connection settings --><property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property><property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydatabase</property><property name="hibernate.connection.username">root</property><property name="hibernate.connection.password">password</property><!-- JDBC connection pool settings --><property name="hibernate.c3p0.min_size">5</property><property name="hibernate.c3p0.max_size">20</property><property name="hibernate.c3p0.timeout">300</property><property name="hibernate.c3p0.max_statements">50</property><property name="hibernate.c3p0.idle_test_period">3000</property><!-- SQL dialect --><property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property><!-- Echo all executed SQL to stdout --><property name="hibernate.show_sql">true</property><!-- Drop and re-create the database schema on startup --><property name="hibernate.hbm2ddl.auto">update</property><!-- Names the annotated entity class --><mapping class="com.example.MyEntity"/></session-factory>
</hibernate-configuration>
在这个配置文件中,我们定义了数据库连接属性、连接池设置、SQL方言、SQL输出以及实体类的映射。通过这些配置,Hibernate可以自动管理数据库连接并生成相应的SQL语句。
4. 实体类映射
实体类是Hibernate进行对象关系映射的核心。每个实体类对应数据库中的一个表,每个类的属性对应表中的列。通过注解或XML配置,我们可以指定这些映射关系。以下是一个简单的实体类示例:
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;@Entity
public class MyEntity {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String name;private String description;// Getters and setterspublic Long getId() {return id;}public void setId(Long id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}
}
在这个示例中,我们使用了JPA注解来定义实体类的映射关系。@Entity
表示这是一个实体类,@Id
表示主键,@GeneratedValue
定义了主键的生成策略。此外,类中的属性会自动映射到对应的数据库列。
5. Hibernate的基本操作
5.1 保存实体
保存实体是将对象持久化到数据库中的过程。通过Session
对象,我们可以轻松地将实体保存到数据库中。下面是一个示例:
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;public class HibernateSaveExample {public static void main(String[] args) {// 创建SessionFactorySessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();// 获取SessionSession session = sessionFactory.openSession();// 开始事务session.beginTransaction();// 创建实体对象MyEntity myEntity = new MyEntity();myEntity.setName("Example Name");myEntity.setDescription("Example Description");// 保存实体session.save(myEntity);// 提交事务session.getTransaction().commit();// 关闭Sessionsession.close();}
}
在这个示例中,我们首先创建了一个SessionFactory
对象,然后通过SessionFactory
获取一个Session
对象。接着,开启事务,创建实体对象,并使用session.save
方法将实体保存到数据库中。最后,提交事务并关闭Session
。
5.2 查询实体
Hibernate提供了多种查询方式,包括HQL、Criteria API和原生SQL。下面我们以HQL为例,演示如何查询实体:
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;import java.util.List;public class HibernateQueryExample {public static void main(String[] args) {// 创建SessionFactorySessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();// 获取SessionSession session = sessionFactory.openSession();// 开始事务session.beginTransaction();// 执行HQL查询List<MyEntity> results = session.createQuery("from MyEntity", MyEntity.class).list();// 输出结果for (MyEntity entity : results) {System.out.println(entity.getName() + ": " + entity.getDescription());}// 提交事务session.getTransaction().commit();// 关闭Sessionsession.close();}
}
在这个示例中,我们使用session.createQuery
方法执行了一条简单的HQL查询,获取了所有MyEntity
对象,并打印出它们的名称和描述。
5.3 更新实体
更新实体是修改已存在的持久化对象。通过Session
对象,我们可以轻松地更新实体。下面是一个示例:
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;public class HibernateUpdateExample {public static void main(String[] args) {// 创建SessionFactorySessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();// 获取SessionSession session = sessionFactory.openSession();// 开始事务session.beginTransaction();// 获取实体对象MyEntity myEntity = session.get(MyEntity.class, 1L);if (myEntity != null) {// 更新实体属性myEntity.setDescription("Updated Description");// 更新实体session.update(myEntity);}// 提交事务session.getTransaction().commit();// 关闭Sessionsession.close();}
}
在这个示例中,我们首先通过session.get
方法获取一个持久化的MyEntity
对象,然后修改其属性,并使用session.update
方法将修改后的实体更新到数据库中。
5.4 删除实体
删除实体是从数据库中移除持久化对象的过程。通过Session
对象,我们可以轻松地删除实体。下面是一个示例:
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;public class HibernateDeleteExample {public static void main(String[] args) {// 创建SessionFactorySessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();// 获取SessionSession session = sessionFactory.openSession();// 开始事务session.beginTransaction();// 获取实体对象MyEntity myEntity = session.get(MyEntity.class, 1L);if (myEntity != null) {// 删除实体session.delete(myEntity);}// 提交事务session.getTransaction().commit();// 关闭Sessionsession.close();}
}
在这个示例中,我们首先通过session.get
方法获取一个持久化的MyEntity
对象,然后使用session.delete
方法将其从数据库中删除。
6. 事务管理
事务管理是保证数据一致性的关键。Hibernate提供了简单易用的事务管理接口。以下是一个示例:
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;public class HibernateTransactionExample {public static void main(String[] args) {// 创建SessionFactorySessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();// 获取SessionSession session = sessionFactory.openSession();Transaction transaction = null;try {// 开始事务transaction = session.beginTransaction();// 执行一些数据库操作MyEntity myEntity = new MyEntity();myEntity.setName("Transactional Name");myEntity.setDescription("Transactional Description");session.save(myEntity);// 提交事务transaction.commit();} catch (Exception e) {if (transaction != null) {// 回滚事务transaction.rollback();}e.printStackTrace();} finally {// 关闭Sessionsession.close();}}
}
在这个示例中,我们使用session.beginTransaction
方法开始事务,并在出现异常时回滚事务。这样可以确保在发生错误时,数据库不会处于不一致的状态。
7. 高级特性
7.1 一级缓存和二级缓存
Hibernate的缓存机制能够显著提高应用程序的性能。Hibernate提供了一级缓存和二级缓存:
- 一级缓存:是Session级别的缓存,在Session的生命周期内有效。每个Session都有自己的一级缓存。
- 二级缓存:是SessionFactory级别的缓存,可以被多个Session共享。常用的二级缓存实现有Ehcache、OSCache等。
7.2 延迟加载
延迟加载(Lazy Loading)是Hibernate的一个重要特性。它允许我们在需要时才加载实体的属性,从而提高性能。可以通过在实体类的属性上使用@Basic(fetch = FetchType.LAZY)
注解来实现延迟加载。例如:
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Basic;
import javax.persistence.FetchType;@Entity
public class MyEntity {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String name;@Basic(fetch = FetchType.LAZY)private String description;// Getters and setterspublic Long getId() {return id;}public void setId(Long id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}
}
在这个示例中,description
属性会在第一次访问时才被加载。
7.3 级联操作
级联操作允许我们在操作一个实体时,自动操作与之关联的其他实体。可以通过@OneToMany
、@ManyToOne
、@OneToOne
和@ManyToMany
注解的cascade
属性来实现。例如:
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.OneToMany;
import javax.persistence.CascadeType;
import java.util.Set;@Entity
public class MyEntity {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String name;@OneToMany(cascade = CascadeType.ALL)private Set<RelatedEntity> relatedEntities;// Getters and setterspublic Long getId() {return id;}public void setId(Long id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public Set<RelatedEntity> getRelatedEntities() {return relatedEntities;}public void setRelatedEntities(Set<RelatedEntity> relatedEntities) {this.relatedEntities = relatedEntities;}
}
在这个示例中,当我们保存或删除MyEntity
对象时,relatedEntities
集合中的所有RelatedEntity
对象也会被相应地保存或删除。
8. 实战演练:构建一个简单的博客系统
为了更好地理解Hibernate的使用,我们将通过一个简单的博客系统示例来演示其应用。
8.1 创建实体类
我们需要创建三个实体类:User
、Post
和Comment
。
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.OneToMany;
import java.util.Set;@Entity
public class User {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String username;private String password;@OneToMany(mappedBy = "user")private Set<Post> posts;// Getters and setters// ...
}@Entity
public class Post {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String title;private String content;@ManyToOneprivate User user;@OneToMany(mappedBy = "post", cascade = CascadeType.ALL)private Set<Comment> comments;// Getters and setters// ...
}@Entity
public class Comment {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String content;@ManyToOneprivate Post post;// Getters and setters// ...
}
8.2 配置Hibernate
我们需要在hibernate.cfg.xml
中配置这些实体类:
<hibernate-configuration><session-factory><!-- JDBC Database connection settings --><property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property><property name="hibernate.connection.url">jdbc:mysql://localhost:3306/blog</property><property name="hibernate.connection.username">root</property><property name="hibernate.connection.password">password</property><!-- JDBC connection pool settings --><property name="hibernate.c3p0.min_size">5</property><property name="hibernate.c3p0.max_size">20</property><property name="hibernate.c3p0.timeout">300</property><property name="hibernate.c3p0.max_statements">50</property><property name="hibernate.c3p0.idle_test_period">3000</property><!-- SQL dialect --><property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property><!-- Echo all executed SQL to stdout --><property name="hibernate.show_sql">true</property><!-- Drop and re-create the database schema on startup --><property name="hibernate.hbm2ddl.auto">update</property><!-- Names the annotated entity class --><mapping class="com.example.User"/><mapping class="com.example.Post"/><mapping class="com.example.Comment"/></session-factory>
</hibernate-configuration>
8.3 实现业务逻辑
我们将实现一些基本的业务逻辑,例如创建用户、发布文章和添加评论。
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;public class BlogApplication {private static SessionFactory sessionFactory;public static void main(String[] args) {// 初始化SessionFactorysessionFactory = new Configuration().configure().buildSessionFactory();// 创建用户User user = createUser("john_doe", "password123");// 发布文章Post post = createPost(user, "My First Post", "This is the content of my first post.");// 添加评论addComment(post, "Great post!");// 关闭SessionFactorysessionFactory.close();}public static User createUser(String username, String password) {Session session = sessionFactory.openSession();session.beginTransaction();User user = new User();user.setUsername(username);user.setPassword(password);session.save(user);session.getTransaction().commit();session.close();return user;}public static Post createPost(User user, String title, String content) {Session session = sessionFactory.openSession();session.beginTransaction();Post post = new Post();post.setTitle(title);post.setContent(content);post.setUser(user);session.save(post);session.getTransaction().commit();session.close();return post;}public static void addComment(Post post, String content) {Session session = sessionFactory.openSession();session.beginTransaction();Comment comment = new Comment();comment.setContent(content);comment.setPost(post);session.save(comment);session.getTransaction().commit();session.close();}
}
通过这个简单的博客系统示例,我们可以看到如何使用Hibernate进行基本的CRUD操作,以及如何处理实体之间的关系。
结语
Hibernate作为一个强大的ORM框架,通过提供透明的持久化机制,大大简化了Java开发者对数据库的操作。本文详细介绍了Hibernate的原理、配置、基本操作、高级特性以及一个实际的应用示例,希望能帮助读者更好地理解和使用Hibernate。在实际开发中,Hibernate不仅能提高开发效率,还能有效地管理数据的一致性和完整性,是Java开发者不可或缺的利器。
相关文章:
Hibernate 使用详解
在现代的Java开发中,数据持久化是一个至关重要的环节。而在众多持久化框架中,Hibernate以其强大的功能和灵活性,成为了开发者们的首选工具。本文将详细介绍Hibernate的原理、实现过程以及其使用方法,希望能为广大开发者提供一些有…...

乐普医疗校招社招笔试/测评通关攻略、最新北森题库、可搜索答案
乐普医疗为什么要做笔试/测评? 笔试/测评是乐普医疗校招社招招聘流程中的必经环节,只有完成笔试/测评,候选人才有机会进入面试流程,同学们收到笔试测评通知后请尽快完成。我们给部分岗位安排了笔试,笔试的成绩对于面试官来说是很重要的参考依据,请同学们在笔试过程…...

uniapp在线下载安装包更新app
首先用getSystemInfo判断平台、 再通过json文件模拟接口 判断版本号是否一致 不一致则下载服务器apk进行更新 外加网络波动导致失败重新下载更新包 uni.getSystemInfo({success: function (e) {// #ifndef H5// 获取手机系统版本const system e.system.toLowerCase();const pl…...

Unity | AmplifyShaderEditor插件基础(第一集:简单了解ASE和初识)
前言 我本来老老实实的写着我的Shader,群里的小伙伴强烈建议我开始讲ASE,我只能说,我是一个听话的Up。 一、什么是ASE 全称AmplifyShaderEditor,是一个unity插件,存在于unity商城中,售价看他们心情。&am…...
Windows文件资源管理器未响应,磁盘状态正常,很可能是这个原因
最近使用电脑,老感觉性能吃力,就想着自己把一些自动和延迟启动的服务给关掉一些,结果不小心把Work Folders给关闭了。于是,文件资源管理器能正常打开窗口,但是去点击磁盘或者去打开近期访问文件夹,它就会一…...
良好的代码习惯
虽然我们大家都知道这个道理,但能长期坚持下来的并不多。 在多年的项目开发过程中,遇到了各型各色的程序员,有技术一流的,有速度一流的,当然也有bug不断的,但真正能做到养成良好代码习惯并不多,…...

音乐生成模型应用
重磅推荐专栏: 《大模型AIGC》 《课程大纲》 《知识星球》 本专栏致力于探索和讨论当今最前沿的技术趋势和应用领域,包括但不限于ChatGPT和Stable Diffusion等。我们将深入研究大型模型的开发和应用,以及与之相关的人工智能生成内容(AIGC)技术。通过深入的技术解析和实践经…...
DBEUG:二维图尺寸没思路
问题 标注总是不对 解决 关注孔(螺纹 沉头 通孔 标注清楚)关注孔的定位(同心圆 靠边定位)0.02一定打开三维图 看装配关系过盈 还是 查公差表可以min max限制装配公差一定要有意义部分宽度变化大的加平行修改的rev改成1 方框1表…...

【图像去雾系列】使用SSR/MSR/MSRCR/MSRCP/automatedMSRCR算法对单图像进行图像增强,达到去雾效果
目录 一 图像去雾算法概述 二 SSR/MSR/MSRCR算法 三 实践 一 图像去雾算法概述 近些年来,出现了众多的单幅图像去雾算法,其主要可以分为 3 类:基于图像增强的去雾算法、基于图像复原的去雾算法和基于 CNN 的去雾算法。 ▲基于图像增强的去雾算法 通过图像增强技术突出图…...

oracle普通导出导入
原始的普通导出导入工具,是一个客户端工具。使用导出工具(export utility简称exp)是将数据从oracle数据库以二进制形式写入操作系统文件,这个文件存储在数据库之外,并且可以被另一个数据库使用导入工具(imp…...

如何将CSDN文章导出为pdf文件
第一步: 打开想要导出的页面,空白处点击鼠标右键⇒点击“检查”或“check”,或直接在页面按F12键。 第二步: 复制以下代码粘贴到控制台,并按回车。 若提示让输入“允许粘贴”或“allow pasting”,按提示…...
利用Python实现供应链管理中的线性规划与资源优化——手机生产计划1
目录 写在开头1. Python与线性规划的基础2.供应链管理中的资源优化3.利用Python进行供应链资源优化3.1 简单的优化实例3.2 考虑多种原材料3.3 多种原材料、交付时间与物流融合的情况 4.规范性分析在供应链管理中的应用价值写在最后 写在开头 在全球供应链日益复杂的背景下&…...
Spring Cloud全解析:配置中心之springCloudConfig分布式配置动态刷新
分布式配置动态刷新 当配置中心中的配置修改之后,客户端并不会进行动态的刷新,每次修改配置文件之后,都需要重启客户端,那么如何才能进行动态刷新呢 可以使用RefreshScope注解配合actuator端点进行手动刷新,不需要重…...
mac如何查看shell是 zsh还是bash
怎么确定mac使用的 shell类型 在终端中输入echo $0命令查看你所使用的 shell(默认使用的zsh) echo $0# 或者 echo $SHELL 如果是 bash 配置文件则为:~/.bash_profile 是 zsh,则配置文件为:~/.zshrc 如何更改默认 S…...

STM32cubeMX配置Systick的bug
STM32cubeMX版本:6.11.0 现象 STM32cubeMX配置Systick的时钟,不管选择不分频 还是8分频。 生成的代码都是一样的,代码都是不分频。 即不管选择不分频还是8分频,Systick都是使用的系统时钟 函数调用 HAL_Init() → HAL_Init…...
分享几个好用js片段
最近在做telegram小程序,所以又回归了web端了,发现几个好用又简洁的代码片段,在这里分享一下。 获取浏览器cookie值 const cookie name > ; ${document.cookie}.split(; ${name}).pop().split(;).shift();cookie(_ga); 2. 将RGB转换为1…...

web前端之实现一只可爱的小杰尼乌龟、伪元素、动画
MENU 前言效果图htmlstyle 前言 代码段使用HTML和CSS创建一个“杰尼龟”的动画。 效果图 html <div class"squirtle"><div class"tail"></div><div class"body"><div class"stomach"></div><d…...
银河麒麟服务器版在rc.local使用ifcong 配置IP和nmcli的区别
1、使用ifconfig配置IP ifconfig是一个传统的网络配置工具,它直接操作网络接口,允许用户手动设置IP地址、子网掩码等网络参数。这种方式比较直接,但需要用户对网络接口和配置有较深入的了解。使用ifconfig配置的IP地址在系统重…...

【运维】深入理解 Linux 中的 `mv` 命令,使用 `mv` 移动所有文件但排除特定文件或文件夹
文章目录 一、基本语法二、基本用法三、使用 `mv` 移动所有文件但排除特定文件或文件夹**命令解释:**四、其他常用选项五、总结深入理解 Linux 中的 mv 命令:移动文件和文件夹的艺术 在日常使用 Linux 的过程中,mv(move)命令是我们经常会用到的一个命令,它不仅可以用来移…...

Xilinx课程,就这么水灵灵地上线了~
如果你想了解: 如何利用精通流水线(Pipeline)技术,让电路设计效率倍增? 如何掌握利用性能基线指导设计流程的方法? 如何理解集成电路设计中的UltraFast Design Methodology Implementation设计方法学中的…...

【Axure高保真原型】引导弹窗
今天和大家中分享引导弹窗的原型模板,载入页面后,会显示引导弹窗,适用于引导用户使用页面,点击完成后,会显示下一个引导弹窗,直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…...
逻辑回归:给不确定性划界的分类大师
想象你是一名医生。面对患者的检查报告(肿瘤大小、血液指标),你需要做出一个**决定性判断**:恶性还是良性?这种“非黑即白”的抉择,正是**逻辑回归(Logistic Regression)** 的战场&a…...

循环冗余码校验CRC码 算法步骤+详细实例计算
通信过程:(白话解释) 我们将原始待发送的消息称为 M M M,依据发送接收消息双方约定的生成多项式 G ( x ) G(x) G(x)(意思就是 G ( x ) G(x) G(x) 是已知的)࿰…...
Qt Widget类解析与代码注释
#include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget) {ui->setupUi(this); }Widget::~Widget() {delete ui; }//解释这串代码,写上注释 当然可以!这段代码是 Qt …...
生成 Git SSH 证书
🔑 1. 生成 SSH 密钥对 在终端(Windows 使用 Git Bash,Mac/Linux 使用 Terminal)执行命令: ssh-keygen -t rsa -b 4096 -C "your_emailexample.com" 参数说明: -t rsa&#x…...
智能AI电话机器人系统的识别能力现状与发展水平
一、引言 随着人工智能技术的飞速发展,AI电话机器人系统已经从简单的自动应答工具演变为具备复杂交互能力的智能助手。这类系统结合了语音识别、自然语言处理、情感计算和机器学习等多项前沿技术,在客户服务、营销推广、信息查询等领域发挥着越来越重要…...

视觉slam十四讲实践部分记录——ch2、ch3
ch2 一、使用g++编译.cpp为可执行文件并运行(P30) g++ helloSLAM.cpp ./a.out运行 二、使用cmake编译 mkdir build cd build cmake .. makeCMakeCache.txt 文件仍然指向旧的目录。这表明在源代码目录中可能还存在旧的 CMakeCache.txt 文件,或者在构建过程中仍然引用了旧的路…...

RSS 2025|从说明书学习复杂机器人操作任务:NUS邵林团队提出全新机器人装配技能学习框架Manual2Skill
视觉语言模型(Vision-Language Models, VLMs),为真实环境中的机器人操作任务提供了极具潜力的解决方案。 尽管 VLMs 取得了显著进展,机器人仍难以胜任复杂的长时程任务(如家具装配),主要受限于人…...
NPOI Excel用OLE对象的形式插入文件附件以及插入图片
static void Main(string[] args) {XlsWithObjData();Console.WriteLine("输出完成"); }static void XlsWithObjData() {// 创建工作簿和单元格,只有HSSFWorkbook,XSSFWorkbook不可以HSSFWorkbook workbook new HSSFWorkbook();HSSFSheet sheet (HSSFSheet)workboo…...
根目录0xa0属性对应的Ntfs!_SCB中的FileObject是什么时候被建立的----NTFS源代码分析--重要
根目录0xa0属性对应的Ntfs!_SCB中的FileObject是什么时候被建立的 第一部分: 0: kd> g Breakpoint 9 hit Ntfs!ReadIndexBuffer: f7173886 55 push ebp 0: kd> kc # 00 Ntfs!ReadIndexBuffer 01 Ntfs!FindFirstIndexEntry 02 Ntfs!NtfsUpda…...