📄 persistent_classes.po
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 07:47+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#: persistent_classes.xml:5#, no-c-formatmsgid "Persistent Classes"msgstr "Persistent Classes"#. Tag: para#: persistent_classes.xml:7#, no-c-formatmsgid """Persistent classes are classes in an application that implement the entities ""of the business problem (e.g. Customer and Order in an E-commerce ""application). Not all instances of a persistent class are considered to be ""in the persistent state - an instance may instead be transient or detached."msgstr """Persistent classes are classes in an application that implement the entities ""of the business problem (e.g. Customer and Order in an E-commerce ""application). Not all instances of a persistent class are considered to be ""in the persistent state - an instance may instead be transient or detached."#. Tag: para#: persistent_classes.xml:14#, no-c-formatmsgid """Hibernate works best if these classes follow some simple rules, also known ""as the Plain Old Java Object (POJO) programming model. However, none of ""these rules are hard requirements. Indeed, Hibernate3 assumes very little ""about the nature of your persistent objects. You may express a domain model ""in other ways: using trees of <literal>Map</literal> instances, for example."msgstr """Hibernate works best if these classes follow some simple rules, also known ""as the Plain Old Java Object (POJO) programming model. However, none of ""these rules are hard requirements. Indeed, Hibernate3 assumes very little ""about the nature of your persistent objects. You may express a domain model ""in other ways: using trees of <literal>Map</literal> instances, for example."#. Tag: title#: persistent_classes.xml:23#, no-c-formatmsgid "A simple POJO example"msgstr "A simple POJO example"#. Tag: para#: persistent_classes.xml:25#, no-c-formatmsgid "Most Java applications require a persistent class representing felines."msgstr """Most Java applications require a persistent class representing felines."#. Tag: programlisting#: persistent_classes.xml:29#, no-c-formatmsgid """<![CDATA[package eg;\n""import java.util.Set;\n""import java.util.Date;\n""\n""public class Cat {\n"" private Long id; // identifier\n""\n"" private Date birthdate;\n"" private Color color;\n"" private char sex;\n"" private float weight;\n"" private int litterId;\n""\n"" private Cat mother;\n"" private Set kittens = new HashSet();\n""\n"" private void setId(Long id) {\n"" this.id=id;\n"" }\n"" public Long getId() {\n"" return id;\n"" }\n""\n"" void setBirthdate(Date date) {\n"" birthdate = date;\n"" }\n"" public Date getBirthdate() {\n"" return birthdate;\n"" }\n""\n"" void setWeight(float weight) {\n"" this.weight = weight;\n"" }\n"" public float getWeight() {\n"" return weight;\n"" }\n""\n"" public Color getColor() {\n"" return color;\n"" }\n"" void setColor(Color color) {\n"" this.color = color;\n"" }\n""\n"" void setSex(char sex) {\n"" this.sex=sex;\n"" }\n"" public char getSex() {\n"" return sex;\n"" }\n""\n"" void setLitterId(int id) {\n"" this.litterId = id;\n"" }\n"" public int getLitterId() {\n"" return litterId;\n"" }\n""\n"" void setMother(Cat mother) {\n"" this.mother = mother;\n"" }\n"" public Cat getMother() {\n"" return mother;\n"" }\n"" void setKittens(Set kittens) {\n"" this.kittens = kittens;\n"" }\n"" public Set getKittens() {\n"" return kittens;\n"" }\n"" \n"" // addKitten not needed by Hibernate\n"" public void addKitten(Cat kitten) {\n"" kitten.setMother(this);\n"" kitten.setLitterId( kittens.size() ); \n"" kittens.add(kitten);\n"" }\n""}]]>"msgstr ""#. Tag: para#: persistent_classes.xml:31#, no-c-formatmsgid "There are four main rules to follow here:"msgstr "There are four main rules to follow here:"#. Tag: title#: persistent_classes.xml:37#, no-c-formatmsgid "Implement a no-argument constructor"msgstr "Implement a no-argument constructor"#. Tag: para#: persistent_classes.xml:39#, no-c-formatmsgid """<literal>Cat</literal> has a no-argument constructor. All persistent classes ""must have a default constructor (which may be non-public) so that Hibernate ""can instantiate them using <literal>Constructor.newInstance()</literal>. We ""strongly recommend having a default constructor with at least ""<emphasis>package</emphasis> visibility for runtime proxy generation in ""Hibernate."msgstr """<literal>Cat</literal> has a no-argument constructor. All persistent classes ""must have a default constructor (which may be non-public) so that Hibernate ""can instantiate them using <literal>Constructor.newInstance()</literal>. We ""strongly recommend having a default constructor with at least ""<emphasis>package</emphasis> visibility for runtime proxy generation in ""Hibernate."#. Tag: title#: persistent_classes.xml:49#, no-c-formatmsgid "Provide an identifier property (optional)"msgstr "Provide an identifier property (optional)"#. Tag: para#: persistent_classes.xml:51#, no-c-formatmsgid """<literal>Cat</literal> has a property called <literal>id</literal>. This ""property maps to the primary key column of a database table. The property ""might have been called anything, and its type might have been any primitive ""type, any primitive \"wrapper\" type, <literal>java.lang.String</literal> or ""<literal>java.util.Date</literal>. (If your legacy database table has ""composite keys, you can even use a user-defined class with properties of ""these types - see the section on composite identifiers later.)"msgstr """<literal>Cat</literal> has a property called <literal>id</literal>. This ""property maps to the primary key column of a database table. The property ""might have been called anything, and its type might have been any primitive ""type, any primitive \"wrapper\" type, <literal>java.lang.String</literal> or ""<literal>java.util.Date</literal>. (If your legacy database table has ""composite keys, you can even use a user-defined class with properties of ""these types - see the section on composite identifiers later.)"#. Tag: para#: persistent_classes.xml:60#, no-c-formatmsgid """The identifier property is strictly optional. You can leave them off and let ""Hibernate keep track of object identifiers internally. We do not recommend ""this, however."msgstr """The identifier property is strictly optional. You can leave them off and let ""Hibernate keep track of object identifiers internally. We do not recommend ""this, however."#. Tag: para#: persistent_classes.xml:65#, no-c-formatmsgid """In fact, some functionality is available only to classes which declare an ""identifier property:"msgstr """In fact, some functionality is available only to classes which declare an ""identifier property:"#. Tag: para#: persistent_classes.xml:72#, fuzzy, no-c-formatmsgid """Transitive reattachment for detached objects (cascade update or cascade ""merge) - see"msgstr """Transitive reattachment for detached objects (cascade update or cascade ""merge) - see <xref linkend=\"objectstate-transitive\"/>"#. Tag: literal#: persistent_classes.xml:79#, no-c-formatmsgid "Session.saveOrUpdate()"msgstr "Session.saveOrUpdate()"#. Tag: literal#: persistent_classes.xml:84#, no-c-formatmsgid "Session.merge()"msgstr "Session.merge()"#. Tag: para#: persistent_classes.xml:89#, no-c-formatmsgid """We recommend you declare consistently-named identifier properties on ""persistent classes. We further recommend that you use a nullable (ie. non-""primitive) type."msgstr """We recommend you declare consistently-named identifier properties on ""persistent classes. We further recommend that you use a nullable (ie. non-""primitive) type."#. Tag: title#: persistent_classes.xml:96#, no-c-formatmsgid "Prefer non-final classes (optional)"msgstr "Prefer non-final classes (optional)"#. Tag: para#: persistent_classes.xml:97#, no-c-formatmsgid """A central feature of Hibernate, <emphasis>proxies</emphasis>, depends upon ""the persistent class being either non-final, or the implementation of an ""interface that declares all public methods."msgstr """A central feature of Hibernate, <emphasis>proxies</emphasis>, depends upon ""the persistent class being either non-final, or the implementation of an ""interface that declares all public methods."#. Tag: para#: persistent_classes.xml:102#, no-c-formatmsgid """You can persist <literal>final</literal> classes that do not implement an ""interface with Hibernate, but you won't be able to use proxies for lazy ""association fetching - which will limit your options for performance tuning."msgstr """You can persist <literal>final</literal> classes that do not implement an ""interface with Hibernate, but you won't be able to use proxies for lazy ""association fetching - which will limit your options for performance tuning."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -