alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (portability.po)

This example Hibernate source code file (portability.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

dialect, hibernate, hibernate, hql, it, jdbcconnectionexception, sql, starting, tag, tag, the, the, this, this

The Hibernate portability.po source code

# translation of Collection_Mapping.po to
# Xi Huang <xhuang@redhat.com>, 2006.
# Xi HUANG <xhuang@redhat.com>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-03-25 06:26+0000\n"
"PO-Revision-Date: 2010-03-16 10:10+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team:  <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"

#. Tag: title
#: portability.xml:31
#, no-c-format
msgid "Database Portability Considerations"
msgstr "数据库移植性考量"

#. Tag: title
#: portability.xml:34
#, no-c-format
msgid "Portability Basics"
msgstr "移植性基础"

#. Tag: para
#: portability.xml:36
#, no-c-format
msgid ""
"One of the selling points of Hibernate (and really Object/Relational Mapping "
"as a whole) is the notion of database portability. This could mean an "
"internal IT user migrating from one database vendor to another, or it could "
"mean a framework or deployable application consuming Hibernate to "
"simultaneously target multiple database products by their users. Regardless "
"of the exact scenario, the basic idea is that you want Hibernate to help you "
"run against any number of databases without changes to your code, and "
"ideally without any changes to the mapping metadata."
msgstr ""
"Hibernate(实际上是整个 Object/Relational Mapping)的一个卖点是数据库的移植"
"性。这意味着内部的 IT 用户可以改变数据库供应商,或者可部署的应用程序/框架使"
"用 Hibernate 来同时使用多个数据库产品。不考虑具体的应用情景,这里的基本概念"
"是 Hibernate 可帮助你运行多种数据库而无需修改你的代码,理想情况下甚至不用修改"
"映射元数据。"

#. Tag: title
#: portability.xml:47
#, no-c-format
msgid "Dialect"
msgstr "Dialect"

#. Tag: para
#: portability.xml:49
#, no-c-format
msgid ""
"The first line of portability for Hibernate is the dialect, which is a "
"specialization of the <classname>org.hibernate.dialect.Dialect "
"contract. A dialect encapsulates all the differences in how Hibernate must "
"communicate with a particular database to accomplish some task like getting "
"a sequence value or structuring a SELECT query. Hibernate bundles a wide "
"range of dialects for many of the most popular databases. If you find that "
"your particular database is not among them, it is not terribly difficult to "
"write your own."
msgstr ""
"Hibernate 的移植性的首要问题是方言(dialect),也就是 <classname>org."
"hibernate.dialect.Dialect</classname> 合约的具体实例。方言封装了 Hibernate 和"
"特定数据库通讯以完成某些任务如获取序列值或构建 SELECT 查询等的所有差异。"
"Hibernate 捆绑了用于许多最常用的数据库的方言。如果你发现自己使用的数据库不在"
"其中,编写自定义的方言也不是很困难的事情。"

#. Tag: title
#: portability.xml:60
#, no-c-format
msgid "Dialect resolution"
msgstr "方言的使用"

#. Tag: para
#: portability.xml:62
#, no-c-format
msgid ""
"Originally, Hibernate would always require that users specify which dialect "
"to use. In the case of users looking to simultaneously target multiple "
"databases with their build that was problematic. Generally this required "
"their users to configure the Hibernate dialect or defining their own method "
"of setting that value."
msgstr ""
"最开始,Hibernate 总是要求用户指定所使用的方言(dialect)。在用户希望同时使用"
"多个数据库时就会出现问题。通常这要求用户配置 Hibernate 方言或者定义自己设置这"
"个值的方法。"

#. Tag: para
#: portability.xml:69
#, no-c-format
msgid ""
"Starting with version 3.2, Hibernate introduced the notion of automatically "
"detecting the dialect to use based on the <interfacename>java.sql."
"DatabaseMetaData</interfacename> obtained from a java.sql."
"Connection</interfacename> to that database. This was much better, expect "
"that this resolution was limited to databases Hibernate know about ahead of "
"time and was in no way configurable or overrideable."
msgstr ""
"从版本 3.2 开始,Hibernate 引入了方言的自动检测,它基于从该数据库的 "
"<interfacename>java.sql.Connection 上获得的 "
"<interfacename>java.sql.DatabaseMetaData。这是一个更好的方"
"案,但它局限于 Hibernate 已知的数据库且无法进行配置和覆盖。"

#. Tag: para
#: portability.xml:77
#, fuzzy, no-c-format
msgid ""
"Starting with version 3.3, Hibernate has a fare more powerful way to "
"automatically determine which dialect to should be used by relying on a "
"series of delegates which implement the <interfacename>org.hibernate.dialect."
"resolver.DialectResolver</interfacename> which defines only a single method:"
"<programlisting role=\"JAVA\"> constant on org.hibernate."
"cfg.Environment</classname>)."
msgstr ""
"这些解析者最棒的功能是用户也可以注册自定义的解析者,它们将在内置的解析者之前"
"被调用。在许多情况下这可能很有用:它可以轻易地集成内置方言之外的方言的自动检"
"测;它让你可以使用自定义的方言等。要注册一个或多个解析者,只要用 'hibernate."
"dialect_resolvers' 配置设置指定它们(由逗号、制表符或空格隔开)就可以了(请参"
"考 <classname>org.hibernate.cfg.Environment 上的 "
"<constant>DIALECT_RESOLVERS)。"

#. Tag: title
#: portability.xml:103
#, no-c-format
msgid "Identifier generation"
msgstr "标识符的生成"

#. Tag: para
#: portability.xml:105
#, fuzzy, no-c-format
msgid ""
"When considering portability between databases, another important decision "
"is selecting the identifier generation stratagy you want to use. Originally "
"Hibernate provided the <emphasis>native generator for this "
"purpose, which was intended to select between a <emphasis>sequenceidentity, or table "
"strategy depending on the capability of the underlying database. However, an "
"insidious implication of this approach comes about when targtetting some "
"databases which support <emphasis>identity generation and some "
"which do not. <emphasis>identity generation relies on the SQL "
"definition of an IDENTITY (or auto-increment) column to manage the "
"identifier value; it is what is known as a post-insert generation strategy "
"becauase the insert must actually happen before we can know the identifier "
"value. Because Hibernate relies on this identifier value to uniquely "
"reference entities within a persistence context it must then issue the "
"insert immediately when the users requests the entitiy be associated with "
"the session (like via save() e.g.) regardless of current transactional "
"semantics. <note>  Hibernate was changed slightly once the implication "
"of this was better understood so that the insert is delayed in cases where "
"that is feasible. </para>  The underlying issue is that the actual "
"semanctics of the application itself changes in these cases."
msgstr ""
"当考虑数据库的移植性时,另外一个重要的考量是选择标识符生成策略。Hibernate 原"
"先提供的 <emphasis>native 生成器的目的是根据底层数据库的能力在 "
"<emphasis>sequence、identity 或 "
"<emphasis>table 策略间进行选择。然而,这个方法一个潜在的问题是有些"
"数据库支持<emphasis>标识符(identity)生成而有些则不支持。"
"<emphasis>标识符(identity) 生成依赖于管理标识符值的 IDENTITY"
"(或 auto-increment)字段的 SQL 定义。它也成为 post-insert 生成策略,因为 "
"insert 必须在知道标识符值后才能实际发生。因为 Hibernate 依赖于这个标识符值来"
"唯一地引用持久性上下文里的实体,当用户请求和会话相关联的实体时(如通过 save"
"()),它必须立即执行 insert  语句而不管当前的事务性语义。"

#. Tag: para
#: portability.xml:130
#, no-c-format
msgid ""
"Starting with version 3.2.3, Hibernate comes with a set of <ulink url="
"\"http://in.relation.to/2082.lace\">enhanced</ulink> identifier generators "
"targetting portability in a much different way. <note>  There are "
"specifically 2 bundled <emphasis>enhancedgenerators: "
"<itemizedlist>   org.hibernate.id.enhanced."
"SequenceStyleGenerator</classname>     "
"<classname>org.hibernate.id.enhanced.TableGenerator     The idea behind these generators "
"is to port the actual semantics of the identifer value generation to the "
"different databases. For example, the <classname>org.hibernate.id.enhanced."
"SequenceStyleGenerator</classname> mimics the behavior of a sequence on "
"databases which do not support sequences by using a table."
msgstr ""

#. Tag: title
#: portability.xml:159
#, no-c-format
msgid "Database functions"
msgstr "数据库函数"

#. Tag: para
#: portability.xml:162
#, no-c-format
msgid ""
"This is an area in Hibernate in need of improvement. In terms of portability "
"concerns, this function handling currently works pretty well from HQL; "
"however, it is quite lacking in all other aspects."
msgstr ""
"这是 Hibernate 需要提高的一个领域。从可移植性来说,这个功能可以很好地处理 "
"HQL 的内容,但在其他方面就有所欠缺。"

#. Tag: para
#: portability.xml:169
#, no-c-format
msgid ""
"SQL functions can be referenced in many ways by users. However, not all "
"databases support the same set of functions. Hibernate, provides a means of "
"mapping a <emphasis>logical function name to a delegate which "
"knows how to render that particular function, perhaps even using a totally "
"different physical function call."
msgstr ""
"用户可以以多种方式引用 SQL 函数。然而,不是所有的数据库都支持相同的函数集。"
"Hibernate 提供了一种映射<emphasis>逻辑函数名到代理的方法,这个代理"
"知道如何解析特定的函数,甚至可能使用完全不同的物理函数调用。 "

#. Tag: para
#: portability.xml:175
#, no-c-format
msgid ""
"Technically this function registration is handled through the <classname>org."
"hibernate.dialect.function.SQLFunctionRegistry</classname> class which is "
"intended to allow users to provide custom function definitions without "
"having to provide a custom dialect. This specific behavior is not fully "
"completed as of yet."
msgstr ""
"从技术上来讲,这个函数注册是通过 <classname>org.hibernate.dialect.function."
"SQLFunctionRegistry</classname> 类进行处理的,它的目的是允许用户提供自定义的"
"函数定义而无需提供自定义的方言。这种特殊的行为目前还未全部开发完毕。"

#. Tag: para
#: portability.xml:182
#, no-c-format
msgid ""
"It is sort of implemented such that users can programatically register "
"functions with the <classname>org.hibernate.cfg.Configuration "
"and those functions will be recognized for HQL."
msgstr ""
"其中一些功能已经实现,如用户可以在程序里用 <classname>org.hibernate.cfg."
"Configuration</classname> 注册函数且这些函数可被 HQL 识别。"

#. Tag: title
#: portability.xml:192
#, no-c-format
msgid "Type mappings"
msgstr "类型映射"

#. Tag: para
#: portability.xml:194
#, no-c-format
msgid "This section scheduled for completion at a later date..."
msgstr "本节内容仍未完成..."

#~ msgid ""
#~ "Hibernate was changed slightly once the implication of this was better "
#~ "understood so that the insert is delayed in cases where that is feasible."
#~ msgstr "Hibernate 已经进行了轻微改进,所以在可行时这种插入会被延迟。"

#~ msgid ""
#~ "The underlying issue is that the actual semanctics of the application "
#~ "itself changes in these cases."
#~ msgstr "底层的问题是这些例子里应用程序自身的实际模式的改变。"

#~ msgid ""
#~ "Starting with version 3.2.3, Hibernate comes with a set of <ulink url="
#~ "\"http://in.relation.to/2082.lace\">enhanced</ulink> identifier "
#~ "generators targetting portability in a much different way."
#~ msgstr ""
#~ "从 3.2.3 版本开始,Hibernate 带有一套 <ulink url=\"http://in.relation."
#~ "to/2082.lace\">enhanced</ulink> 标识符生成器,它以很不同的方式实现移植性。"

#~ msgid ""
#~ "There are specifically 2 bundled <emphasis>enhancedgenerators:"
#~ msgstr "特别是两个捆绑的 <emphasis>enhanced 生成器:"

#~ msgid ""
#~ "<classname>org.hibernate.id.enhanced.SequenceStyleGenerator"
#~ msgstr ""
#~ "<classname>org.hibernate.id.enhanced.SequenceStyleGenerator"

#~ msgid "<classname>org.hibernate.id.enhanced.TableGenerator"
#~ msgstr "<classname>org.hibernate.id.enhanced.TableGenerator"

#~ msgid ""
#~ "The idea behind these generators is to port the actual semantics of the "
#~ "identifer value generation to the different databases. For example, the "
#~ "<classname>org.hibernate.id.enhanced.SequenceStyleGenerator "
#~ "mimics the behavior of a sequence on databases which do not support "
#~ "sequences by using a table."
#~ msgstr ""
#~ "这些生成器背后的概念是把标识符值生成的实际情景移植到不同的数据库里。例如,"
#~ "<classname>org.hibernate.id.enhanced.SequenceStyleGenerator 通"
#~ "过使用表来模拟不支持序列(sequences)的数据库上的序列行为。"

#~ msgid ""
#~ "This is a new area in Hibernate and as such it is not as mature as the "
#~ "overall Hibernate experience."
#~ msgstr "这是 Hibernate 的一个新的领域,暂时还不如 Hibernate 总体那么成熟。"

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate portability.po source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.