📄 tutorial.po
字号:
"일 당신이 <literal>getCurrentSession()</literal>을 다시 호출한다면, 당신은 새""로운 <literal>Session</literal>을 얻고 새로운 작업단위를 시작할 수 있다. 이 ""<emphasis>thread-bound</emphasis> 프로그래밍 모형은 Hibernate를 사용하는 가""장 대중적인 방법이다. 왜냐하면 그것은 당신의 코드를 유연하게 계층화시키는 것""을 허용해주기 때문이다(트랜잭션 경계 분할 코드는 데이트 접근 코드와 구별지워""질 수 있는데, 우리는 이 튜토리얼의 뒷부분에서 이것을 다룰 것이다.)."#. Tag: para#: tutorial.xml:441#, no-c-formatmsgid """Related to the unit of work scope, should the Hibernate <literal>Session</""literal> be used to execute one or several database operations? The above ""example uses one <literal>Session</literal> for one operation. This is pure ""coincidence, the example is just not complex enough to show any other ""approach. The scope of a Hibernate <literal>Session</literal> is flexible ""but you should never design your application to use a new Hibernate ""<literal>Session</literal> for <emphasis>every</emphasis> database ""operation. So even if you see it a few more times in the following (very ""trivial) examples, consider <emphasis>session-per-operation</emphasis> an ""anti-pattern. A real (web) application is shown later in this tutorial."msgstr """작업 영역의 단위와 관련하여, Hibernate <literal>Session</literal>은 하나 또""는 여러 개의 데이터베이스 오퍼레이션들을 실행시키는데 사용될 수 있는가? 위의 ""예제는 하나의 오퍼레이션에 한 개의 <literal>Session</literal>을 사용하고 있""다. 이것은 순진한 일치이며, 예제는 어떤 다른 접근법을 보여주기에는 충분히 복""잡하지 않다. Hibernate <literal>Session</literal>의 scope(영역)은 유연하지만 ""당신은 결코 <emphasis>모든</emphasis> 데이터베이스 오퍼레이션 각각에 대해 새""로운 Hibernate <literal>Session</literal>을 사용하도록 당신의 어플리케이션을 ""설계할 수 없다. 따라서 심지어 당신이 다음의 (매우 사소한) 예제들에서 여러 번 ""그것을 볼 수 있을지라도 <emphasis>session-per-operation</emphasis>을 하나의 ""안티-패턴으로 간주하라. 실제 (웹) 어플리케이션은 이 튜토리얼의 뒷부분에 보여""진다."#. Tag: para#: tutorial.xml:452#, no-c-formatmsgid """Have a look at <xref linkend=\"transactions\"/> for more information about ""transaction handling and demarcation. We also skipped any error handling and ""rollback in the previous example."msgstr """트랜잭션 핸들링과 경계구분에 대한 추가 정보는 <xref linkend=\"transactions\"/"">을 살펴보라. 우리는 또한 앞의 예제에서 임의의 오류 처리와 롤백을 생략했다."#. Tag: para#: tutorial.xml:458#, no-c-formatmsgid """To run this first routine we have to add a callable target to the Ant build ""file:"msgstr """이 첫 번째 루틴을 실행하기 위해서 우리는 호출 가능한 대상을 Ant 빌드 파일에 ""추가해야 한다:"#. Tag: programlisting#: tutorial.xml:462#, no-c-formatmsgid """<![CDATA[<target name=\"run\" depends=\"compile\">\n"" <java fork=\"true\" classname=\"events.EventManager\" classpathref=""\"libraries\">\n"" <classpath path=\"${targetdir}\"/>\n"" <arg value=\"${action}\"/>\n"" </java>\n""</target>]]>"msgstr ""#. Tag: para#: tutorial.xml:464#, no-c-formatmsgid """The value of the <literal>action</literal> argument is set on the command ""line when calling the target:"msgstr """<literal>action</literal> 아규먼트의 값은 대상을 호출할 때 명령 라인 상에서 ""설정된다:"#. Tag: programlisting#: tutorial.xml:469#, no-c-formatmsgid "<![CDATA[C:\\hibernateTutorial\\>ant run -Daction=store]]>"msgstr ""#. Tag: para#: tutorial.xml:471#, no-c-formatmsgid """You should see, after compilation, Hibernate starting up and, depending on ""your configuration, lots of log output. At the end you will find the ""following line:"msgstr """컴파일, 구성에 따른 Hibernate 시작 후에, 당신은 많은 로그 출력을 보게 될 것이""다. 끝에서 당신은 다음 라인을 발견할 것이다:"#. Tag: programlisting#: tutorial.xml:476#, no-c-formatmsgid """<![CDATA[[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) ""values (?, ?, ?)]]>"msgstr ""#. Tag: para#: tutorial.xml:478#, no-c-formatmsgid """This is the <literal>INSERT</literal> executed by Hibernate, the question ""marks represent JDBC bind parameters. To see the values bound as arguments, ""or to reduce the verbosity of the log, check your <literal>log4j.properties</""literal>."msgstr """이것은 Hibernate에 의해 실행된 <literal>INSERT</literal>이고, 물음표 기호는 ""JDBC 바인드 파라미터들을 나타낸다. 아규먼트로서 바인드 된 값들을 보거나 장황""한 로그를 줄이려면 당신의 <literal>log4j.properties</literal>를 체크하라."#. Tag: para#: tutorial.xml:484#, no-c-formatmsgid """Now we'd like to list stored events as well, so we add an option to the main ""method:"msgstr """이제 우리는 마찬가지로 저장된 이벤트들을 열거하고자 원하며, 우리는 main 메소""드에 한 개의 옵션을 추가한다:"#. Tag: programlisting#: tutorial.xml:488#, no-c-formatmsgid """<![CDATA[if (args[0].equals(\"store\")) {\n"" mgr.createAndStoreEvent(\"My Event\", new Date());\n""}\n""else if (args[0].equals(\"list\")) {\n"" List events = mgr.listEvents();\n"" for (int i = 0; i < events.size(); i++) {\n"" Event theEvent = (Event) events.get(i);\n"" System.out.println(\"Event: \" + theEvent.getTitle() +\n"" \" Time: \" + theEvent.getDate());\n"" }\n""}]]>"msgstr ""#. Tag: para#: tutorial.xml:490#, no-c-formatmsgid "We also add a new <literal>listEvents() method</literal>:"msgstr """우리는 또한 새로운 <literal>listEvents() method</literal> 메소드를 추가 시킨""다:"#. Tag: programlisting#: tutorial.xml:494#, no-c-formatmsgid """<![CDATA[private List listEvents() {\n""\n"" Session session = HibernateUtil.getSessionFactory().getCurrentSession""();\n""\n"" session.beginTransaction();\n""\n"" List result = session.createQuery(\"from Event\").list();\n""\n"" session.getTransaction().commit();\n""\n"" return result;\n""}]]>"msgstr ""#. Tag: para#: tutorial.xml:496#, no-c-formatmsgid """What we do here is use an HQL (Hibernate Query Language) query to load all ""existing <literal>Event</literal> objects from the database. Hibernate will ""generate the appropriate SQL, send it to the database and populate ""<literal>Event</literal> objects with the data. You can create more complex ""queries with HQL, of course."msgstr """여기서 우리가 행할 것은 데이터베이스로부터 모든 존재하는 <literal>Event</""literal> 객체들을 로드시키기 위해 HQL (Hibernate Query Language) 질의를 사용""하는 것이다. Hibernate는 적절한 SQL을 생성시킬 것이고, 그것을 데이터베이스로 ""전송하고 데이터를 <literal>Event</literal> 객체들에 거주시킬 것이다. 당신은 ""물론 HQL로서 보다 복잡한 질의들을 생성시킬 수 있다."#. Tag: para#: tutorial.xml:503#, no-c-formatmsgid "Now, to execute and test all of this, follow these steps:"msgstr "이제 이 모든 것을 실행하고 테스트하기 위해, 다음 단계들을 따르라:"#. Tag: para#: tutorial.xml:509#, no-c-formatmsgid """Run <literal>ant run -Daction=store</literal> to store something into the ""database and, of course, to generate the database schema before through ""hbm2ddl."msgstr """데이터베이스 속으로 어떤 것을 저장하고 물론 앞서 hbm2ddl을 통해 데이터베이스 ""스키마를 산출시키기 위해 <literal>ant run -Daction=store</literal>를 실행하""라."#. Tag: para#: tutorial.xml:515#, no-c-formatmsgid """Now disable hbm2ddl by commenting out the property in your ""<literal>hibernate.cfg.xml</literal> file. Usually you only leave it turned ""on in continous unit testing, but another run of hbm2ddl would ""<emphasis>drop</emphasis> everything you have stored - the <literal>create</""literal> configuration setting actually translates into \"drop all tables ""from the schema, then re-create all tables, when the SessionFactory is build""\"."msgstr """이제 당신의 <literal>hibernate.cfg.xml</literal> 파일 속에서 그 프로퍼티를 주""석처리함으로써 hbm2ddl을 사용불가능하게 하라. 대개 당신은 지속되는 단위 테스""팅에서는 그것을 사용 가능하게 내버려두어도 되지만, 또 다른 hbm2ddl의 실행은 ""당신이 저장했던 모든 것을 <emphasis>drop</emphasis>시킬 것이다 - ""<literal>create</literal> 구성 설정은 실제로 \"스키마로부터 모든 테이블들을 ""드롭시키고 나서, SessionFactory가 빌드될 때 모든 테이블들을 다시 생성시키는 ""것\"으로 변환된다."#. Tag: para#: tutorial.xml:525#, no-c-formatmsgid """If you now call Ant with <literal>-Daction=list</literal>, you should see ""the events you have stored so far. You can of course also call the ""<literal>store</literal> action a few times more."msgstr """만일 당신이 지금 <literal>-Daction=list</literal>로 Ant를 호출할 경우, 당신""은 당신이 지금까지 저장했던 이벤트들을 보게 될 것이다. 물론 당신은 또한 여러 ""번 <literal>store</literal> 액션을 호출할 수 있다."#. Tag: para#: tutorial.xml:531#, no-c-formatmsgid """Note: Most new Hibernate users fail at this point and we see questions about ""<emphasis>Table not found</emphasis> error messages regularly. However, if ""you follow the steps outlined above you will not have this problem, as ""hbm2ddl creates the database schema on the first run, and subsequent ""application restarts will use this schema. If you change the mapping and/or ""database schema, you have to re-enable hbm2ddl once again."msgstr """노트 : 대부분의 Hibernate 사용자들은 이 지점에서 실패하고 우리는 정기적으로 ""<emphasis>Table not found</emphasis> 오류 메시지들에 관한 질문을 받는다. 하지""만 만일 당신이 위에 조명된 단게들을 따를 경우 당신은 이 문제를 겪지 않을 것이""고, hbm2ddl이 처음 실행 시에 데이터베이스 스키마를 생성시키므로, 차후의 어플""리케이션 재시작은 이 스키마를 사용할 것이다. 만일 당신이 매핑 그리고/또는 데""이터베이스 스키마를 변경할 경우에, 당신은 다시 한번 더 hbm2ddl을 이용 가능하""도록 해야 한다."#. Tag: title#: tutorial.xml:544#, no-c-formatmsgid "Part 2 - Mapping associations"msgstr "파트 2 - 연관들을 매핑하기"#. Tag: para#: tutorial.xml:546#, no-c-formatmsgid """We mapped a persistent entity class to a table. Let's build on this and add ""some class associations. First we'll add people to our application, and ""store a list of events they participate in."msgstr """우리는 한 개의 영속 엔티티 클래스를 한 개의 테이블로 매핑했다. 이것 위에서 빌""드하고 몇몇 클래스 연관들을 추가시키자. 먼저 우리는 우리의 어플리케이션에 사""람들을 추가하고 그들이 참여하는 이벤트들의 목록을 저장할 것이다."#. Tag: title#: tutorial.xml:552#, no-c-formatmsgid "Mapping the Person class"msgstr "Person 클래스 매핑하기"#. Tag: para#: tutorial.xml:554#, no-c-formatmsgid "The first cut of the <literal>Person</literal> class is simple:"msgstr "클래스의 첫 번째 장면은 간단하다:"#. Tag: programlisting#: tutorial.xml:558#, no-c-formatmsgid """<![CDATA[package events;\n""\n""public class Person {\n""\n"" private
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -