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

📄 best_practices.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 2 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2008-08-14 15:28+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#: best_practices.xml:29#, no-c-formatmsgid "Best Practices"msgstr "最佳实践(Best Practices)"#. Tag: term#: best_practices.xml:33#, no-c-formatmsgid """Write fine-grained classes and map them using <literal>&lt;component&gt;</""literal>."msgstr """设计细颗粒度的持久类并且使用<literal>&lt;component&gt;</literal>来实现映射。"#. Tag: para#: best_practices.xml:35#, no-c-formatmsgid """Use an <literal>Address</literal> class to encapsulate <literal>street</""literal>, <literal>suburb</literal>, <literal>state</literal>, ""<literal>postcode</literal>. This encourages code reuse and simplifies ""refactoring."msgstr """使用一个<literal>Address</literal>持久类来封装 <literal>street</literal>, ""<literal>suburb</literal>, <literal>state</literal>, <literal>postcode</""literal>. 这将有利于代码重用和简化代码重构(refactoring)的工作。"#. Tag: term#: best_practices.xml:43#, no-c-formatmsgid "Declare identifier properties on persistent classes."msgstr "对持久类声明标识符属性( identifier properties)。"#. Tag: para#: best_practices.xml:45#, no-c-formatmsgid """Hibernate makes identifier properties optional. There are all sorts of ""reasons why you should use them. We recommend that identifiers be ""'synthetic' (generated, with no business meaning)."msgstr """Hibernate中标识符属性是可选的,不过有很多原因来说明你应该使用标识符属性。我们""建议标识符应该是“人造”的(自动生成,不涉及业务含义)。"#. Tag: term#: best_practices.xml:53#, no-c-formatmsgid "Identify natural keys."msgstr "使用自然键(natural keys)标识"#. Tag: para#: best_practices.xml:55#, no-c-formatmsgid """Identify natural keys for all entities, and map them using <literal>&lt;""natural-id&gt;</literal>. Implement <literal>equals()</literal> and ""<literal>hashCode()</literal> to compare the properties that make up the ""natural key."msgstr """对所有的实体都标识出自然键,用<literal>&lt;natural-id&gt;</literal>进行映射。""实现<literal>equals()</literal>和<literal>hashCode()</literal>,在其中用组成""自然键的属性进行比较。"#. Tag: term#: best_practices.xml:63#, no-c-formatmsgid "Place each class mapping in its own file."msgstr "为每个持久类写一个映射文件"#. Tag: para#: best_practices.xml:65#, no-c-formatmsgid """Don't use a single monolithic mapping document. Map <literal>com.eg.Foo</""literal> in the file <literal>com/eg/Foo.hbm.xml</literal>. This makes ""particularly good sense in a team environment."msgstr """不要把所有的持久类映射都写到一个大文件中。把 <literal>com.eg.Foo</literal> 映""射到<literal>com/eg/Foo.hbm.xml</literal>中, 在团队开发环境中,这一点显得特""别有意义。"#. Tag: term#: best_practices.xml:73#, no-c-formatmsgid "Load mappings as resources."msgstr "把映射文件作为资源加载"#. Tag: para#: best_practices.xml:75#, no-c-formatmsgid "Deploy the mappings along with the classes they map."msgstr "把映射文件和他们的映射类放在一起进行部署。"#. Tag: term#: best_practices.xml:81#, no-c-formatmsgid "Consider externalising query strings."msgstr "考虑把查询字符串放在程序外面"#. Tag: para#: best_practices.xml:83#, no-c-formatmsgid """This is a good practice if your queries call non-ANSI-standard SQL ""functions. Externalising the query strings to mapping files will make the ""application more portable."msgstr """如果你的查询中调用了非ANSI标准的SQL函数,那么这条实践经验对你适用。把查询字符""串放在映射文件中可以让程序具有更好的可移植性。"#. Tag: term#: best_practices.xml:91#, no-c-formatmsgid "Use bind variables."msgstr "使用绑定变量"#. Tag: para#: best_practices.xml:93#, no-c-formatmsgid """As in JDBC, always replace non-constant values by \"?\". Never use string ""manipulation to bind a non-constant value in a query! Even better, consider ""using named parameters in queries."msgstr """就像在JDBC编程中一样,应该总是用占位符\"?\"来替换非常量值,不要在查询中用字符""串值来构造非常量值!更好的办法是在查询中使用命名参数。"#. Tag: term#: best_practices.xml:101#, no-c-formatmsgid "Don't manage your own JDBC connections."msgstr "不要自己来管理JDBC connections"#. Tag: para#: best_practices.xml:103#, no-c-formatmsgid """Hibernate lets the application manage JDBC connections. This approach should ""be considered a last-resort. If you can't use the built-in connections ""providers, consider providing your own implementation of <literal>org.""hibernate.connection.ConnectionProvider</literal>."msgstr """Hibernate允许应用程序自己来管理JDBC connections,但是应该作为最后没有办法的办""法。如果你不能使用Hibernate内建的connections providers,那么考虑实现自己来实""现<literal>org.hibernate.connection.ConnectionProvider</literal>"#. Tag: term#: best_practices.xml:111#, no-c-formatmsgid "Consider using a custom type."msgstr "考虑使用用户自定义类型(custom type)"#. Tag: para#: best_practices.xml:113#, no-c-formatmsgid """Suppose you have a Java type, say from some library, that needs to be ""persisted but doesn't provide the accessors needed to map it as a component. ""You should consider implementing <literal>org.hibernate.UserType</literal>. ""This approach frees the application code from implementing transformations ""to / from a Hibernate type."msgstr """假设你有一个Java类型,来自某些类库,需要被持久化,但是该类没有提供映射操作需""要的存取方法。那么你应该考虑实现<literal>org.hibernate.UserType</literal>接""口。这种办法使程序代码写起来更加自如,不再需要考虑类与Hibernate type之间的相""互转换。"#. Tag: term#: best_practices.xml:122#, no-c-formatmsgid "Use hand-coded JDBC in bottlenecks."msgstr "在性能瓶颈的地方使用硬编码的JDBC"#. Tag: para#: best_practices.xml:124#, no-c-formatmsgid """In performance-critical areas of the system, some kinds of operations might ""benefit from direct JDBC. But please, wait until you <emphasis>know</""emphasis> something is a bottleneck. And don't assume that direct JDBC is ""necessarily faster. If you need to use direct JDBC, it might be worth ""opening a Hibernate <literal>Session</literal> and using that JDBC ""connection. That way you can still use the same transaction strategy and ""underlying connection provider."msgstr """In performance-critical areas of the system, some kinds of operations might ""benefit from direct JDBC. But please, wait until you <emphasis>know</""emphasis> something is a bottleneck. And don't assume that direct JDBC is ""necessarily faster. If you need to use direct JDBC, it might be worth ""opening a Hibernate <literal>Session</literal> and using that JDBC ""connection. That way you can still use the same transaction strategy and ""underlying connection provider. 在系统中对性能要求很严格的一些部分,某些操作""也许直接使用JDBC会更好。但是请先<emphasis>确认</emphasis>这的确是一个瓶颈,并""且不要想当然认为JDBC一定会更快。如果确实需要直接使用JDBC,那么最好打开一个 ""Hibernate <literal>Session</literal> 然后从 <literal>Session</literal>获得""connection,按照这种办法你仍然可以使用同样的transaction策略和底层的""connection provider。"#. Tag: term#: best_practices.xml:134#, no-c-formatmsgid "Understand <literal>Session</literal> flushing."

⌨️ 快捷键说明

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