📄 session_api.po
字号:
"(id) );]]>"msgstr ""#. Tag: para#: session_api.xml:162#, no-c-formatmsgid "Alternatively, you can load state into a given instance:"msgstr "다른 방법으로 당신은 주어진 인스턴스 속으로 상태를 로드시킬 수 있다:"#. Tag: programlisting#: session_api.xml:166#, no-c-formatmsgid """<![CDATA[Cat cat = new DomesticCat();\n""// load pk's state into cat\n""sess.load( cat, new Long(pkId) );\n""Set kittens = cat.getKittens();]]>"msgstr ""#. Tag: para#: session_api.xml:168#, no-c-formatmsgid """Note that <literal>load()</literal> will throw an unrecoverable exception if ""there is no matching database row. If the class is mapped with a proxy, ""<literal>load()</literal> just returns an uninitialized proxy and does not ""actually hit the database until you invoke a method of the proxy. This ""behaviour is very useful if you wish to create an association to an object ""without actually loading it from the database. It also allows multiple ""instances to be loaded as a batch if <literal>batch-size</literal> is ""defined for the class mapping."msgstr """만일 일치하는 데이터베이스 행이 존재하지 않을 경우에 <literal>load()</""literal>가 unrecoverable(복구 불가능한) 예외상황을 던질 것임을 노트하라. 만""일 클래스가 프락시를 갖도록 매핑된 경우, <literal>load()</literal>는 초기화 ""되지 않은 프락시를 단지 반환하고 당신이 그 프락시의 메소드를 호출하기 전까지""는 실제로 데이터베이스에 접속하지 않는다. 당신이 데이터베이스로부터 객체에 대""한 연관을 실제로 로드시키지 않고서 객체에 대한 연관을 생성시키고자 원할 경우""에 이 특징이 매우 유용하다. 만일 <literal>batch-size</literal>가 class 매핑""에 정의되는 경우 그것은 또한 다중 인스턴스들이 하나의 배치로서 로드되는 것을 ""허용해준다."#. Tag: para#: session_api.xml:179#, no-c-formatmsgid """If you are not certain that a matching row exists, you should use the ""<literal>get()</literal> method, which hits the database immediately and ""returns null if there is no matching row."msgstr """만일 당신이 하나의 일치하는 행이 존재하는지를 확신할 수 없을 경우, 당신은 ""<literal>get()</literal> 메소드를 사용해야 한다. 그것(<literal>get()</""literal> 메소드)는 데이터베이스에 즉시 접속하고 만일 일치하는 행이 없을 경우 ""null을 반환한다."#. Tag: programlisting#: session_api.xml:185#, no-c-formatmsgid """<![CDATA[Cat cat = (Cat) sess.get(Cat.class, id);\n""if (cat==null) {\n"" cat = new Cat();\n"" sess.save(cat, id);\n""}\n""return cat;]]>"msgstr ""#. Tag: para#: session_api.xml:187#, no-c-formatmsgid """You may even load an object using an SQL <literal>SELECT ... FOR UPDATE</""literal>, using a <literal>LockMode</literal>. See the API documentation for ""more information."msgstr """당신은 하나의 <literal>LockMode</literal>를 사용하는, <literal>SELECT ... ""FOR UPDATE</literal>를 사용하여 하나의 객체를 로드시킬 수도 있다. 추가 정보""는 API 문서를 보라."#. Tag: programlisting#: session_api.xml:192#, no-c-formatmsgid "<![CDATA[Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);]]>"msgstr ""#. Tag: para#: session_api.xml:194#, no-c-formatmsgid """Note that any associated instances or contained collections are ""<emphasis>not</emphasis> selected <literal>FOR UPDATE</literal>, unless you ""decide to specify <literal>lock</literal> or <literal>all</literal> as a ""cascade style for the association."msgstr """어떤 연관된 인스턴스들이나 포함된 콜렉션들은 당신이 그 연관에 대한 케스케이""드 스타일로서 <literal>lock</literal> 또는 <literal>all</literal>을 지정하도""록 결정하지 않는 한, <literal>FOR UPDATE</literal>로 선택되지 않음을 노트하""라."#. Tag: para#: session_api.xml:201#, no-c-formatmsgid """It is possible to re-load an object and all its collections at any time, ""using the <literal>refresh()</literal> method. This is useful when database ""triggers are used to initialize some of the properties of the object."msgstr """<literal>refresh()</literal> 메소드를 사용하여, 아무때나 하나의 객체와 모든 ""그것의 콜렉션들을 다시 로드시키는 것이 가능하다. 데이터베이스 트리거들이 그 ""객체의 프로퍼티들 중 어떤 것을 초기화 시키는데 사용될 때 이것이 유용하다."#. Tag: programlisting#: session_api.xml:207#, no-c-formatmsgid """<![CDATA[sess.save(cat);\n""sess.flush(); //force the SQL INSERT\n""sess.refresh(cat); //re-read the state (after the trigger executes)]]>"msgstr ""#. Tag: para#: session_api.xml:209#, no-c-formatmsgid """An important question usually appears at this point: How much does Hibernate ""load from the database and how many SQL <literal>SELECT</literal>s will it ""use? This depends on the <emphasis>fetching strategy</emphasis> and is ""explained in <xref linkend=\"performance-fetching\"/>."msgstr """중요한 질문이 대개 이 지점에서 나타난다: Hibernate는 데이터베이로부터 그것을 ""얼마나 많이 로드시키고 그리고 얼마나 많은 SQL <literal>SELECT</literal>들이 ""그것을 사용할 것인가? 이것은 <emphasis>페칭 방도</emphasis>에 의존하고 <xref ""linkend=\"performance-fetching\"/>에 설명되어 있다."#. Tag: title#: session_api.xml:219#, no-c-formatmsgid "Querying"msgstr "질의하기"#. Tag: para#: session_api.xml:221#, no-c-formatmsgid """If you don't know the identifiers of the objects you are looking for, you ""need a query. Hibernate supports an easy-to-use but powerful object oriented ""query language (HQL). For programmatic query creation, Hibernate supports a ""sophisticated Criteria and Example query feature (QBC and QBE). You may also ""express your query in the native SQL of your database, with optional support ""from Hibernate for result set conversion into objects."msgstr """만일 당신이 당신이 찾고 있는 객체들에 대한 식별자들을 모를 경우, 당신은 하나""의 질의를 필요로 한다. Hibernate는 사용이 쉽지만 강력한 객체 지향 질의 언어""(HQL)를 지원한다. 프로그램 상의 질의 생성을 위해, Hibernate는 정교한 ""Criteria 및 Example 질의 특징(QBC와 QBE)를 지원한다. 당신은 또한 객체들로의 ""결과 셋 변환을 위한 선택적인 Hibernate의 지원으로, 당신의 데이터베이스의 ""native SQL 속에 당신의 질의를 표현할 수도 있다."#. Tag: title#: session_api.xml:231#, no-c-formatmsgid "Executing queries"msgstr "질의들을 실행하기"#. Tag: para#: session_api.xml:233#, no-c-formatmsgid """HQL and native SQL queries are represented with an instance of <literal>org.""hibernate.Query</literal>. This interface offers methods for parameter ""binding, result set handling, and for the execution of the actual query. You ""always obtain a <literal>Query</literal> using the current <literal>Session</""literal>:"msgstr """HQL 질의와 native SQL 질의는 <literal>org.hibernate.Query</literal>의 인스턴""스로 표현된다. 이 인터페이스는 파라미터 바인딩, 결과셋 핸들링을 위한, 그리고 ""실제 질의의 실행을 위한 메소드들을 제공한다. 당신은 항상 현재 ""<literal>Session</literal>을 사용하여 하나의 <literal>Query</literal>를 얻는""다:"#. Tag: programlisting#: session_api.xml:240#, no-c-formatmsgid """<![CDATA[List cats = session.createQuery(\n"" \"from Cat as cat where cat.birthdate < ?\")\n"" .setDate(0, date)\n"" .list();\n""\n""List mothers = session.createQuery(\n"" \"select mother from Cat as cat join cat.mother as mother where cat.name ""= ?\")\n"" .setString(0, name)\n"" .list();\n""\n""List kittens = session.createQuery(\n"" \"from Cat as cat where cat.mother = ?\")\n"" .setEntity(0, pk)\n"" .list();\n""\n""Cat mother = (Cat) session.createQuery(\n"" \"select cat.mother from Cat as cat where cat = ?\")\n"" .setEntity(0, izi)\n"" .uniqueResult();]]\n""\n""Query mothersWithKittens = (Cat) session.createQuery(\n"" \"select mother from Cat as mother left join fetch mother.kittens\");\n""Set uniqueMothers = new HashSet(mothersWithKittens.list());]]>"msgstr ""#. Tag: para#: session_api.xml:242#, no-c-formatmsgid """A query is usually executed by invoking <literal>list()</literal>, the ""result of the query will be loaded completely into a collection in memory. ""Entity instances retrieved by a query are in persistent state. The ""<literal>uniqueResult()</literal> method offers a shortcut if you know your ""query will only return a single object. Note that queries that make use of ""eager fetching of collections usually return duplicates of the root objects ""(but with their collections initialized). You can filter these duplicates ""simply through a <literal>Set</literal>."msgstr """하나의 질의는 대개 <literal>list()</literal>를 호출하여 실행되고, 질의의 결과""는 메모리 내에서 하나의 콜렉션 속으로 전체적으로 로드될 것이다. 하나의 질의""에 의해 검색된 엔티티 인스턴스들은 영속(persistent) 상태에 있다. 당신의 질의""가 하나의 객체를 오직 반환할 것임을 당신이 알고 있을 경우에 ""<literal>uniqueResult()</literal> 메소드는 단축을 제공한다. 콜렉션들에 대해 ""eager 페칭을 사용하는 질의들은 대개 (그것들의 초기화된 콜렉션들을 가진) 루트 ""객체들에 대한 중복들을 대개 반환한다. 당신은 <literal>Set</literal>을 통해 이""들 중복들을 간단하게 필터링할 수 있다."#. Tag: title#: session_api.xml:254#, no-c-formatmsgid "Iterating results"msgstr "결과들을 반복하기"#. Tag: para#: session_api.xml:256#, no-c-formatmsgid """Occasionally, you might be able to achieve better performance by executing ""the query using the <literal>iterate()</literal> method. This will only ""usually be the case if you expect that the actual entity instances returned ""by the query will already be in the session or second-level cache. If they ""are not already cached, <literal>iterate()</literal> will be slower than ""<literal>list()</literal> and might require many database hits for a simple ""query, usually <emphasis>1</emphasis> for the initial select which only ""returns identifiers, and <emphasis>n</emphasis> additional selects to ""initialize the actual instances."msgstr """종종, 당신은 <literal>iterate()</literal> 메소드를 사용하여 질의를 실행함으로""써 더 나은 퍼포먼스를 성취하는 것이 가능할 수 있다. 이것은 오직 대개 질의에 ""의해 반환되는 실제 엔티티 인스턴스들이 이미 세션 내에 있거나 second-level 캐""시 내에 있을 것임을 당신이 예상하는 경우일 것이다. 만일 그것들이 이미 캐시되""지 않았다면, <literal>iterate()</literal>는 <literal>list()</literal> 보다 ""더 느릴 것이고 간단한 질의에 대해 많은 데이터베이스 접속들을, 대개 오직 식별""자들을 반환하는 초기 select에 대해 <emphasis>1</emphasis>번의 접속과 실제 인""스턴스들을 초기화 시키는 추가적인 select들에 대해 <emphasis>n</emphasis> 번""의 접속을 필요로 할 수 있다."#. Tag: programlisting#: session_api.xml:268#, no-c-formatmsgid """<![CDATA[// fetch ids\n""Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\").""iterate();\n""while ( iter.hasNext() ) {\n"" Qux qux = (Qux) iter.next(); // fetch the object\n"" // something we couldnt express in the query\n"" if ( qux.calculateComplicatedAlgorithm() ) {\n"" // delete the current instance\n"" iter.remove();\n"" // dont need to process the rest\n"" break;\n"" }\n""}]]>"msgstr ""#. Tag: title#: session_api.xml:272#, no-c-formatmsgid "Queries that return tuples"msgstr "튜플들을 반환하는 질의들"#. Tag: para#: session_api.xml:274#, no-c-formatmsgid """Hibernate queries sometimes return tuples of objects, in which case each ""tuple is returned as an array:"msgstr """Hibernate 질의들은 때때로 객체들의 튜플들을 반환하고, 그 경우에 각각의 튜플""은 배열로서 반환된다:"#. Tag: programlisting#: session_api.xml:279#, no-c-formatmsgid """<![CDATA[Iterator kittensAndMothers = sess.createQuery(\n"" \"select kitten, mother from Cat kitten join kitten.mother mother""\")\n"" .list()\n"" .iterator();\n""\n""while ( kittensAndMothers.hasNext() ) {\n"" Object[] tuple = (Object[]) kittensAndMothers.next();\n"" Cat kitten = (Cat) tuple[0];\n"" Cat mother = (Cat) tuple[1];\n"" ....\n""}]]>"msgstr ""#. Tag: title#: session_api.xml:284#, no-c-formatmsgid "Scalar results"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -