基于web的学生公寓管理系统的设计与实现毕业设计内容摘要:
ching object graphs efficiently (with minimal access to the database) has often been addressed by providing associationlevel fetching strategies specified in metadata of the association mapping. The trouble with this approach is that each piece of code that uses an entity requires a different set of associated objects. But this isn’t enough. We argue that what is needed is support for finegrained runtime association fetching strategies. Hibernate supports both, it lets you specify a default fetching strategy in the mapping file and then override it at runtime in code. Hibernate allows you to choose among four fetching strategies for any association, in association metadata and at runtime: ■ Immediate fetching—The associated object is fetched immediately, using a sequential database read (or cache lookup). ■ Lazy fetching—The associated object or collection is fetched “lazily,” when it’s first accessed. This results in a new request to the database (unless the associated object is cached). ■ Eager fetching—The associated object or collection is fetched together with the owning object, using an SQL outer join, and no further database request is required. ■ Batch fetching—This approach may be used to improve the performance of lazy fetching by retrieving a batch of objects or collections when a lazy association is accessed. (Batch fetching may also be used to improve the performance of immediate fetching.) Let’s look more closely at each fetching strategy. Immediate fetching Immediate association fetching occurs when you retrieve an entity from the database and then retrieve another associated entity or entities in a further request to the database or cache. Immediate fetching isn’t usually an efficient fetching strategy unless you expect the associated entities to almost always be cached already. Lazy fetching When a client requests an entity and its associated graph of objects from the database, it isn’t usually necessary to retrieve the whole graph of every (indirectly) associated object. You wouldn’t want to load the whole database into memory at once。 for example, loading a single Category shouldn’t trigger the loading of all Items in that category. Lazy fetching lets you decide how much of the object graph is loaded in the first database hit and which associations should be loaded only when they’re first accessed. Lazy fetching is a foundational concept in object persistence and the first step to attaining acceptable performance. We remend that, to start with, all associations be configured for lazy (or perhaps batched lazy) fetching in the mapping file. This strategy may then be overridden at runtime by queries that force eager fetching to occur. Eager (outer join) fetching Lazy association fetching can help reduce database load and is often a good default strategy. However, it’s a bit like a blind guess as far as performance optimization goes. Eager fetching lets you explicitly specify which associated objects should be loaded together with the referencing object. Hibernate can then return the associated objects in a single database request, utilizing an SQL OUTER JOIN. Performance optimization in Hibernate often involves judicious use of eager fetching for particular transactions. Hence, even though default eager fetching may be declared in the mapping file, it’s more mon to specify the use of this strategy at runtime for a particular HQL or criteria query. Batch fetching Batch fetching isn’t strictly an association fetching strategy。 it’s a technique that may help improve the performance of lazy (or immediate) fetching. Usually, when you load an object or collection, your SQL WHERE clause specifies the identifier of the object or object that owns the collection. If batch fetching is enabled, Hibernate looks to see what other proxied instances or uninitialized collections are referenced in the current session and tries to load them at the same time by specifying multiple identifier values in the WHERE clause. We aren’t great fans of this approach。 eager fetching is almost always faster. Batch fetching is useful for inexperienced users who wish to achieve acceptable performance in Hibernate without having to think too hard about the SQL that will be executed. (Note that batch fetching may be familiar to you, since it’s used by many EJB2 engines.) We’ll now declare the fetching strategy for some associations in our mapping metadata. Hibernate 的实践与应用 检索对象 从数据库中检索对象是使用 Hibernate最有趣(也是最复杂)的部分。 Hibernate 提供下列方式 从数据库中提取对象: 导航对象图,从一个已经装载的对象开始,通过像 ().getCity()的属性访问器方法访问相关的对象。 如果 Session是打开的,当你导航图时, Hibernate会自动装载图的节点。 当对象的唯一标识符值是已知的时候,通过标识符检索是最方便最有性能的方法。 使用 Hibernate查询语言( HQL),它是完全面向对象的查询语言。 使用 Hibernate 条件 API,它提供了类型安全的面向对象的方式执行查询而不需要操纵字符串。 这种便利性包括基于例子对象的查询。 使用本地 SQL查询,这种查询 Hibernate只关心把 JDBC 结果集映射到持久对象图。 在Hibernate 应用程序中,将结合使用这几种技术。 每一种检索方法可能使用不同的抓取策略— 那就是定义持久对象图的哪个部分应该检索的策略。 目标是在你的应用程序中为每个使用 场合发现最好的检索方法和抓取策略,同时最小化查询语句的数量以获得最好的性能。 在这一节我们不仔细讨论每个检索方法,相反,我 们将集中于基本的抓取策略和怎样调整Hibernate 映射文件以便对所有的方法达到最好的默认抓取性能。 在看抓取策略之前,我们将给出检索方法的概述。 (我们提到 Hibernate缓存系统但是将在下一章完全研究它。 )让我们开始最简单的例子,通过给定的标识符值检索对象(导航对象图不加以说明了)。 在这一章的前半部分你已经看过一个简单的通过标识符检索的例子,但是还有许多需要知道。 根据标识符检索对象 下面的 Hibernate 代码片断从数据库中检索 User对象: User user = (User) (, userID)。 get()方法很特别,因为标识符唯一地标识类的单个实例。 因此,应用程序通常使用标识符方便地处理持久对象。 当用标识符检索对象时可以使用缓存,如果对象已经缓存了可以避免数据库碰撞( hit)。 Hibernate也提供了 load()方法: User user = (User) (, userID)。 load()方法是旧的,因为用户的请求已经把 get()方法加入到 Hibernate API。 不同之处微不足道: 如果 load()方法不能在缓存或数据库中找到对象会抛出异常。 load()方法从不返回null。 如果对象没找到 get()方法返回 null。 load()方法返回代理而不是真正的持久实例。 代理是一个占位符,当第一次调用它时才装载真正的对象。 我们将在本节的后半部分讨论代理。 另一方面, get()方法从不返回代理。 在 get()和 load()之间选择很简单:如果你能确定持久实例存在,不存在将会认为是异常,那么 load()是很好的选择。 如果你不能确定给定的标识符是否有一个实例,使用 get()测试返回值,看它是否为 null。 使用 load()有更深的含义:应用程序可能检索一个对持久实例的引用(代理)而不会强制数据库检索它的持久状态。 因此,在缓存或数据库。基于web的学生公寓管理系统的设计与实现毕业设计
相关推荐
件。 清除之后,路由会持续输出很多命令行,且不会停止,我们不用管,关掉路由电源。 重新打开路由电源,和第四 步 一样,通电 3 秒内按下回车键阻止 CFE 继续启动打开浏览器,输入 ,应看到上传固件的的选择文件, putty 窗口也会出现路由器升级进度信息,此时千万不要断电,理论上此时断电会 刷坏路由器 ,升级完成后,耐心等待 5 分钟,路由器会自动重启。 等待路由启动后,等待几分钟再
32B 显示完就可以 LCD 上得到一个完整汉字。 图像显示原理:跟汉字一样,只不过它的宽和高不再是个定值,而是一个变量,把高先分成 8 的倍数,然后一行一行扫描,不足的补零。 5 2 软硬件介绍 Keil 简介单片机开发中除必要的硬件外,同样离不开软件,我们写的汇编语言源程序要变为 CPU 可以执行的机器码有两种方法,一种是手工汇编,另一种是机器汇编,目前已极少使用手工汇编的方法了。
访问程序存储器控制信号 EA 可用于外部程序存储器扩展,确定对 ROM 的读操作是针对哪个存储器的,当 EA 为高电平时,针对的是外部程序存储器,当 EA 为低电平时对 ROM 的读操作针对的是内部和外部程序存储器,并且从内部程序存储器开始读。 外部程序储存器读选通信号 PSEN 为读外部 ROM 时的使能端,高电平有效。 复位端 用于单片机的复位操作, 2 个机器周期以上持续高电平有效。
rivate Sub Command1_Click() End Sub ( 2) 、 “删除”按钮代码 Private Sub Command2_Click() End Sub ( 3) 、 “修改”按钮代码 Private Sub Command3_Click() End Sub 24 ( 4) 、 “确定”按钮代码 Private Sub Command4_Click() End Sub (
11 上超前主绕组通过的电流 90176。 ,这样在启动时就可得到一个较接近圆形的旋转磁场,从而有较大的启动转矩。 同样,当电动机转速达到额定转速的70%~ 80%时,离心开关 S 将辅助绕组从电源上自动断开,靠主绕组单独进入稳定的运行状态。 图 33 电流型启动继电器接线 图 34 单相电容启动电动机原理 (3) 单相电容运转异步电动机 图 35 单相电容运转电动机原理
并提供应用程序服务,它能够直接调用外部程序或脚本代码来访问数据库,因此可以提供与数据库相关的动态 HTML 页面,或执行用户查询,并将查询结果格式化成 HTML 页面,通过 Web 服务器返回给 Web 浏览器。 最基本的中间件技术有公共网关接口 CGI 和应用程序编程接口 API 两种。 Web 数据库技术采用三层或多层体系结构,前端采用基于瘦客 户机的浏览器技术,通过 Web