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

📄 performance.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 5 页
字号:
"jointure dans les fichiers de mapping :"#. Tag: programlisting#: performance.xml:201#, no-c-formatmsgid """<![CDATA[<set name=\"permissions\" \n""            fetch=\"join\">\n""    <key column=\"userId\"/>\n""    <one-to-many class=\"Permission\"/>\n""</set]]>"msgstr ""#. Tag: programlisting#: performance.xml:203#, no-c-formatmsgid "<![CDATA[<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>]]>"msgstr ""#. Tag: para#: performance.xml:205#, no-c-formatmsgid """The <literal>fetch</literal> strategy defined in the mapping document ""affects:"msgstr """La stratégie de chargement définie à l'aide du mot <literal>fetch</literal> ""dans les fichiers de mapping affecte :"#. Tag: para#: performance.xml:211#, no-c-formatmsgid "retrieval via <literal>get()</literal> or <literal>load()</literal>"msgstr """La récupération via <literal>get()</literal> ou <literal>load()</literal>"#. Tag: para#: performance.xml:216#, no-c-formatmsgid "retrieval that happens implicitly when an association is navigated"msgstr """La récupération implicite lorsque l'on navigue à travers une association"#. Tag: para#: performance.xml:221#, no-c-formatmsgid "<literal>Criteria</literal> queries"msgstr "Les requêtes de type <literal>Criteria</literal>"#. Tag: para#: performance.xml:226#, no-c-formatmsgid "HQL queries if <literal>subselect</literal> fetching is used"msgstr """Les requêtes HQL si l'on utilise le chargement par <literal>subselect</""literal>"#. Tag: para#: performance.xml:232#, no-c-formatmsgid """No matter what fetching strategy you use, the defined non-lazy graph is ""guaranteed to be loaded into memory. Note that this might result in several ""immediate selects being used to execute a particular HQL query."msgstr """Quelle que soit la stratégie de chargement que vous utilisez, la partie du ""graphe d'objets qui est définie comme non \"tardive\" sera chargée en ""mémoire. Cela peut mener à l'exécution de plusieurs selects successifs pour ""une seule requête HQL."#. Tag: para#: performance.xml:238#, no-c-formatmsgid """Usually, we don't use the mapping document to customize fetching. Instead, ""we keep the default behavior, and override it for a particular transaction, ""using <literal>left join fetch</literal> in HQL. This tells Hibernate to ""fetch the association eagerly in the first select, using an outer join. In ""the <literal>Criteria</literal> query API, you would use ""<literal>setFetchMode(FetchMode.JOIN)</literal>."msgstr """On n'utilise pas souvent les documents de mapping pour adapter le ""chargement. Au lieu de cela, on conserve le comportement par défaut et on le ""surcharge pour une transaction particulière en utilisant <literal>left join ""fetch</literal> dans les requêtes HQL. Cela indique à hibernate à Hibernate ""de charger l'association de manière agressive lors du premier select en ""utilisant une jointure externe. Dans l'API Criteria vous pouvez utiliser la ""méthode <literal>setFetchMode(FetchMode.JOIN)</literal>"#. Tag: para#: performance.xml:247#, no-c-formatmsgid """If you ever feel like you wish you could change the fetching strategy used ""by <literal>get()</literal> or <literal>load()</literal>, simply use a ""<literal>Criteria</literal> query, for example:"msgstr """Si vous ne vous sentez pas prêt à modifier la stratégie de chargement ""utilisé par <literal>get()</literal> ou <literal>load()</literal>, vous ""pouvez juste utiliser une requête de type <literal>Criteria</literal> comme ""par exemple :"#. Tag: programlisting#: performance.xml:253#, no-c-formatmsgid """<![CDATA[User user = (User) session.createCriteria(User.class)\n""                .setFetchMode(\"permissions\", FetchMode.JOIN)\n""                .add( Restrictions.idEq(userId) )\n""                .uniqueResult();]]>"msgstr ""#. Tag: para#: performance.xml:255#, no-c-formatmsgid """(This is Hibernate's equivalent of what some ORM solutions call a \"fetch ""plan\".)"msgstr """(Il s'agit de l'équivalent pour Hibernate de ce que d'autres outils de ""mapping appellent un \"fetch plan\" ou \"plan de chargement\")"#. Tag: para#: performance.xml:259#, no-c-formatmsgid """A completely different way to avoid problems with N+1 selects is to use the ""second-level cache."msgstr """Une autre manière complètement différente d'éviter le problème des N+1 ""selects est d'utiliser le cache de second niveau."#. Tag: title#: performance.xml:267#, no-c-formatmsgid "Single-ended association proxies"msgstr "Proxys pour des associations vers un seul objet"#. Tag: para#: performance.xml:269#, no-c-formatmsgid """Lazy fetching for collections is implemented using Hibernate's own ""implementation of persistent collections. However, a different mechanism is ""needed for lazy behavior in single-ended associations. The target entity of ""the association must be proxied. Hibernate implements lazy initializing ""proxies for persistent objects using runtime bytecode enhancement (via the ""excellent CGLIB library)."msgstr """Le chargement tardif des collections est implémenté par Hibernate en ""utilisant ses propres implémentations pour des collections persistantes. Si ""l'on veut un chargement tardif pour des associations vers un seul objet ""métier il faut utiliser un autre mécanisme. L'entité qui est pointée par ""l'association doit être masquée derrière un proxy. Hibernate implémente ""l'initialisation tardive des proxys sur des objets persistents via une mise ""à jour à chaud du bytecode (à l'aide de l'excellente librairie CGLIB)."#. Tag: para#: performance.xml:277#, no-c-formatmsgid """By default, Hibernate3 generates proxies (at startup) for all persistent ""classes and uses them to enable lazy fetching of <literal>many-to-one</""literal> and <literal>one-to-one</literal> associations."msgstr """Par défaut, Hibernate génère des proxys (au démarrage) pour toutes les ""classes persistantes et les utilise pour activer le chargement tardif des ""associations <literal>many-to-one</literal> et <literal>one-to-one</literal>."#. Tag: para#: performance.xml:283#, no-c-formatmsgid """The mapping file may declare an interface to use as the proxy interface for ""that class, with the <literal>proxy</literal> attribute. By default, ""Hibernate uses a subclass of the class. <emphasis>Note that the proxied ""class must implement a default constructor with at least package visibility. ""We recommend this constructor for all persistent classes!</emphasis>"msgstr """Le fichier de mapping peut déclarer une interface qui sera utilisée par le ""proxy d'interfaçage pour cette classe à l'aide de l'attribut <literal>proxy</""literal>. Par défaut Hibernate utilises une sous classe de la classe ""persistante. <emphasis>Il faut que les classes pour lesquelles on ajoute un ""proxy implémentent un constructeur par défaut de visibilité au moins ""package. Ce constructeur est recommandé pour toutes les classes ""persistantes !</emphasis>"#. Tag: para#: performance.xml:290#, no-c-formatmsgid """There are some gotchas to be aware of when extending this approach to ""polymorphic classes, eg."msgstr """Il y a quelques précautions à prendre lorsque l'on étend cette approche à ""des classes polymorphiques, exemple :"#. Tag: programlisting#: performance.xml:295#, no-c-formatmsgid """<![CDATA[<class name=\"Cat\" proxy=\"Cat\">\n""    ......\n""    <subclass name=\"DomesticCat\">\n""        .....\n""    </subclass>\n""</class>]]>"msgstr ""#. Tag: para#: performance.xml:297#, no-c-formatmsgid """Firstly, instances of <literal>Cat</literal> will never be castable to ""<literal>DomesticCat</literal>, even if the underlying instance is an ""instance of <literal>DomesticCat</literal>:"msgstr """Tout d'abord, les instances de <literal>Cat</literal> ne pourront jamais ""être \"castées\" en <literal>DomesticCat</literal>, même si l'instance sous ""jacente est une instance de <literal>DomesticCat</literal> :"#. Tag: programlisting#: performance.xml:303#, no-c-formatmsgid """<![CDATA[Cat cat = (Cat) session.load(Cat.class, id);  // instantiate a ""proxy (does not hit the db)\n""if ( cat.isDomesticCat() ) {                  // hit the db to initialize ""the proxy\n""    DomesticCat dc = (DomesticCat) cat;       // Error!\n""    ....\n""}]]>"msgstr ""#. Tag: para#: performance.xml:305#, no-c-formatmsgid "Secondly, it is possible to break proxy <literal>==</literal>."msgstr """Deuxièmement, il est possible de casser la notion d'<literal>==</literal> ""des proxy."#. Tag: programlisting#: performance.xml:309#, no-c-formatmsgid """<![CDATA[Cat cat = (Cat) session.load(Cat.class, id);            // ""instantiate a Cat proxy\n""DomesticCat dc = \n""        (DomesticCat) session.load(DomesticCat.class, id);  // acquire new ""DomesticCat proxy!\n""System.out.println(cat==dc);                            // false]]>"msgstr ""#. Tag: para#: performance.xml:311#, no-c-formatmsgid """However, the situation is not quite as bad as it looks. Even though we now ""have two references to different proxy objects, the underlying instance will ""still be the same object:"msgstr """Cette situation n'est pas si mauvaise qu'il n'y parait. Même si nous avons ""deux références à deux objets proxys différents, l'instance de base sera ""quand même le même objet :"#. Tag: programlisting#: performance.xml:316#, no-c-formatmsgid """<![CDATA[cat.setWeight(11.0);  // hit the db to initialize the proxy\n""System.out.println( dc.getWeight() );  // 11.0]]>"msgstr ""#. Tag: para#: performance.xml:318#, no-c-formatmsgid """Third, you may not use a CGLIB proxy for a <literal>final</literal> class or ""a class with any <literal>final</literal> methods."msgstr """Troisièmement, vous ne pourrez pas utiliser un proxy CGLIB pour une classe ""<literal>final</literal> ou pour une classe contenant la moindre méthode ""<literal>final</literal>."#. Tag: para#: performance.xml:323#, no-c-formatmsgid """Finally, if your persistent object acquires any resources upon instantiation ""(eg. in initializers or default constructor), then those resources will also ""be acquired by the proxy. The proxy class is an actual subclass of the ""persistent class."msgstr """Enfin, si votre objet persistant obtient une ressource à l'instanciation ""(par example dans les initialiseurs ou dans le contructeur par défaut), ""alors ces ressources seront aussi obtenues par le proxy. La classe proxy est ""vraiment une sous classe de la classe persistante."#. Tag: para#: performance.xml:329#, no-c-formatmsgid """These problems are all due to fundamental limitations in Java's single ""inheritance model. If you wish to avoid these problems your persistent ""classes must each implement an interface that declares its business methods. ""You should specify these interfaces in the mapping file. eg."msgstr """Ces problèmes sont tous dus aux limitations fondamentales du modèle ""d'héritage unique de Java. Si vous souhaitez éviter ces problèmes, vos ""classes persistantes doivent chacune implémenter une interface qui déclare ""ses méthodes métier. Vous devriez alors spécifier ces interfaces dans le ""fichier de mapping :"#. Tag: programlisting#: performance.xml:335#, no-c-formatmsgid """<![CDATA[<class name=\"CatImpl\" proxy=\"Cat\">\n""    ......\n""    <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n""        .....\n""    </subclass>\n""</class>]]>"msgstr ""#. Tag: para#: performance.xml:337#, no-c-formatmsgid """where <literal>CatImpl</literal> implements the interface <literal>Cat</""literal> and <literal>DomesticCatImpl</literal> implements the interface ""<literal>DomesticCat</literal>. Then proxies for instances of <literal>Cat</""literal> and <literal>DomesticCat</literal> may be returned by <literal>load""()</literal> or <literal>iterate()</literal>. (Note that <literal>list()</""literal> does not usually return proxies.)"msgstr ""

⌨️ 快捷键说明

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