⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tutorial.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 01:01+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: tutorial.xml:7#, no-c-formatmsgid "Introduction to Hibernate"msgstr "Hibernate入门"#. Tag: title#: tutorial.xml:10#, no-c-formatmsgid "Preface"msgstr "前言"#. Tag: para#: tutorial.xml:12#, no-c-formatmsgid """This chapter is an introductory tutorial for new users of Hibernate. We ""start with a simple command line application using an in-memory database and ""develop it in easy to understand steps."msgstr """本章是面向Hibernate初学者的一个入门教程。我们从一个使用驻留内存式(in-memory)""数据库的简单命令行应用程序开始, 用易于理解的方式逐步开发。"#. Tag: para#: tutorial.xml:18#, no-c-formatmsgid """This tutorial is intended for new users of Hibernate but requires Java and ""SQL knowledge. It is based on a tutorial by Michael Gloegl, the third-party ""libraries we name are for JDK 1.4 and 5.0. You might need others for JDK 1.3."msgstr """本章面向Hibernate初学者,但需要Java和SQL知识。它是在Michael Goegl所写的指南的""基础上完成的。在这里,我们称第三方库文件是指JDK 1.4和5.0。若使用JDK1.3,你可""能需要其它的库文件。"#. Tag: para#: tutorial.xml:24#, no-c-formatmsgid """The source code for the tutorial is included in the distribution in the ""<literal>doc/reference/tutorial/</literal> directory."msgstr """本章的源代码已包含在发布包中,位于<literal>doc/reference/tutorial/</literal>""目录下。"#. Tag: title#: tutorial.xml:32#, no-c-formatmsgid "Part 1 - The first Hibernate Application"msgstr "第一部分 - 第一个Hibernate应用程序"#. Tag: para#: tutorial.xml:34#, no-c-formatmsgid """First, we'll create a simple console-based Hibernate application. We use an ""Java database (HSQL DB), so we do not have to install any database server."msgstr """首先我们将创建一个简单的基于控制台的(console-based)Hibernate应用程序。由于我""们使用Java数据库(HSQL DB),所以不必安装任何数据库服务器。"#. Tag: para#: tutorial.xml:39#, no-c-formatmsgid """Let's assume we need a small database application that can store events we ""want to attend, and information about the hosts of these events."msgstr """假设我们希望有一个小应用程序可以保存我们希望参加的活动(events)和这些活动主""办方的相关信息。 (译者注:在本教程的后面部分,我们将直接使用event而不是它的""中文翻译“活动”,以免混淆。)"#. Tag: para#: tutorial.xml:44#, no-c-formatmsgid """The first thing we do, is set up our development directory and put all the ""Java libraries we need into it. Download the Hibernate distribution from the ""Hibernate website. Extract the package and place all required libraries ""found in <literal>/lib</literal> into into the <literal>/lib</literal> ""directory of your new development working directory. It should look like ""this:"msgstr """我们所做的第一件事就是创建我们的开发目录,并且把所有需要用到的Java库文件放进""去。解压缩从Hibernate网站下载的Hibernate发布包,并把<literal>/lib</literal>目""录下所有需要的库文件拷到我们新建开发目录下的<literal>/lib</literal>目录下。看""起来就像这样:"#. Tag: programlisting#: tutorial.xml:52#, no-c-formatmsgid """<![CDATA[.\n""+lib\n""  antlr.jar\n""  cglib.jar\n""  asm.jar\n""  asm-attrs.jars\n""  commons-collections.jar\n""  commons-logging.jar\n""  hibernate3.jar\n""  jta.jar\n""  dom4j.jar\n""  log4j.jar ]]>"msgstr ""#. Tag: para#: tutorial.xml:54#, no-c-formatmsgid """This is the minimum set of required libraries (note that we also copied ""hibernate3.jar, the main archive) for Hibernate <emphasis>at the time of ""writing</emphasis>. The Hibernate release you are using might require more ""or less libraries. See the <literal>README.txt</literal> file in the ""<literal>lib/</literal> directory of the Hibernate distribution for more ""information about required and optional third-party libraries. (Actually, ""Log4j is not required but preferred by many developers.)"msgstr """<emphasis>到编写本文时为止</emphasis>,这些是Hibernate运行所需要的最小库文件""集合(注意我们也拷贝了 Hibernate3.jar,这个是最主要的文件)。你正使用的""Hibernate版本可能需要比这更多或少一些的库文件。请参见发布包中的<literal>lib/""</literal>目录下的<literal>README.txt</literal>,以获取更多关于所需和可选的第""三方库文件信息(事实上,Log4j并不是必须的库文件,但被许多开发者所喜欢)。"#. Tag: para#: tutorial.xml:63#, no-c-formatmsgid """Next we create a class that represents the event we want to store in ""database."msgstr "接下来我们创建一个类,用来代表那些我们希望储存在数据库里的event。"#. Tag: title#: tutorial.xml:68#, no-c-formatmsgid "The first class"msgstr "第一个class"#. Tag: para#: tutorial.xml:70#, no-c-formatmsgid """Our first persistent class is a simple JavaBean class with some properties:"msgstr "我们的第一个持久化类是一个带有一些属性(property)的简单JavaBean类:"#. Tag: programlisting#: tutorial.xml:74#, no-c-formatmsgid """<![CDATA[package events;\n""\n""import java.util.Date;\n""\n""public class Event {\n""    private Long id;\n""\n""    private String title;\n""    private Date date;\n""\n""    public Event() {}\n""\n""    public Long getId() {\n""        return id;\n""    }\n""\n""    private void setId(Long id) {\n""        this.id = id;\n""    }\n""\n""    public Date getDate() {\n""        return date;\n""    }\n""\n""    public void setDate(Date date) {\n""        this.date = date;\n""    }\n""\n""    public String getTitle() {\n""        return title;\n""    }\n""\n""    public void setTitle(String title) {\n""        this.title = title;\n""    }\n""}]]>"msgstr ""#. Tag: para#: tutorial.xml:76#, no-c-formatmsgid """You can see that this class uses standard JavaBean naming conventions for ""property getter and setter methods, as well as private visibility for the ""fields. This is a recommended design - but not required. Hibernate can also ""access fields directly, the benefit of accessor methods is robustness for ""refactoring. The no-argument constructor is required to instantiate an ""object of this class through reflection."msgstr """你可以看到这个类对属性的存取方法(getter and setter method)使用了标准""JavaBean命名约定,同时把类属性(field)的访问级别设成私有的(private)。这是""推荐的设计,但并不是必须的。Hibernate也可以直接访问这些field,而使用访问方法""(accessor method)的好处是提供了重构时的健壮性(robustness)。为了通过反射机""制(Reflection)来实例化这个类的对象,我们需要提供一个无参的构造器(no-""argument constructor)。"#. Tag: para#: tutorial.xml:84#, no-c-formatmsgid """The <literal>id</literal> property holds a unique identifier value for a ""particular event. All persistent entity classes (there are less important ""dependent classes as well) will need such an identifier property if we want ""to use the full feature set of Hibernate. In fact, most applications (esp. ""web applications) need to distinguish objects by identifier, so you should ""consider this a feature rather than a limitation. However, we usually don't ""manipulate the identity of an object, hence the setter method should be ""private. Only Hibernate will assign identifiers when an object is saved. You ""can see that Hibernate can access public, private, and protected accessor ""methods, as well as (public, private, protected) fields directly. The choice ""is up to you and you can match it to fit your application design."msgstr """对一特定的event, <literal>id</literal> 属性持有唯一的标识符(identifier)的""值。如果我们希望使用Hibernate提供的所有特性,那么所有的持久化实体""(persistent entity)类(这里也包括一些次要依赖类)都需要一个这样的标识符属""性。而事实上,大多数应用程序(特别是web应用程序)都需要通过标识符来区别对象,""所以你应该考虑使用标识符属性而不是把它当作一种限制。然而,我们通常不会操作对""象的标识(identity),因此它的setter方法的访问级别应该声明private。这样当对象""被保存的时候,只有Hibernate可以为它分配标识符值。你可看到Hibernate可以直接访""问public,private和protected的访问方法和field。所以选择哪种方式完全取决于你,""你可以使你的选择与你的应用程序设计相吻合。"#. Tag: para#: tutorial.xml:96#, no-c-formatmsgid """The no-argument constructor is a requirement for all persistent classes; ""Hibernate has to create objects for you, using Java Reflection. The ""constructor can be private, however, package visibility is required for ""runtime proxy generation and efficient data retrieval without bytecode ""instrumentation."msgstr """所有的持久化类(persistent classes)都要求有无参的构造器,因为Hibernate必须使""用Java反射机制来为你创建对象。构造器(constructor)的访问级别可以是private,""然而当生成运行时代理(runtime proxy)的时候则要求使用至少是package 级别的访问""控制,这样在没有字节码指令(bytecode instrumentation)的情况下,从持久化类里""获取数据会更有效率。"#. Tag: para#: tutorial.xml:103#, no-c-formatmsgid """Place this Java source file in a directory called <literal>src</literal> in ""the development folder, and in its correct package. The directory should now ""look like this:"msgstr """把这个Java源代码文件放到开发目录下的<literal>src</literal>目录里,注意包位置""要正确。 现在这个目录看起来应该像这样:"#. Tag: programlisting#: tutorial.xml:108#, no-c-formatmsgid """<![CDATA[.\n""+lib\n""  <Hibernate and third-party libraries>\n""+src\n""  +events\n""    Event.java]]>"msgstr ""#. Tag: para#: tutorial.xml:110#, no-c-formatmsgid "In the next step, we tell Hibernate about this persistent class."msgstr "下一步,我们把这个持久化类的信息告诉Hibernate。"#. Tag: title#: tutorial.xml:117#, no-c-formatmsgid "The mapping file"msgstr "映射文件"#. Tag: para#: tutorial.xml:119#, no-c-formatmsgid """Hibernate needs to know how to load and store objects of the persistent ""class. This is where the Hibernate mapping file comes into play. The mapping ""file tells Hibernate what table in the database it has to access, and what ""columns in that table it should use."msgstr """Hibernate需要知道怎样去加载(load)和存储(store)持久化类的对象。这正是""Hibernate映射文件发挥作用的地方。映射文件告诉Hibernate它,应该访问数据库""(database)里面的哪个表(table)及应该使用表里面的哪些字段(column)。"#. Tag: para#: tutorial.xml:126#, no-c-formatmsgid "The basic structure of a mapping file looks like this:"msgstr "一个映射文件的基本结构看起来像这样:"#. Tag: programlisting#: tutorial.xml:130#, no-c-formatmsgid """<![CDATA[<?xml version=\"1.0\"?>\n""<!DOCTYPE hibernate-mapping PUBLIC\n""        \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -