alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
\");\n" " out.println(\"<td>\" + dateFormatter.format(event.getDate()) " "+ \"</td>\");\n" " out.println(\"</tr>\");\n" " }\n" " out.println(\"</table>\");\n" " }\n" " }]]>" msgstr "" "private void listEvents(PrintWriter out, SimpleDateFormat dateFormatter) {\n" "\n" " List result = HibernateUtil.getSessionFactory()\n" " .getCurrentSession().createCriteria(Event.class).list" "();\n" " if (result.size() > 0) {\n" " out.println(\"<h2>Events in database:</h2>\");\n" " out.println(\"<table border='1'>\");\n" " out.println(\"<tr>\");\n" " out.println(\"<th>Event title</th>\");\n" " out.println(\"<th>Event date</th>\");\n" " out.println(\"</tr>\");\n" " for (Iterator it = result.iterator(); it.hasNext();) {\n" " Event event = (Event) it.next();\n" " out.println(\"<tr>\");\n" " out.println(\"<td>\" + event.getTitle() + \"</td>" "\");\n" " out.println(\"<td>\" + dateFormatter.format(event.getDate" "()) + \"</td>\");\n" " out.println(\"</tr>\");\n" " }\n" " out.println(\"</table>\");\n" " }\n" "}" #. Tag: para #: tutorial.xml:1052 #, no-c-format msgid "" "Finally, the <literal>store action is dispatched to the " "<literal>createAndStoreEvent() method, which also uses the " "<literal>Session of the current thread:" msgstr "" "Zuletzt wird die <literal>store-Vorgang zur " "<literal>createAndStoreEvent()-Methode gesendet, die ebenfalls die " "<literal>Session des aktuellen Threads verwendet:" #. Tag: programlisting #: tutorial.xml:1058 #, fuzzy, no-c-format msgid "" "<![CDATA[ protected void createAndStoreEvent(String title, Date theDate) " "{\n" " Event theEvent = new Event();\n" " theEvent.setTitle(title);\n" " theEvent.setDate(theDate);\n" "\n" " HibernateUtil.getSessionFactory()\n" " .getCurrentSession().save(theEvent);\n" " }]]>" msgstr "" "protected void createAndStoreEvent(String title, Date theDate) {\n" " Event theEvent = new Event();\n" " theEvent.setTitle(title);\n" " theEvent.setDate(theDate);\n" "\n" " HibernateUtil.getSessionFactory()\n" " .getCurrentSession().save(theEvent);\n" "}" #. Tag: para #: tutorial.xml:1060 #, fuzzy, no-c-format msgid "" "The servlet is now complete. A request to the servlet will be processed in a " "single <literal>Session and Transaction. As " "earlier in the standalone application, Hibernate can automatically bind " "these objects to the current thread of execution. This gives you the freedom " "to layer your code and access the <literal>SessionFactory in any " "way you like. Usually you would use a more sophisticated design and move the " "data access code into data access objects (the DAO pattern). See the " "Hibernate Wiki for more examples." msgstr "" "Das Servlet ist jetzt komplett. Eine Anfrage beim Servlet wird in einer " "einzelnen <literal>Session und Transaction " "bearbeitet. Wie zuvor in der selbständigen Anwendung kann Hibernate diese " "Objekte automatisch an den aktuellen Ausführungsthread binden. Das gibt " "Ihnen die Freiheit, Ihren Code zu schichten und in beliebiger Weise auf die " "<literal>SessionFactory zuzugreifen. In der Regel würden Sie ein " "differenzierteres Design verwenden und den Datenzugriffscode in die " "Datenzugriffsobjekte (das DAO-Muster) verlegen. Auf Hibernate Wiki finden " "Sie weitere Beispiele." #. Tag: title #: tutorial.xml:1074 #, no-c-format msgid "Deploying and testing" msgstr "Deployment und Test" #. Tag: para #: tutorial.xml:1076 #, no-c-format msgid "" "To deploy this application for testing we must create a Web ARchive (WAR). " "First we must define the WAR descriptor as <filename>src/main/webapp/WEB-INF/" "web.xml</filename>" msgstr "" #. Tag: programlisting #: tutorial.xml:1082 #, fuzzy, no-c-format msgid "" "<![CDATA[\n" " <servlet-class>org.hibernate.tutorial.web.EventManagerServlet\n" " <url-pattern>/eventmanager\n" " </servlet-mapping>\n" "</web-app>]]>" msgstr "" "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<web-app version=\"2.4\"\n" " xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n" " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" " xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n" " http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" "\n" " <servlet>\n" " <servlet-name>Event Manager</servlet-name>\n" " <servlet-class>events.EventManagerServlet</servlet-" "class>\n" " </servlet>\n" "\n" " <servlet-mapping>\n" " <servlet-name>Event Manager</servlet-name>\n" " <url-pattern>/eventmanager</url-pattern>\n" " </servlet-mapping>\n" "</web-app>" #. Tag: para #: tutorial.xml:1084 #, fuzzy, no-c-format msgid "" "To build and deploy call <literal>mvn package in your project " "directory and copy the <filename>hibernate-tutorial.war file into " "your Tomcat <filename>webapps directory." msgstr "" "Um den <literal>ant war-Aufruf (\"call\") in Ihrem " "Projektverzeichnis zu bauen und auszuführen, kopieren Sie die " "<literal>hibernate-tutorial.war-Datei in Ihr Tomcat " "<literal>webapp-Verzeichnis. Falls Tomcat bei Ihnen nicht " "installiert ist, laden Sie es herunter, und folgen Sie den " "Installationsanweisungen. Sie müssen jedoch keine Konfigurationen von Tomcat " "ändern, um diese Anwendung auszuführen." #. Tag: para #: tutorial.xml:1091 #, no-c-format msgid "" "If you do not have Tomcat installed, download it from <ulink url=\"http://" "tomcat.apache.org/\"></ulink> and follow the installation instructions. Our " "application requires no changes to the standard Tomcat configuration." msgstr "" #. Tag: para #: tutorial.xml:1099 #, no-c-format msgid "" "Once deployed and Tomcat is running, access the application at " "<literal>http://localhost:8080/hibernate-tutorial/eventmanager. " "Make sure you watch the Tomcat log to see Hibernate initialize when the " "first request hits your servlet (the static initializer in " "<literal>HibernateUtil is called) and to get the detailed output " "if any exceptions occurs." msgstr "" "Wenn das Deployment erfolgt ist und Tomcat ausgeführt wird, greifen Sie " "mittels <literal>http://localhost:8080/hibernate-tutorial/eventmanager." msgstr "" "Diese Anleitung behandelt in Grundzügen die Erstellung einer einfachen " "selbständigen Hibernate-Applikation und einer kleinen Webanwendung."

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate tutorial.po source code file:

Hibernate example source code file (tutorial.po)

This example Hibernate source code file (tutorial.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

cdata, die, event, hibernate, hibernate, java, person, sie, sie, tag, tag, the, the, this

The Hibernate tutorial.po source code

# translation of Collection_Mapping.po to 
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# Language /mnt/hgfs/base/Hibernate/Reference translations for PACKAGE package.
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
# Automatically generated, 2006.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
# , 2007.
#
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-20 21:02+0000\n"
"PO-Revision-Date: 2007-02-26 10:27+1000\n"
"Last-Translator: \n"
"Language-Team:  <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.9.1\n"

#. Tag: title
#: tutorial.xml:34
#, no-c-format
msgid "Tutorial"
msgstr ""

#. Tag: para
#: tutorial.xml:36
#, no-c-format
msgid ""
"Intended for new users, this chapter provides an step-by-step introduction "
"to Hibernate, starting with a simple application using an in-memory "
"database. The tutorial is based on an earlier tutorial developed by Michael "
"Gloegl. All code is contained in the <filename>tutorials/web "
"directory of the project source."
msgstr ""

#. Tag: para
#: tutorial.xml:45
#, no-c-format
msgid ""
"This tutorial expects the user have knowledge of both Java and SQL. If you "
"have a limited knowledge of JAVA or SQL, it is advised that you start with a "
"good introduction to that technology prior to attempting to learn Hibernate."
msgstr ""

#. Tag: para
#: tutorial.xml:54
#, no-c-format
msgid ""
"The distribution contains another example application under the "
"<filename>tutorial/eg project source directory."
msgstr ""

#. Tag: title
#: tutorial.xml:62
#, no-c-format
msgid "Part 1 - The first Hibernate Application"
msgstr "Teil 1 - Die erste Hibernate Anwendung"

#. Tag: para
#: tutorial.xml:64
#, fuzzy, no-c-format
msgid ""
"For this example, we will set up a small database application that can store "
"events we want to attend and information about the host(s) of these events."
msgstr ""
"Nehmen wir etwa an, wir bräuchten eine kleine Datenbank-Anwendung zur "
"Speicherung von Veranstaltungen, an denen wir teilnehmen wollen sowie "
"Informationen zu deren Organisatoren."

#. Tag: para
#: tutorial.xml:70
#, no-c-format
msgid ""
"Although you can use whatever database you feel comfortable using, we will "
"use <ulink url=\"http://hsqldb.org/\">HSQLDB (an in-memory, Java "
"database) to avoid describing installation/setup of any particular database "
"servers."
msgstr ""

#. Tag: title
#: tutorial.xml:79
#, no-c-format
msgid "Setup"
msgstr ""

#. Tag: para
#: tutorial.xml:81
#, no-c-format
msgid ""
"The first thing we need to do is to set up the development environment. We "
"will be using the \"standard layout\" advocated by alot of build tools such "
"as <ulink url=\"http://maven.org\">Maven. Maven, in particular, has "
"a good resource describing this <ulink url=\"http://maven.apache.org/guides/"
"introduction/introduction-to-the-standard-directory-layout.html\">layout</"
"ulink>. As this tutorial is to be a web application, we will be creating and "
"making use of <filename>src/main/java, src/main/"
"resources</filename> and src/main/webapp directories."
msgstr ""

#. Tag: para
#: tutorial.xml:91
#, no-c-format
msgid ""
"We will be using Maven in this tutorial, taking advantage of its transitive "
"dependency management capabilities as well as the ability of many IDEs to "
"automatically set up a project for us based on the maven descriptor."
msgstr ""

#. Tag: programlisting
#: tutorial.xml:97
#, no-c-format
msgid ""
"<![CDATA[\n"
"\n"
"    <groupId>org.hibernate.tutorials\n"
"    <artifactId>hibernate-tutorial\n"
"    <version>1.0.0-SNAPSHOT\n"
"    <name>First Hibernate Tutorial\n"
"\n"
"    <build>\n"
"         <!-- we dont want the version to be part of the generated war file "
"name -->\n"
"         <finalName>${artifactId}\n"
"    </build>\n"
"\n"
"    <dependencies>\n"
"        <dependency>\n"
"            <groupId>org.hibernate\n"
"            <artifactId>hibernate-core\n"
"        </dependency>\n"
"\n"
"        <!-- Because this is a web app, we also have a dependency on the "
"servlet api. -->\n"
"        <dependency>\n"
"            <groupId>javax.servlet\n"
"            <artifactId>servlet-api\n"
"        </dependency>\n"
"\n"
"        <!-- Hibernate uses slf4j for logging, for our purposes here use the "
"simple backend -->\n"
"        <dependency>\n"
"            <groupId>org.slf4j\n"
"            <artifactId>slf4j-simple\n"
"        </dependency>\n"
"\n"
"        <!-- Hibernate gives you a choice of bytecode providers between "
"cglib and javassist -->\n"
"        <dependency>\n"
"            <groupId>javassist\n"
"            <artifactId>javassist\n"
"        </dependency>\n"
"    </dependencies>\n"
"\n"
"</project>]]>"
msgstr ""

#. Tag: para
#: tutorial.xml:100
#, no-c-format
msgid ""
"It is not a requirement to use Maven. If you wish to use something else to "
"build this tutorial (such as Ant), the layout will remain the same. The only "
"change is that you will need to manually account for all the needed "
"dependencies. If you use something like <ulink url=\"http://ant.apache.org/"
"ivy/\">Ivy</ulink> providing transitive dependency management you would "
"still use the dependencies mentioned below. Otherwise, you'd need to grab "
"<emphasis>all dependencies, both explicit and transitive, and add "
"them to the project's classpath. If working from the Hibernate distribution "
"bundle, this would mean <filename>hibernate3.jar, all artifacts "
"in the <filename>lib/required directory and all files from either "
"the <filename>lib/bytecode/cglib or lib/bytecode/"
"javassist</filename> directory; additionally you will need both the servlet-"
"api jar and one of the slf4j logging backends."
msgstr ""

#. Tag: para
#: tutorial.xml:117
#, no-c-format
msgid ""
"Save this file as <filename>pom.xml in the project root directory."
msgstr ""

#. Tag: title
#: tutorial.xml:124
#, no-c-format
msgid "The first class"
msgstr "Die erste Klasse"

#. Tag: para
#: tutorial.xml:126
#, fuzzy, no-c-format
msgid ""
"Next, we create a class that represents the event we want to store in the "
"database; it is a simple JavaBean class with some properties:"
msgstr ""
"Anschließend erstellen wir eine Klasse, die die Veranstaltung repräsentiert, "
"die in der Datenbank gespeichert werden soll."

#. Tag: programlisting
#: tutorial.xml:131
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial.domain;\n"
"\n"
"import java.util.Date;\n"
"\n"
"public class Event {\n"
"    private Long id;\n"
"\n"
"    private String title;\n"
"    private Date date;\n"
"\n"
"    public Event() {}\n"
"\n"
"    public Long getId() {\n"
"        return id;\n"
"    }\n"
"\n"
"    private void setId(Long id) {\n"
"        this.id = id;\n"
"    }\n"
"\n"
"    public Date getDate() {\n"
"        return date;\n"
"    }\n"
"\n"
"    public void setDate(Date date) {\n"
"        this.date = date;\n"
"    }\n"
"\n"
"    public String getTitle() {\n"
"        return title;\n"
"    }\n"
"\n"
"    public void setTitle(String title) {\n"
"        this.title = title;\n"
"    }\n"
"}]]>"
msgstr ""
"package events;\n"
"\n"
"import java.util.Date;\n"
"\n"
"public class Event {\n"
"    private Long id;\n"
"\n"
"    private String title;\n"
"    private Date date;\n"
"\n"
"    public Event() {}\n"
"\n"
"    public Long getId() {\n"
"        return id;\n"
"    }\n"
"\n"
"    private void setId(Long id) {\n"
"        this.id = id;\n"
"    }\n"
"\n"
"    public Date getDate() {\n"
"        return date;\n"
"    }\n"
"\n"
"    public void setDate(Date date) {\n"
"        this.date = date;\n"
"    }\n"
"\n"
"    public String getTitle() {\n"
"        return title;\n"
"    }\n"
"\n"
"    public void setTitle(String title) {\n"
"        this.title = title;\n"
"    }\n"
"}"

#. Tag: para
#: tutorial.xml:133
#, fuzzy, no-c-format
msgid ""
"This class uses standard JavaBean naming conventions for property getter and "
"setter methods, as well as private visibility for the fields. Although this "
"is the recommended design, it is not required. Hibernate can also access "
"fields directly, the benefit of accessor methods is robustness for "
"refactoring."
msgstr ""
"Sie sehen, dass diese Klasse standardmäßige JavaBean Namenskonventionen für "
"Getter- und Setter-Methoden der Property sowie eigene Sichtbarkeit für die "
"Felder verwendet. Dieses ist der empfohlene - nicht aber der vorgeschriebene "
"- Entwurf. Hibernate kann auch direkt auf Felder zugreifen, wobei der "
"Vorteil dieser Zugriffsmethoden in der Stabilität bei der Steigerung der "
"Bedienerfreundlichkeit liegt. Der \"No-Argument\"-Konstruktor (d.h. der "
"Konstruktor ohne Parameter) wird benötigt, um ein Objekt dieser Klasse durch "
"Reflexion zu instanziieren."

#. Tag: para
#: tutorial.xml:141
#, fuzzy, no-c-format
msgid ""
"The <literal>id property holds a unique identifier value for a "
"particular event. All persistent entity classes (there are less important "
"dependent classes as well) will need such an identifier property if we want "
"to use the full feature set of Hibernate. In fact, most applications, "
"especially web applications, need to distinguish objects by identifier, so "
"you should consider this a feature rather than a limitation. However, we "
"usually do not manipulate the identity of an object, hence the setter method "
"should be private. Only Hibernate will assign identifiers when an object is "
"saved. Hibernate can access public, private, and protected accessor methods, "
"as well as public, private and protected fields directly. The choice is up "
"to you and you can match it to fit your application design."
msgstr ""
"Die <literal>id-Property enthält einen eindeutigen \"Identifier\"-"
"Wert (Bezeichnerwert) für eine bestimmte Veranstaltung. Alle persistenten "
"Entity-Klassen (es existieren außerdem weniger wichtige abhängige Klassen) "
"werden eine solche Bezeichner-Property benötigen, falls Sie sämtliche "
"Features von Hibernate verwenden möchten. Die meisten Applikationen (und "
"insbesondere Webanwendungen) müssen Objekte mittels Bezeichner "
"unterscheiden, daher sollten Sie dies eher als zusätzliches Feature und "
"nicht als Einschränkung ansehen. Allerdings wird die Identität eines Objekts "
"in der Regel nicht verändert, weswegen die \"Setter\"-Methode nicht "
"öffentlich sein sollte. Ausschließlich Hibernate wird bei der Speicherung "
"eines Objekts Bezeichner zuweisen. Sie sehen also, dass Hibernate "
"öffentliche, nicht-öffentliche und geschützte Zugriffsmethoden aufrufen "
"kann. Die Entscheidung liegt ganz bei Ihnen, und Sie können die Wahl Ihren "
"persönlichen Bedürfnissen anpassen."

#. Tag: para
#: tutorial.xml:156
#, fuzzy, no-c-format
msgid ""
"The no-argument constructor is a requirement for all persistent classes; "
"Hibernate has to create objects for you, using Java Reflection. The "
"constructor can be private, however package or public visibility is required "
"for runtime proxy generation and efficient data retrieval without bytecode "
"instrumentation."
msgstr ""
"Der \"No-Argument\"-Konstruktor (d.h. der Konstruktor ohne Parameter) ist "
"eine Voraussetzung für alle persistenten Klassen. Hibernate erstellt unter "
"Verwendung von Java Reflection diese Objekte für Sie. Der Konstruktor kann "
"nicht-öffentlich sein, jedoch werden bei der Proxy-Generierung zur Runtime "
"Sichtbarkeit der Pakete sowie effizienter Datenabruf ohne Bytecode-"
"Instrumentierung benötigt."

#. Tag: para
#: tutorial.xml:164
#, no-c-format
msgid ""
"Save this file to the <filename>src/main/java/org/hibernate/tutorial/domain"
msgstr ""
"<?xml version=\"1.0\"?>\n"
"<!DOCTYPE hibernate-mapping PUBLIC\n"
"        \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
"        \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
"\n"
"<hibernate-mapping>\n"
"[...]\n"
"</hibernate-mapping>"

#. Tag: para
#: tutorial.xml:187
#, fuzzy, no-c-format
msgid ""
"Hibernate DTD is sophisticated. You can use it for auto-completion of XML "
"mapping elements and attributes in your editor or IDE. Opening up the DTD "
"file in your text editor is the easiest way to get an overview of all "
"elements and attributes, and to view the defaults, as well as some comments. "
"Hibernate will not load the DTD file from the web, but first look it up from "
"the classpath of the application. The DTD file is included in "
"<filename>hibernate-core.jar (it is also included in the "
"<filename>hibernate3.jar, if using the distribution bundle)."
msgstr ""
"Bitte beachten Sie, dass Hibernate DTD technisch sehr ausgefeilt ist. Sie "
"können es für Auto-Vervollständigung von XML-Mapping-Elementen und "
"Attributen in Ihrem Editor oder IDE verwenden. Sie sollte die DTD-Datei in "
"Ihrem Text-Editor öffnen - es ist die bequemste Art einen Überblick über "
"alle Elemente und Attribute zu bekommen und die Standardeinstellungen sowie "
"einige Kommentare zu sehen. Bitte beachten Sie, dass Hibernate die DTD-Datei "
"nicht aus dem Web lädt, sondern sie vom Klassenpfad der Anwendung aufsucht. "
"Die DTD-Datei ist im <literal>hibernate3.jar sowie im src/"
"</literal>-Verzeichnis der Hibernate-Distribution enthalten."

#. Tag: para
#: tutorial.xml:200
#, fuzzy, no-c-format
msgid ""
"We will omit the DTD declaration in future examples to shorten the code. It "
"is, of course, not optional."
msgstr ""
"In zukünftigen Beispielen werden wir die DTD-Deklaration weglassen, um den "
"Code zu verkürzen. Natürlich ist dies nicht optional."

#. Tag: para
#: tutorial.xml:206
#, fuzzy, no-c-format
msgid ""
"Between the two <literal>hibernate-mapping tags, include a "
"<literal>class element. All persistent entity classes (again, "
"there might be dependent classes later on, which are not first-class "
"entities) need a mapping to a table in the SQL database:"
msgstr ""
"Zwischen den beiden <literal>hibernate-mapping-Tags fügen Sie ein "
"<literal>class-Element ein. Alle persistenten Entity-Klassen "
"(wieder kann es später zu abhängigen Klassen kommen, die keine Entities der "
"ersten Klasse sind) benötigen ein solches Mapping zu einer Tabelle in der "
"SQL-Datenbank:"

#. Tag: programlisting
#: tutorial.xml:213
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
msgstr ""
"<hibernate-mapping>\n"
"\n"
"    <class name=\"events.Event\" table=\"EVENTS\">\n"
"\n"
"    </class>\n"
"\n"
"</hibernate-mapping>"

#. Tag: para
#: tutorial.xml:215
#, fuzzy, no-c-format
msgid ""
"So far we have told Hibernate how to persist and load object of class "
"<literal>Event to the table EVENTS. Each "
"instance is now represented by a row in that table. Now we can continue by "
"mapping the unique identifier property to the tables primary key. As we do "
"not want to care about handling this identifier, we configure Hibernate's "
"identifier generation strategy for a surrogate primary key column:"
msgstr ""
"Mit den bisherigen Schritten haben wir Hibernate darüber informiert, wie ein "
"Objekt der Klasse <literal>Event in die Tabelle EVENTS"
msgstr ""
"<hibernate-mapping>\n"
"\n"
"    <class name=\"events.Event\" table=\"EVENTS\">\n"
"        <id name=\"id\" column=\"EVENT_ID\">\n"
"            <generator class=\"native\"/>\n"
"        </id>\n"
"    </class>\n"
"\n"
"</hibernate-mapping>"

#. Tag: para
#: tutorial.xml:227
#, no-c-format
msgid ""
"The <literal>id element is the declaration of the identifier "
"property. The <literal>name=\"id\" mapping attribute declares the "
"name of the JavaBean property and tells Hibernate to use the <literal>getId()"
"</literal> and setId() methods to access the property. "
"The column attribute tells Hibernate which column of the <literal>EVENTS element specifies the identifier "
"generation strategy (aka how are identifier values generated?). In this case "
"we choose <literal>native, which offers a level of portability "
"depending on the configured database dialect. Hibernate supports database "
"generated, globally unique, as well as application assigned, identifiers. "
"Identifier value generation is also one of Hibernate's many extension points "
"and you can plugin in your own strategy."
msgstr ""

#. Tag: para
#: tutorial.xml:249
#, no-c-format
msgid ""
"<literal>native is no longer consider the best strategy in terms "
"of portability. for further discussion, see"
msgstr ""

#. Tag: para
#: tutorial.xml:255
#, fuzzy, no-c-format
msgid ""
"Lastly, we need to tell Hibernate about the remaining entity class "
"properties. By default, no properties of the class are considered persistent:"
msgstr ""
"Zuletzt nehmen wir Vereinbarungen für die persistenten Properties der Klasse "
"in die Mapping-Datei auf. In der Standardeinstellung werden keine Properties "
"der Klasse als persistent angesehen:"

#. Tag: programlisting
#: tutorial.xml:261
#, fuzzy, no-c-format
msgid ""
"<![CDATA[\n"
"<hibernate-mapping package=\"org.hibernate.tutorial.domain\">\n"
"\n"
"    <class name=\"Event\" table=\"EVENTS\">\n"
"        <id name=\"id\" column=\"EVENT_ID\">\n"
"            <generator class=\"native\"/>\n"
"        </id>\n"
"        <property name=\"date\" type=\"timestamp\" column=\"EVENT_DATE\"/>\n"
"        <property name=\"title\"/>\n"
"    </class>\n"
"\n"
"</hibernate-mapping>]]>"
msgstr ""
"<hibernate-mapping>\n"
"\n"
"    <class name=\"events.Event\" table=\"EVENTS\">\n"
"        <id name=\"id\" column=\"EVENT_ID\">\n"
"            <generator class=\"native\"/>\n"
"        </id>\n"
"        <property name=\"date\" type=\"timestamp\" column=\"EVENT_DATE\"/"
">\n"
"        <property name=\"title\"/>\n"
"    </class>\n"
"\n"
"</hibernate-mapping>"

#. Tag: para
#: tutorial.xml:263
#, fuzzy, no-c-format
msgid ""
"Similar to the <literal>id element, the name "
"attribute of the <literal>property element tells Hibernate which "
"getter and setter methods to use. In this case, Hibernate will search for "
"<literal>getDate(), setDate(), getTitle"
"()</literal> and setTitle() methods."
msgstr ""
"Genau wie das <literal>id-Element informiert auch das "
"<literal>name-Attribut des property-Elements "
"Hibernate darüber, welche Getter- und Setter-Methoden verwendet werden "
"sollen. In diesem Fall wird Hibernate also nach <literal>getDate()/setDate()"
"</literal> sowie getTitle()/setTitle() suchen."

#. Tag: para
#: tutorial.xml:274
#, fuzzy, no-c-format
msgid ""
"Why does the <literal>date property mapping include the "
"<literal>column attribute, but the title does "
"not? Without the <literal>column attribute, Hibernate by default "
"uses the property name as the column name. This works for <literal>titledate is a reserved keyword in most "
"databases so you will need to map it to a different name."
msgstr ""
"Warum aber enthält das <literal>date Property-Mapping "
"das<literal>column-Attribut, title jedoch "
"nicht? Ohne das <literal>column-Attribut verwendet Hibernate "
"standardmäßig den Namen der Property als Spaltennamen. Dies funktioniert gut "
"für <literal>title. Allerdings ist date in den "
"meisten Datenbanken ein reservierter Schlüsselbegriff, so dass es besser zu "
"einem anderen Namen gemappt werden sollte."

#. Tag: para
#: tutorial.xml:284
#, fuzzy, no-c-format
msgid ""
"The <literal>title mapping also lacks a type "
"attribute. The types declared and used in the mapping files are not Java "
"data types; they are not SQL database types either. These types are called "
"<emphasis>Hibernate mapping types, converters which can translate "
"from Java to SQL data types and vice versa. Again, Hibernate will try to "
"determine the correct conversion and mapping type itself if the "
"<literal>type attribute is not present in the mapping. In some "
"cases this automatic detection using Reflection on the Java class might not "
"have the default you expect or need. This is the case with the "
"<literal>date property. Hibernate cannot know if the property, "
"which is of <literal>java.util.Date, should map to a SQL "
"<literal>date, timestamp, or time converter."
msgstr ""
"Ebenfalls interessant ist die Tatsache, dass das <literal>title-"
"Mapping ebenfalls über kein <literal>type-Attribut verfügt. Die "
"von uns deklarierten und in den Mapping-Dateien verwendeten Typen sind "
"nicht, wie man vielleicht erwarten würde, Java-Datentypen. Es handelt sich "
"auch nicht um SQL-Datenbank-Typen. Diese Typen sind so genannte <emphasis>"
"\"Hibernate Mapping-Typen\"</emphasis>, Konverter, die von Java in SQL-"
"Datentypen und umgekehrt übersetzen können. Auch hier wird Hibernate selbst "
"versuchen die Datenkonvertierung zu bestimmen, falls das <literal>type-Property der Fall. "
"Hibernate weiß nicht, ob die Property (die von <literal>java.util.Datedate, einer "
"<literal>timestamp oder einer time-Spalte "
"mappen sollte. Vollständige Informationen zu Datum und Zeit werden durch das "
"Mapping der Property mit einem <literal>timestamp-Konverter "
"verwahrt."

#. Tag: para
#: tutorial.xml:300
#, no-c-format
msgid ""
"Hibernate makes this mapping type determination using reflection when the "
"mapping files are processed. This can take time and resources, so if startup "
"performance is important you should consider explicitly defining the type to "
"use."
msgstr ""

#. Tag: para
#: tutorial.xml:307
#, no-c-format
msgid ""
"Save this mapping file as <filename>src/main/resources/org/hibernate/"
"tutorial/domain/Event.hbm.xml</filename>."
msgstr ""

#. Tag: title
#: tutorial.xml:315
#, no-c-format
msgid "Hibernate configuration"
msgstr "Die Konfiguration von Hibernate"

#. Tag: para
#: tutorial.xml:317
#, no-c-format
msgid ""
"At this point, you should have the persistent class and its mapping file in "
"place. It is now time to configure Hibernate. First let's set up HSQLDB to "
"run in \"server mode\""
msgstr ""

#. Tag: para
#: tutorial.xml:324
#, no-c-format
msgid "We do this do that the data remains between runs."
msgstr ""

#. Tag: para
#: tutorial.xml:329
#, fuzzy, no-c-format
msgid ""
"We will utilize the Maven exec plugin to launch the HSQLDB server by "
"running: <command> mvn exec:java -Dexec.mainClass=\"org.hsqldb.Server\" -"
"Dexec.args=\"-database.0 file:target/data/tutorial\"</command> You will see "
"it start up and bind to a TCP/IP socket; this is where our application will "
"connect later. If you want to start with a fresh database during this "
"tutorial, shutdown HSQLDB, delete all files in the <filename>target/data im "
"Stammverzeichnis des Entwicklungsverzeichnisses - hier wird HSQL DB seine "
"Datendateien speichern. Starten Sie die Datenbank, indem Sie <literal>java -"
"classpath ../lib/hsqldb.jar org.hsqldb.Server</literal> in diesem "
"Datenverzeichnis ausführen. Sie sehen, wie sie hochfährt und auf ein TCP/IP-"
"Socket anspricht, an dem sich die Anwendung später verbindet. Falls Sie "
"während dieser Anleitung mit einer frischen Datenbank starten wollen, "
"schließen Sie HSQL DB (drücken Sie <literal>CTRL + C im Fenster), "
"löschen Sie alle Dateien im <literal>data/-Verzeichnis und starten "
"Sie HSQL DB erneut."

#. Tag: para
#: tutorial.xml:340
#, no-c-format
msgid ""
"Hibernate will be connecting to the database on behalf of your application, "
"so it needs to know how to obtain connections. For this tutorial we will be "
"using a standalone connection pool (as opposed to a <interfacename>javax.sql."
"DataSource</interfacename>). Hibernate comes with support for two third-"
"party open source JDBC connection pools: <ulink url=\"https://sourceforge."
"net/projects/c3p0\">c3p0</ulink> and . However, we will be using the Hibernate built-in "
"connection pool for this tutorial."
msgstr ""

#. Tag: para
#: tutorial.xml:351
#, fuzzy, no-c-format
msgid ""
"The built-in Hibernate connection pool is in no way intended for production "
"use. It lacks several features found on any decent connection pool."
msgstr "Hash-Tabelle (nicht für den Produktionsgebrauch vorgesehen)"

#. Tag: para
#: tutorial.xml:357
#, fuzzy, no-c-format
msgid ""
"For Hibernate's configuration, we can use a simple <literal>hibernate."
"properties</literal> file, a more sophisticated hibernate.cfg.xmlhibernate."
"cfg.xml</literal>-Datei oder sogar ein kompletter programmorientierter "
"Aufbau verwendet werden. Die meisten Benutzer bevorzugen die XML-"
"Konfigurationsdatei:"

#. Tag: programlisting
#: tutorial.xml:363
#, fuzzy, no-c-format
msgid ""
"<![CDATA[\n"
"        <property name=\"connection.password\">\n"
"\n"
"        <!-- JDBC connection pool (use the built-in) -->\n"
"        <property name=\"connection.pool_size\">1\n"
"\n"
"        <!-- SQL dialect -->\n"
"        <property name=\"dialect\">org.hibernate.dialect.HSQLDialect\n"
"\n"
"        <!-- Disable the second-level cache  -->\n"
"        <property name=\"cache.provider_class\">org.hibernate.cache."
"NoCacheProvider</property>\n"
"\n"
"        <!-- Echo all executed SQL to stdout -->\n"
"        <property name=\"show_sql\">true\n"
"\n"
"        <!-- Drop and re-create the database schema on startup -->\n"
"        <property name=\"hbm2ddl.auto\">update\n"
"\n"
"        <mapping resource=\"org/hibernate/tutorial/domain/Event.hbm.xml\"/>\n"
"\n"
"    </session-factory>\n"
"\n"
"</hibernate-configuration>]]>"
msgstr ""
"<?xml version='1.0' encoding='utf-8'?>\n"
"<!DOCTYPE hibernate-configuration PUBLIC\n"
"        \"-//Hibernate/Hibernate Configuration DTD 3.0//EN\"\n"
"        \"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
"\">\n"
"\n"
"<hibernate-configuration>\n"
"\n"
"    <session-factory>\n"
"\n"
"        <!-- Database connection settings -->\n"
"        <property name=\"connection.driver_class\">org.hsqldb."
"jdbcDriver</property>\n"
"        <property name=\"connection.url\">jdbc:hsqldb:hsql://"
"localhost</property>\n"
"        <property name=\"connection.username\">sa</property>\n"
"        <property name=\"connection.password\"></property>\n"
"\n"
"        <!-- JDBC connection pool (use the built-in) -->\n"
"        <property name=\"connection.pool_size\">1</property>\n"
"\n"
"        <!-- SQL dialect -->\n"
"        <property name=\"dialect\">org.hibernate.dialect."
"HSQLDialect</property>\n"
"\n"
"        <!-- Enable Hibernate's automatic session context management --"
">\n"
"        <property name=\"current_session_context_class\">thread</"
"property>\n"
"\n"
"        <!-- Disable the second-level cache  -->\n"
"        <property name=\"cache.provider_class\">org.hibernate.cache."
"NoCacheProvider</property>\n"
"\n"
"        <!-- Echo all executed SQL to stdout -->\n"
"        <property name=\"show_sql\">true</property>\n"
"\n"
"        <!-- Drop and re-create the database schema on startup -->\n"
"        <property name=\"hbm2ddl.auto\">create</property>\n"
"\n"
"        <mapping resource=\"events/Event.hbm.xml\"/>\n"
"\n"
"    </session-factory>\n"
"\n"
"</hibernate-configuration>"

#. Tag: para
#: tutorial.xml:366
#, no-c-format
msgid "Notice that this configuration file specifies a different DTD"
msgstr ""

#. Tag: para
#: tutorial.xml:369
#, fuzzy, no-c-format
msgid ""
"You configure Hibernate's <literal>SessionFactory. SessionFactory "
"is a global factory responsible for a particular database. If you have "
"several databases, for easier startup you should use several <literal><"
"session-factory></literal> configurations in several configuration files."
msgstr ""
"Bitte beachten Sie, dass diese XML-Konfiguration eine andere DTD "
"(Dokumenttyp-Definition) verwendet. Wir konfigurieren Hibernates "
"<literal>SessionFactory - eine allgemeingültige und für eine "
"bestimmte Datenbank verantwortliche Factory. Falls Sie mehrere Datenbanken "
"besitzen, verwenden Sie mehrere <literal><session-factory> "
"Konfigurationen, üblicherweise in mehreren Konfigurationsdateien (für die "
"einfachere Inbetriebnahme)."

#. Tag: para
#: tutorial.xml:376
#, no-c-format
msgid ""
"The first four <literal>property elements contain the necessary "
"configuration for the JDBC connection. The dialect <literal>property "
"option turns on automatic generation of database schemas directly into the "
"database. This can also be turned off by removing the configuration option, "
"or redirected to a file with the help of the <literal>SchemaExport "
"Ant task. Finally, add the mapping file(s) for persistent classes to the "
"configuration."
msgstr ""
"Die ersten vier <literal>property-Elemente enthalten die nötige "
"Konfiguration für die JDBC-Verbindung. Das Dialekt <literal>property Ant-Aufgabe an eine Datei umleiten. Zuletzt "
"werden die Mapping-Datei(en) für persistente Klassen der Konfiguration "
"hinzugefügt."

#. Tag: para
#: tutorial.xml:398
#, no-c-format
msgid ""
"Save this file as <filename>hibernate.cfg.xml into the "
"<filename>src/main/resources directory."
msgstr ""

#. Tag: title
#: tutorial.xml:406
#, fuzzy, no-c-format
msgid "Building with Maven"
msgstr "\"Builden\" mit Ant"

#. Tag: para
#: tutorial.xml:408
#, no-c-format
msgid ""
"We will now build the tutorial with Maven. You will need to have Maven "
"installed; it is available from the <ulink url=\"http://maven.apache.org/"
"download.html\">Maven download page</ulink>. Maven will read the /"
"pom.xml</filename> file we created earlier and know how to perform some "
"basic project tasks. First, lets run the <literal>compile goal to "
"make sure we can compile everything so far:"
msgstr ""

#. Tag: programlisting
#: tutorial.xml:418
#, no-c-format
msgid ""
"<![CDATA[[hibernateTutorial]$ mvn compile\n"
"[INFO] Scanning for projects...\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] Building First Hibernate Tutorial\n"
"[INFO]    task-segment: [compile]\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] [resources:resources]\n"
"[INFO] Using default encoding to copy filtered resources.\n"
"[INFO] [compiler:compile]\n"
"[INFO] Compiling 1 source file to /home/steve/projects/sandbox/"
"hibernateTutorial/target/classes\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] BUILD SUCCESSFUL\n"
"[INFO] "
"------------------------------------------------------------------------\n"
"[INFO] Total time: 2 seconds\n"
"[INFO] Finished at: Tue Jun 09 12:25:25 CDT 2009\n"
"[INFO] Final Memory: 5M/547M\n"
"[INFO] "
"------------------------------------------------------------------------]]>"
msgstr ""

#. Tag: title
#: tutorial.xml:423
#, no-c-format
msgid "Startup and helpers"
msgstr "Inbetriebnahme und Helfer"

#. Tag: para
#: tutorial.xml:425
#, fuzzy, no-c-format
msgid ""
"It is time to load and store some <literal>Event objects, but "
"first you have to complete the setup with some infrastructure code. You have "
"to startup Hibernate by building a global <interfacename>org.hibernate."
"SessionFactory</interfacename> object and storing it somewhere for easy "
"access in application code. A <interfacename>org.hibernate.SessionFactoryorg.hibernate.Sessionorg.hibernate.Session is a thread-safe "
"global object that is instantiated once."
msgstr ""
"Als nächstes werden einige <literal>Event-Objekte geladen und "
"gespeichert, jedoch muss zuerst die Konfiguration mit einigen Infrastruktur-"
"Codes (sog. \"Infrastructure Codes\") vervollständigt werden. Wir müssen "
"Hibernate starten. Die Inbetriebnahme beinhaltet ein allgemeingültiges "
"<literal>SessionFactory-Objekt, das an einer Stelle gespeichert "
"wird, auf die im Applikationscode leicht zugegriffen werden kann. Eine "
"<literal>SessionFactory kann neue Sessions "
"öffnen. Eine <literal>Session repräsentiert eine aus einem Thread "
"bestehende Arbeitseinheit, eine <literal>SessionFactory ist ein "
"threadsicheres, allgemeingültiges Objekt, das einmal instanziiert ist."

#. Tag: para
#: tutorial.xml:439
#, fuzzy, no-c-format
msgid ""
"We will create a <literal>HibernateUtil helper class that takes "
"care of startup and makes accessing the <interfacename>org.hibernate."
"SessionFactory</interfacename> more convenient."
msgstr ""
"Wir erstellen eine <literal>HibernateUtil-Helferklasse, die den "
"Startup erledigt und einen bequemen Zugriff auf eine "
"<literal>SessionFactory ermöglicht. Werfen wir einen Blick auf die "
"Implementierung:"

#. Tag: programlisting
#: tutorial.xml:445
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial.util;\n"
"\n"
"import org.hibernate.SessionFactory;\n"
"import org.hibernate.cfg.Configuration;\n"
"\n"
"public class HibernateUtil {\n"
"\n"
"    private static final SessionFactory sessionFactory = buildSessionFactory"
"();\n"
"\n"
"    private static SessionFactory buildSessionFactory() {\n"
"        try {\n"
"            // Create the SessionFactory from hibernate.cfg.xml\n"
"            return new Configuration().configure().buildSessionFactory();\n"
"        }\n"
"        catch (Throwable ex) {\n"
"            // Make sure you log the exception, as it might be swallowed\n"
"            System.err.println(\"Initial SessionFactory creation failed.\" + "
"ex);\n"
"            throw new ExceptionInInitializerError(ex);\n"
"        }\n"
"    }\n"
"\n"
"    public static SessionFactory getSessionFactory() {\n"
"        return sessionFactory;\n"
"    }\n"
"\n"
"}]]>"
msgstr ""
"package util;\n"
"\n"
"import org.hibernate.*;\n"
"import org.hibernate.cfg.*;\n"
"\n"
"public class HibernateUtil {\n"
"\n"
"    private static final SessionFactory sessionFactory;\n"
"\n"
"    static {\n"
"        try {\n"
"            // Create the SessionFactory from hibernate.cfg.xml\n"
"            sessionFactory = new Configuration().configure()."
"buildSessionFactory();\n"
"        } catch (Throwable ex) {\n"
"            // Make sure you log the exception, as it might be swallowed\n"
"            System.err.println(\"Initial SessionFactory creation failed.\" + "
"ex);\n"
"            throw new ExceptionInInitializerError(ex);\n"
"        }\n"
"    }\n"
"\n"
"    public static SessionFactory getSessionFactory() {\n"
"        return sessionFactory;\n"
"    }\n"
"\n"
"}"

#. Tag: para
#: tutorial.xml:447
#, no-c-format
msgid ""
"Save this code as <filename>src/main/java/org/hibernate/tutorial/util/"
"HibernateUtil.java</filename>"
msgstr ""

#. Tag: para
#: tutorial.xml:452
#, fuzzy, no-c-format
msgid ""
"This class not only produces the global <interfacename>org.hibernate."
"SessionFactory</interfacename> reference in its static initializer; it also "
"hides the fact that it uses a static singleton. We might just as well have "
"looked up the <interfacename>org.hibernate.SessionFactory "
"reference from JNDI in an application server or any other location for that "
"matter."
msgstr ""
"Diese Klasse produziert nicht nur die allgemeingültige "
"<literal>SessionFactory in ihrem statischen Initialisierer (sog. "
"\"Initializer\" - wird beim Laden der Klasse von der JVM aufgerufen), "
"sondern verwendet außerdem ein statisches Singleton. Es kann außerdem die "
"<literal>SessionFactory von JNDI in einem Applikationsserver "
"aufsuchen."

#. Tag: para
#: tutorial.xml:461
#, fuzzy, no-c-format
msgid ""
"If you give the <interfacename>org.hibernate.SessionFactory "
"a name in your configuration, Hibernate will try to bind it to JNDI under "
"that name after it has been built. Another, better option is to use a JMX "
"deployment and let the JMX-capable container instantiate and bind a "
"<literal>HibernateService to JNDI. Such advanced options are "
"discussed later."
msgstr ""
"Wenn Sie <literal>SessionFactory einen Namen in Ihrer "
"Konfigurationsdatei geben, so wird Hibernate versuchen, diese nach dem Build-"
"Prozess an JNDI zu binden. Um diesen Code komplett zu meiden, könnten Sie "
"JMX-Deployment verwenden und den JMX-fähigen Container instanziieren sowie "
"<literal>HibernateService an JNDI binden. Diese erweiterten "
"Optionen werden in der Referenz-Dokumentation von Hibernate näher erläutert."

#. Tag: para
#: tutorial.xml:470
#, fuzzy, no-c-format
msgid ""
"You now need to configure a logging system. Hibernate uses commons logging "
"and provides two choices: Log4j and JDK 1.4 logging. Most developers prefer "
"Log4j: copy <literal>log4j.properties from the Hibernate "
"distribution in the <literal>etc/ directory to your srchibernate.cfg.xml. If you "
"prefer to have more verbose output than that provided in the example "
"configuration, you can change the settings. By default, only the Hibernate "
"startup message is shown on stdout."
msgstr ""
"Dies sollte problemlos kompilieren. Nun muss noch ein Protokollierungssystem "
"(sog. \"Logging-System\") konfiguriert werden - Hibernate verwendet "
"\"Commons-Logging\" und überlässt Ihnen die Wahl zwischen Log4j- und JDK 1.4-"
"Logging. Die meisten Entwickler bevorzugen Log4j: Kopieren Sie "
"<literal>log4j.properties aus der Hibernate-Distribution (es "
"befindet sich im <literal>etc/-Verzeichnis) in Ihr srchibernate.cfg.xml. Schauen Sie "
"sich die Beispielkonfiguration an, und ändern Sie die Einstellungen, wenn "
"Sie eine aussagekräftigere Ausgabe wünschen. In der Standardeinstellung "
"werden nur die Hibernate Startup-Nachrichten in stdout dargesellt."

#. Tag: para
#: tutorial.xml:480
#, fuzzy, no-c-format
msgid ""
"The tutorial infrastructure is complete and you are now ready to do some "
"real work with Hibernate."
msgstr ""
"Die Infrastruktur der Anleitung ist nun vollständig - und wir können mit der "
"Benutzung von Hibernate beginnen."

#. Tag: title
#: tutorial.xml:488
#, no-c-format
msgid "Loading and storing objects"
msgstr "Das Laden und Speichern von Objekten"

#. Tag: para
#: tutorial.xml:490
#, fuzzy, no-c-format
msgid ""
"We are now ready to start doing some real work with Hibernate. Let's start "
"by writing an <literal>EventManager class with a main()-Klasse wird mit einer main() we created a new Event on the "
"database."
msgstr ""
"Erstellen Sie ein neues <literal>Event-Objekt, und übergeben Sie "
"es Hibernate. Hibernate kümmert sich nun um SQL und führt <literal>INSERT- und Transaction-Handling-Code "
"ehe wir dies starten."

#. Tag: para
#: tutorial.xml:505
#, fuzzy, no-c-format
msgid ""
"A <interface>org.hibernate.Session is designed to represent a "
"single unit of work (a single atomic piece of work to be performed). For now "
"we will keep things simple and assume a one-to-one granularity between a "
"Hibernate <interface>org.hibernate.Session and a database "
"transaction. To shield our code from the actual underlying transaction "
"system we use the Hibernate <interfacename>org.hibernate.Transaction handelt es sich um eine einzelne "
"Arbeitseinheit. Im Augenblick wollen wir es einfach angehen und von einer "
"\"One-to-One\"-Granularität zwischen einer Hibernate <literal>Session verfügbar ist."

#. Tag: para
#: tutorial.xml:518
#, fuzzy, no-c-format
msgid ""
"What does <literal>sessionFactory.getCurrentSession() do? First, "
"you can call it as many times and anywhere you like once you get hold of "
"your <interfacename>org.hibernate.SessionFactory. The "
"<literal>getCurrentSession() method always returns the \"current\" "
"unit of work. Remember that we switched the configuration option for this "
"mechanism to \"thread\" in our <filename>src/main/resources/hibernate.cfg."
"xml</filename>? Due to that setting, the context of a current unit of work "
"is bound to the current Java thread that executes the application."
msgstr ""
"Was genau macht <literal>sessionFactory.getCurrentSession()? "
"Zunächst einmal können Sie es so oft Sie möchten aufrufen, wenn Sie Ihre "
"<literal>SessionFactory haben (dank HibernateUtilgetCurrentSession()-Methode antwortet "
"stets mit der \"aktuellen\" Arbeitseinheit. Wie Sie sich sicherlich "
"erinnern, haben wir die Konfigurationsoption für diesen Mechanismus in der "
"<literal>hibernate.cfg.xml auf \"Thread\" umgestellt. Daher wird "
"die aktuelle Arbeitseinheit an den aktuellen Java-Thread gebunden, der die "
"Anwendung ausführt. Es muss jedoch noch der Gültigkeitsbereich (sog. \"Scope"
"\") berücksichtigt werden, d.h. wann eine Arbeitseinheit beginnt und wann "
"sie endet."

#. Tag: para
#: tutorial.xml:532
#, no-c-format
msgid ""
"Hibernate offers three methods of current session tracking. The \"thread\" "
"based method is not intended for production use; it is merely useful for "
"prototyping and tutorials such as this one. Current session tracking is "
"discussed in more detail later on."
msgstr ""

#. Tag: para
#: tutorial.xml:541
#, fuzzy, no-c-format
msgid ""
"A <interface>org.hibernate.Session begins when the first call to "
"<literal>getCurrentSession() is made for the current thread. It is "
"then bound by Hibernate to the current thread. When the transaction ends, "
"either through commit or rollback, Hibernate automatically unbinds the "
"<interface>org.hibernate.Session from the thread and closes it "
"for you. If you call <literal>getCurrentSession() again, you get a "
"new <interface>org.hibernate.Session and can start a new unit of "
"work."
msgstr ""
"Eine <literal>Session beginnt, wenn sie erstmals gebraucht wird, "
"wenn der erste Aufruf an <literal>getCurrentSession() erfolgt. Sie "
"wird dann durch Hibernate an den aktuellen Thread gebunden. Wenn die "
"Transaktion endet - sei es durch festschreiben oder zurücksetzen - löst "
"Hibernate automatisch die <literal>Session vom Thread und schließt "
"diese für Sie. Wenn Sie <literal>getCurrentSession() erneut "
"aufrufen, so erhalten Sie eine neue <literal>Session und können "
"mit einer neuen Arbeitseinheit beginnen. Dieses <emphasis>Thread-gebundene is flexible but you "
"should never design your application to use a new Hibernate <interface>org."
"hibernate.Session</interface> for every database "
"operation. Even though it is used in the following examples, consider "
"<emphasis>session-per-operation an anti-pattern. A real web "
"application is shown later in the tutorial which will help illustrate this."
msgstr ""
"Sollte die Hibernate <literal>Session hinsichtlich des "
"Gültigkeitsbereichs der Arbeitseinheit dazu verwendet werden, einen oder "
"mehrere Datenbankvorgänge auszuführen? Das vorherige Beispiel verwendet eine "
"<literal>Session für einen Vorgang. Das war Zufall, da das "
"Beispiel einfach nicht komplex genug war, um eine andere Vorgehensweise "
"darzustellen. Der Gültigkeitsbereich einer Hibernate <literal>Session für jeden als Negativmuster (sog. \"Anti-"
"Pattern\"). Eine echte (Web)-Anwendung wird zu einem späteren Zeitpunkt noch "
"gezeigt."

#. Tag: para
#: tutorial.xml:571
#, fuzzy, no-c-format
msgid ""
"See <xref linkend=\"transactions\"/> for more information about transaction "
"handling and demarcation. The previous example also skipped any error "
"handling and rollback."
msgstr ""
"Auf <xref linkend=\"transactions\"/> finden Sie weitere Informationen zum "
"Umgang mit Transaktionen und Abgrenzung (Demarkation). Auch Fehlerbehandlung "
"und Zurücksetzen wurden im vorherigen Beispiel weggelassen."

#. Tag: para
#: tutorial.xml:577
#, no-c-format
msgid ""
"To run this, we will make use of the Maven exec plugin to call our class "
"with the necessary classpath setup: <command>mvn exec:java -Dexec.mainClass="
"\"org.hibernate.tutorial.EventManager\" -Dexec.args=\"store\"</command>"
msgstr ""

#. Tag: para
#: tutorial.xml:584
#, no-c-format
msgid "You may need to perform <command>mvn compile first."
msgstr ""

#. Tag: para
#: tutorial.xml:589
#, fuzzy, no-c-format
msgid ""
"You should see Hibernate starting up and, depending on your configuration, "
"lots of log output. Towards the end, the following line will be displayed:"
msgstr ""
"Nach der Kompilierung sollten Sie den Start von Hibernate sehen sowie - je "
"nach der von Ihnen verwendeten Konfiguration - eine Menge an "
"Protokollausgaben. Am Ende sehen Sie die folgende Zeile:"

#. Tag: programlisting
#: tutorial.xml:594
#, fuzzy, no-c-format
msgid ""
"<![CDATA[[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) "
"values (?, ?, ?)]]>"
msgstr ""
"[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values "
"(?, ?, ?)"

#. Tag: para
#: tutorial.xml:596
#, fuzzy, no-c-format
msgid "This is the <literal>INSERT executed by Hibernate."
msgstr ""
"Ein Beispiel für die Ausführung einer HQL <literal>INSERT-"
"Anweisung:"

#. Tag: para
#: tutorial.xml:600
#, fuzzy, no-c-format
msgid "To list stored events an option is added to the main method:"
msgstr ""
"Als nächstes sollen auch die gespeicherten Veranstaltungen gelistet werden, "
"daher fügen wir eine Option zur Hauptmethode hinzu:"

#. Tag: programlisting
#: tutorial.xml:604
#, fuzzy, no-c-format
msgid ""
"<![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(\n"
"                        \"Event: \" + theEvent.getTitle() + \" Time: \" + "
"theEvent.getDate()\n"
"                );\n"
"            }\n"
"        }]]>"
msgstr ""
"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"
"}"

#. Tag: para
#: tutorial.xml:606
#, fuzzy, no-c-format
msgid "A new <literal>listEvents() method is also added:"
msgstr ""
"Eine neue <literal>listEvents() method wird ebenfalls hinzugefügt:"

#. Tag: programlisting
#: tutorial.xml:610
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private List listEvents() {\n"
"        Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"        session.beginTransaction();\n"
"        List result = session.createQuery(\"from Event\").list();\n"
"        session.getTransaction().commit();\n"
"        return result;\n"
"    }]]>"
msgstr ""
"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"
"}"

#. Tag: para
#: tutorial.xml:612
#, fuzzy, no-c-format
msgid ""
"Here, we are using a Hibernate Query Language (HQL) query to load all "
"existing <literal>Event objects from the database. Hibernate will "
"generate the appropriate SQL, send it to the database and populate "
"<literal>Event objects with the data. You can create more complex "
"queries with HQL. See <xref linkend=\"queryhql\"/> for more information."
msgstr ""
"Mittels HQL-Anfrage (\"Hibernate Query Language\") werden alle bestehenden "
"<literal>Event-Objekte aus der Datenbank geladen. Hibernate "
"generiert die entsprechende SQL (\"Structured Query Language\"), schickt sie "
"an die Datenbank und füllt die <literal>Event-Objekte mit den "
"Daten. Natürlich können mit HQL auch komplexere Anfragen erstellt werden."

#. Tag: para
#: tutorial.xml:620
#, no-c-format
msgid ""
"Now we can call our new functionality, again using the Maven exec plugin: "
"<command>mvn exec:java -Dexec.mainClass=\"org.hibernate.tutorial.EventManager"
"\" -Dexec.args=\"list\"</command>"
msgstr ""

#. Tag: title
#: tutorial.xml:630
#, no-c-format
msgid "Part 2 - Mapping associations"
msgstr "Teil 2 - Mapping-Assoziationen"

#. Tag: para
#: tutorial.xml:632
#, fuzzy, no-c-format
msgid ""
"So far we have mapped a single persistent entity class to a table in "
"isolation. Let's expand on that a bit and add some class associations. We "
"will add people to the application and store a list of events in which they "
"participate."
msgstr ""
"Bis jetzt haben wir eine persistente Entity-Klasse zu einer Tabelle gemappt. "
"Nachfolgend werden wir - darauf aufbauend - einige Klassen-Assoziationen "
"hinzufügen. Zuerst fügen wir der Anwendung Personen sowie eine Liste von "
"Veranstaltungen, an denen diese teilnehmen, hinzu."

#. Tag: title
#: tutorial.xml:640
#, no-c-format
msgid "Mapping the Person class"
msgstr "Das Mappen der Personenklasse"

#. Tag: para
#: tutorial.xml:642
#, fuzzy, no-c-format
msgid "The first cut of the <literal>Person class looks like this:"
msgstr "Der erste Teil der <literal>Person-Klasse ist einfach:"

#. Tag: programlisting
#: tutorial.xml:646
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial.domain;\n"
"\n"
"public class Person {\n"
"\n"
"    private Long id;\n"
"    private int age;\n"
"    private String firstname;\n"
"    private String lastname;\n"
"\n"
"    public Person() {}\n"
"\n"
"    // Accessor methods for all properties, private setter for 'id'\n"
"\n"
"}]]>"
msgstr ""
"package events;\n"
"\n"
"public class Person {\n"
"\n"
"    private Long id;\n"
"    private int age;\n"
"    private String firstname;\n"
"    private String lastname;\n"
"\n"
"    public Person() {}\n"
"\n"
"    // Accessor methods for all properties, private setter for 'id'\n"
"\n"
"}"

#. Tag: para
#: tutorial.xml:648
#, no-c-format
msgid ""
"Save this to a file named <filename>src/main/java/org/hibernate/tutorial/"
"domain/Person.java</filename>"
msgstr ""

#. Tag: para
#: tutorial.xml:653
#, no-c-format
msgid ""
"Next, create the new mapping file as <filename>src/main/resources/org/"
"hibernate/tutorial/domain/Person.hbm.xml</filename>"
msgstr ""

#. Tag: programlisting
#: tutorial.xml:658
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
msgstr ""
"<hibernate-mapping>\n"
"\n"
"    <class name=\"events.Person\" table=\"PERSON\">\n"
"        <id name=\"id\" column=\"PERSON_ID\">\n"
"            <generator class=\"native\"/>\n"
"        </id>\n"
"        <property name=\"age\"/>\n"
"        <property name=\"firstname\"/>\n"
"        <property name=\"lastname\"/>\n"
"    </class>\n"
"\n"
"</hibernate-mapping>"

#. Tag: para
#: tutorial.xml:660
#, no-c-format
msgid "Finally, add the new mapping to Hibernate's configuration:"
msgstr ""
"Anschließend fügen Sie dann das neue Mapping der Konfiguration von Hibernate "
"hinzu:"

#. Tag: programlisting
#: tutorial.xml:664
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
msgstr ""
"<mapping resource=\"events/Event.hbm.xml\"/>\n"
"<mapping resource=\"events/Person.hbm.xml\"/>"

#. Tag: para
#: tutorial.xml:666
#, fuzzy, no-c-format
msgid ""
"Create an association between these two entities. Persons can participate in "
"events, and events have participants. The design questions you have to deal "
"with are: directionality, multiplicity, and collection behavior."
msgstr ""
"Als nächstes wird eine Assoziation zwischen diesen beiden Entities erstellt. "
"Personen können an Veranstaltungen teilnehmen, und Veranstaltungen haben "
"Teilnehmer. Die zu klärenden Frage des Aufbaus beinhaltet die der "
"Richtungsabhängigkeit, Multiplizität und des Collection-Verhaltens."

#. Tag: title
#: tutorial.xml:676
#, no-c-format
msgid "A unidirectional Set-based association"
msgstr "Eine unidirektionale \"Set\"-basierte Assoziation"

#. Tag: para
#: tutorial.xml:678
#, fuzzy, no-c-format
msgid ""
"By adding a collection of events to the <literal>Person class, you "
"can easily navigate to the events for a particular person, without executing "
"an explicit query - by calling <literal>Person#getEvents. Multi-"
"valued associations are represented in Hibernate by one of the Java "
"Collection Framework contracts; here we choose a <interfacename>java.util."
"Set</interfacename> because the collection will not contain duplicate "
"elements and the ordering is not relevant to our examples:"
msgstr ""
"Wir fügen der <literal>Person-Klasse eine Auswahl an "
"Veranstaltungen hinzu. Auf diese Weise können Sie bequem zu den "
"Veranstaltungen für eine bestimmte Person navigieren, ohne eine "
"ausdrückliche Anfrage auszuführen - durch Aufruf von <literal>aPerson."
"getEvents()</literal>. Wir verwenden eine Java-Collection, ein Set, if we wanted to be able to navigate it from both "
"directions. This is not necessary, from a functional perspective. You can "
"always execute an explicit query to retrieve the participants for a "
"particular event. This is a design choice left to you, but what is clear "
"from this discussion is the multiplicity of the association: \"many\" valued "
"on both sides is called a <emphasis>many-to-many association. "
"Hence, we use Hibernate's many-to-many mapping:"
msgstr ""
"Ehe wir diese Assoziation mappen, müssen wir uns ein paar Gedanken machen. "
"Natürlich könnten wir das Ganze unidirektional halten. Oder wir könnten eine "
"andere Collection im <literal>Event erstellen, wenn wir "
"bidirektional navigieren wollen, d.h. <literal>anEvent.getParticipants()-Assoziation. Wir "
"verwenden daher Hibernates \"Many-to-Many\"-Mapping:"

#. Tag: programlisting
#: tutorial.xml:704
#, fuzzy, no-c-format
msgid ""
"<![CDATA["
msgstr ""
"<class name=\"events.Person\" table=\"PERSON\">\n"
"    <id name=\"id\" column=\"PERSON_ID\">\n"
"        <generator class=\"native\"/>\n"
"    </id>\n"
"    <property name=\"age\"/>\n"
"    <property name=\"firstname\"/>\n"
"    <property name=\"lastname\"/>\n"
"\n"
"    <set name=\"events\" table=\"PERSON_EVENT\">\n"
"        <key column=\"PERSON_ID\"/>\n"
"        <many-to-many column=\"EVENT_ID\" class=\"events.Event\"/>\n"
"    </set>\n"
"\n"
"</class>"

#. Tag: para
#: tutorial.xml:706
#, fuzzy, no-c-format
msgid ""
"Hibernate supports a broad range of collection mappings, a <literal>setn:"
"m</emphasis> entity relationship, an association table is required. Each row "
"in this table represents a link between a person and an event. The table "
"name is decalred using the <literal>table attribute of the "
"<literal>set element. The identifier column name in the "
"association, for the person side, is defined with the <literal>key "
"element, the column name for the event's side with the <literal>columnmany-to-many. You also have to "
"tell Hibernate the class of the objects in your collection (the class on the "
"other side of the collection of references)."
msgstr ""
"Hibernate unterstützt alle Arten von Collection Mappings, mit <literal><"
"set></literal> als dem gängisten. Für eine \"Many-to-Many\"-Assoziation "
"(oder <emphasis>n:m-Entity-Beziehung), wird eine "
"Assoziationstabelle benötigt. Jede Reihe dieser Tabelle repräsentiert eine "
"Verbindung zwischen einer Person und einer Veranstaltung. Der Tabellenname "
"ist mit dem <literal>table-Attribut des set-"
"Elements konfiguriert. Der Identifier-Spaltenname in der Assoziation für die "
"Personenseite ist mit dem <literal><key>-Element definiert, "
"der Spaltenname für die Veranstaltungsseite mit dem <literal>column<many-to-many>. Sie müssen "
"Hibernate außerdem die Klasse der Objekte Ihrer Collection mitteilen "
"(korrekt: die Klasse auf der anderen Seite der Verweis-Collection)."

#. Tag: para
#: tutorial.xml:722
#, no-c-format
msgid "The database schema for this mapping is therefore:"
msgstr "Das Datenbankschema für dieses Mapping lautet daher:"

#. Tag: programlisting
#: tutorial.xml:726
#, fuzzy, no-c-format
msgid ""
"<![CDATA[\n"
"    _____________        __________________\n"
"   |             |      |                  |       _____________\n"
"   |   EVENTS    |      |   PERSON_EVENT   |      |             |\n"
"   |_____________|      |__________________|      |    PERSON   |\n"
"   |             |      |                  |      |_____________|\n"
"   | *EVENT_ID   | <--> | *EVENT_ID        |      |             |\n"
"   |  EVENT_DATE |      | *PERSON_ID       | <--> | *PERSON_ID  |\n"
"   |  TITLE      |      |__________________|      |  AGE        |\n"
"   |_____________|                                |  FIRSTNAME  |\n"
"                                                  |  LASTNAME   |\n"
"                                                  |_____________|\n"
" ]]>"
msgstr ""
"_____________        __________________\n"
"   |             |      |                  |       _____________\n"
"   |   EVENTS    |      |   PERSON_EVENT   |      |             |\n"
"   |_____________|      |__________________|      |    PERSON   |\n"
"   |             |      |                  |      |_____________|\n"
"   | *EVENT_ID   | <--> | *EVENT_ID        |      |             |\n"
"   |  EVENT_DATE |      | *PERSON_ID       | <--> | *PERSON_ID  |\n"
"   |  TITLE      |      |__________________|      |  AGE        |\n"
"   |_____________|                                |  FIRSTNAME  |\n"
"                                                  |  LASTNAME   |\n"
"                                                  |_____________|"

#. Tag: title
#: tutorial.xml:731
#, no-c-format
msgid "Working the association"
msgstr "Das Bearbeiten der Assoziation"

#. Tag: para
#: tutorial.xml:733
#, fuzzy, no-c-format
msgid ""
"Now we will bring some people and events together in a new method in "
"<literal>EventManager:"
msgstr ""
"Nun werden einige Personen und Veranstaltungen in einer neuen Methode im "
"<literal>EventManager vereint:"

#. Tag: programlisting
#: tutorial.xml:737
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private void addPersonToEvent(Long personId, Long eventId) {\n"
"        Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"        session.beginTransaction();\n"
"\n"
"        Person aPerson = (Person) session.load(Person.class, personId);\n"
"        Event anEvent = (Event) session.load(Event.class, eventId);\n"
"        aPerson.getEvents().add(anEvent);\n"
"\n"
"        session.getTransaction().commit();\n"
"    }]]>"
msgstr ""
"private void addPersonToEvent(Long personId, Long eventId) {\n"
"\n"
"    Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"    session.beginTransaction();\n"
"\n"
"    Person aPerson = (Person) session.load(Person.class, personId);\n"
"    Event anEvent = (Event) session.load(Event.class, eventId);\n"
"\n"
"    aPerson.getEvents().add(anEvent);\n"
"\n"
"    session.getTransaction().commit();\n"
"}"

#. Tag: para
#: tutorial.xml:739
#, fuzzy, no-c-format
msgid ""
"After loading a <literal>Person and an Event, "
"simply modify the collection using the normal collection methods. There is "
"no explicit call to <literal>update() or save() state, that is, bound to a particular "
"Hibernate <interfacename>org.hibernate.Session, Hibernate "
"monitors any changes and executes SQL in a write-behind fashion. The process "
"of synchronizing the memory state with the database, usually only at the end "
"of a unit of work, is called <emphasis>flushing. In our code, the "
"unit of work ends with a commit, or rollback, of the database transaction."
msgstr ""
"Nach dem Laden einer <literal>Person und eines Event oder save(), "
"Hibernate stellt automatisch fest, dass die Collection verändert wurde und "
"aktualisiert werden muss. Dieser Vorgang ist unter der Bezeichnung <emphasis>"
"\"Automatic Dirty Checking\"</emphasis> (d.h. eine automatische "
"Modifizierungsprüfung) bekannt, und Sie können ihn auch ausprobieren, indem "
"Sie die Property des Namens oder des Datums eines Ihrer Objekte ändern. So "
"lange deren Status <emphasis>persistent ist, d.h. an eine "
"bestimmte Hibernate <literal>Session gebunden ist (d.h. sie wurden "
"gerade geladen oder in einer Arbeitseinheit gespeichert), überwacht "
"Hibernate sämtliche Änderungen und führt SQL mittels Hinterher-Speichern "
"(sog. \"write-behind\") aus. Der Vorgang der Synchronisation des "
"Speicherstatus mit der Datenbank - in der Regel am Ende einer Arbeitseinheit "
"- heißt <emphasis>Flushing. In unserem Code endet die "
"Arbeitseinheit mit dem Festschreiben (oder Zurücksetzen) der "
"Datenbanktransaktion, wie in der <literal>thread-"
"Konfigurationsoption für die <literal>CurrentSessionContext-Klasse "
"definiert."

#. Tag: para
#: tutorial.xml:758
#, fuzzy, no-c-format
msgid ""
"You can load person and event in different units of work. Or you can modify "
"an object outside of a <interfacename>org.hibernate.Session, "
"when it is not in persistent state (if it was persistent before, this state "
"is called <emphasis>detached). You can even modify a collection "
"when it is detached:"
msgstr ""
"Natürlich können Sie Person und Veranstaltung in verschiedenen "
"Arbeitseinheiten laden oder ein Objekt außerhalb einer <literal>Session d.h. abgesetzt). Sie können eine "
"Collection sogar modifizieren, wenn diese abgesetzt ist:"

#. Tag: programlisting
#: tutorial.xml:767
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private void addPersonToEvent(Long personId, Long eventId) {\n"
"        Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"        session.beginTransaction();\n"
"\n"
"        Person aPerson = (Person) session\n"
"                .createQuery(\"select p from Person p left join fetch p."
"events where p.id = :pid\")\n"
"                .setParameter(\"pid\", personId)\n"
"                .uniqueResult(); // Eager fetch the collection so we can use "
"it detached\n"
"        Event anEvent = (Event) session.load(Event.class, eventId);\n"
"\n"
"        session.getTransaction().commit();\n"
"\n"
"        // End of first unit of work\n"
"\n"
"        aPerson.getEvents().add(anEvent); // aPerson (and its collection) is "
"detached\n"
"\n"
"        // Begin second unit of work\n"
"\n"
"        Session session2 = HibernateUtil.getSessionFactory()."
"getCurrentSession();\n"
"        session2.beginTransaction();\n"
"        session2.update(aPerson); // Reattachment of aPerson\n"
"\n"
"        session2.getTransaction().commit();\n"
"    }]]>"
msgstr ""
"private void addPersonToEvent(Long personId, Long eventId) {\n"
"\n"
"    Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"    session.beginTransaction();\n"
"\n"
"    Person aPerson = (Person) session\n"
"            .createQuery(\"select p from Person p left join fetch p.events "
"where p.id = :pid\")\n"
"            .setParameter(\"pid\", personId)\n"
"            .uniqueResult(); // Eager fetch the collection so we can use it "
"detached\n"
"\n"
"    Event anEvent = (Event) session.load(Event.class, eventId);\n"
"\n"
"    session.getTransaction().commit();\n"
"\n"
"    // End of first unit of work\n"
"\n"
"    aPerson.getEvents().add(anEvent); // aPerson (and its collection) is "
"detached\n"
"\n"
"    // Begin second unit of work\n"
"\n"
"    Session session2 = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"    session2.beginTransaction();\n"
"\n"
"    session2.update(aPerson); // Reattachment of aPerson\n"
"\n"
"    session2.getTransaction().commit();\n"
"}"

#. Tag: para
#: tutorial.xml:769
#, fuzzy, no-c-format
msgid ""
"The call to <literal>update makes a detached object persistent "
"again by binding it to a new unit of work, so any modifications you made to "
"it while detached can be saved to the database. This includes any "
"modifications (additions/deletions) you made to a collection of that entity "
"object."
msgstr ""
"Der Aufruf <literal>update macht ein abgesetztes Objekt wieder "
"persistent, man könnte auch sagen, dass es sich an eine neue Arbeitseinheit "
"bindet. Alle von Ihnen in abgesetztem Zustand vorgenommenen Änderungen "
"können in der Datenbank gespeichert werden. Dies beinhaltet auch jegliche "
"Modifikationen (Hinzufügungen/Löschungen), die an der Collection dieses "
"Entity-Objekts vorgenommen wurden."

#. Tag: para
#: tutorial.xml:778
#, fuzzy, no-c-format
msgid ""
"This is not much use in our example, but it is an important concept you can "
"incorporate into your own application. Complete this exercise by adding a "
"new action to the main method of the <literal>EventManager and "
"call it from the command line. If you need the identifiers of a person and "
"an event - the <literal>save() method returns it (you might have "
"to modify some of the previous methods to return that identifier):"
msgstr ""
"Zwar hat das nicht viel mit unserer aktuellen Situation zu tun, aber es "
"handelt sich dennoch um ein wichtiges Konzept, das Sie in Ihrer eigenen "
"Anwendung ausführen können. Für den Moment vervollständigen Sie bitte diese "
"Übung durch Hinzufügen einer neuen Aktion zur Hauptmethode des "
"<literal>EventManager, und rufen Sie sie über die Befehlszeile "
"auf. Falls Sie die Identifier einer Person oder einer Veranstaltung "
"benötigen - die <literal>save()-Methode gibt diese wieder (es kann "
"sein, dass Sie einige der vorherigen Methoden ändern müssen, damit der "
"Identifier wiedergegeben wird):"

#. Tag: programlisting
#: tutorial.xml:786
#, fuzzy, no-c-format
msgid ""
"<![CDATA[        else if (args[0].equals(\"addpersontoevent\")) {\n"
"            Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date"
"());\n"
"            Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n"
"            mgr.addPersonToEvent(personId, eventId);\n"
"            System.out.println(\"Added person \" + personId + \" to event \" "
"+ eventId);\n"
"        }]]>"
msgstr ""
"else if (args[0].equals(\"addpersontoevent\")) {\n"
"    Long eventId = mgr.createAndStoreEvent(\"My Event\", new Date());\n"
"    Long personId = mgr.createAndStorePerson(\"Foo\", \"Bar\");\n"
"    mgr.addPersonToEvent(personId, eventId);\n"
"    System.out.println(\"Added person \" + personId + \" to event \" + "
"eventId);\n"
"}"

#. Tag: para
#: tutorial.xml:788
#, fuzzy, no-c-format
msgid ""
"This is an example of an association between two equally important classes : "
"two entities. As mentioned earlier, there are other classes and types in a "
"typical model, usually \"less important\". Some you have already seen, like "
"an <literal>int or a java.lang.String. We "
"call these classes <emphasis>value types, and their instances "
"<emphasis>depend on a particular entity. Instances of these types "
"do not have their own identity, nor are they shared between entities. Two "
"persons do not reference the same <literal>firstname object, even "
"if they have the same first name. Value types cannot only be found in the "
"JDK , but you can also write dependent classes yourself such as an "
"<literal>Address or MonetaryAmount class. In "
"fact, in a Hibernate application all JDK classes are considered value types."
msgstr ""
"Dies war ein Beispiel für die Assoziation zweier gleich wichtiger Klassen, "
"zweier Entities. Wie bereits erwähnt, existieren auch andere Klassen und "
"Typen in einem typischen Modell, normalerweise \"weniger wichtige\". Einige "
"sind Ihnen bereits bekannt, so etwa <literal>int oder ein "
"<literal>String. Diese Klassen sind unter der Bezeichnung "
"<emphasis>Werttypen (sog. \"value types\") bekannt und ihre "
"Instanzen sind von einer bestimmten Entity <emphasis>abhängig. "
"Instanzen dieser Typen haben keine eigene Identität und werden nicht von den "
"Entities geteilt (zwei Personen verweisen nicht auf dasselbe "
"<literal>firstname-Objekt, selbst wenn sie denselben Vornamen "
"besitzen). Natürlich gibt es Werttypen nicht nur im JDK (genau genommen "
"werden in einer Hibernate Anwendung alle JDK-Klassen als Werttypen "
"angesehen), sondern Sie können abhängige Klassen auch selbst schreiben, wie "
"z.B. <literal>Address oder MonetaryAmount."

#. Tag: para
#: tutorial.xml:806
#, fuzzy, no-c-format
msgid ""
"You can also design a collection of value types. This is conceptually "
"different from a collection of references to other entities, but looks "
"almost the same in Java."
msgstr ""
"Sie können auch eine Collection von Werttypen entwerfen. Dies unterscheidet "
"sich konzeptionell sehr von einer Collection von Referenzen zu anderen "
"Entities, sieht aber in Java fast genauso aus."

#. Tag: title
#: tutorial.xml:815
#, no-c-format
msgid "Collection of values"
msgstr "Collection von Werten"

#. Tag: para
#: tutorial.xml:817
#, no-c-format
msgid ""
"Let's add a collection of email addresses to the <literal>Person "
"entity. This will be represented as a <interfacename>java.util.Setjava.lang.String instances:"
msgstr ""

#. Tag: programlisting
#: tutorial.xml:823
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private Set emailAddresses = new HashSet();\n"
"\n"
"    public Set getEmailAddresses() {\n"
"        return emailAddresses;\n"
"    }\n"
"\n"
"    public void setEmailAddresses(Set emailAddresses) {\n"
"        this.emailAddresses = emailAddresses;\n"
"    }]]>"
msgstr ""
"private Set emailAddresses = new HashSet();\n"
"\n"
"public Set getEmailAddresses() {\n"
"    return emailAddresses;\n"
"}\n"
"\n"
"public void setEmailAddresses(Set emailAddresses) {\n"
"    this.emailAddresses = emailAddresses;\n"
"}"

#. Tag: para
#: tutorial.xml:825
#, fuzzy, no-c-format
msgid "The mapping of this <literal>Set is as follows:"
msgstr "Das Mapping dieses <literal>Set:"

#. Tag: programlisting
#: tutorial.xml:829
#, fuzzy, no-c-format
msgid ""
"<![CDATA[        "
msgstr ""
"<set name=\"emailAddresses\" table=\"PERSON_EMAIL_ADDR\">\n"
"    <key column=\"PERSON_ID\"/>\n"
"    <element type=\"string\" column=\"EMAIL_ADDR\"/>\n"
"</set>"

#. Tag: para
#: tutorial.xml:831
#, fuzzy, no-c-format
msgid ""
"The difference compared with the earlier mapping is the use of the "
"<literal>element part which tells Hibernate that the collection "
"does not contain references to another entity, but is rather a collection "
"whose elements are values types, here specifically of type <literal>string attribute of the set element defines the foreign-key column name in the "
"collection table. The <literal>column attribute in the "
"<literal>element element defines the column name where the email "
"address values will actually be stored."
msgstr ""
"Der Unterschied im Vergleich zu unserem früheren Mapping ist der "
"<literal>element-Teil, der Hibernate mitteilt, dass die Collection "
"keine Verweise zu einer anderen Entity enthält, sondern eine Collection von "
"Elementen des <literal>String-Typs (die Schreibweise des Namens in "
"Kleinbuchstaben zeigt an, dass es sich um einen Mapping-Typ/Converter von "
"Hibernate handelt). Auch hier bestimmt das <literal>table-Attribut "
"des <literal>set-Elements den Tabellennamen für die Collection. "
"Das <literal>key-Element definiert den Spaltennamen des "
"Fremdschlüssels in der Collection-Tabelle. Das <literal>column-"
"Attribut im <literal>element-Element definiert den Spaltennamen in "
"dem die <literal>String-Werte gespeichert werden."

#. Tag: para
#: tutorial.xml:847
#, fuzzy, no-c-format
msgid "Here is the updated schema:"
msgstr "Werfen wir einen Blick auf das aktualisierte Schema:"

#. Tag: programlisting
#: tutorial.xml:851
#, fuzzy, no-c-format
msgid ""
"<![CDATA[\n"
"  _____________        __________________\n"
" |             |      |                  |       _____________\n"
" |   EVENTS    |      |   PERSON_EVENT   |      |             |       "
"___________________\n"
" |_____________|      |__________________|      |    PERSON   |      "
"|                   |\n"
" |             |      |                  |      |_____________|      | "
"PERSON_EMAIL_ADDR |\n"
" | *EVENT_ID   | <--> | *EVENT_ID        |      |             |      |"
"___________________|\n"
" |  EVENT_DATE |      | *PERSON_ID       | <--> | *PERSON_ID  | <--> |  "
"*PERSON_ID       |\n"
" |  TITLE      |      |__________________|      |  AGE        |      |  "
"*EMAIL_ADDR      |\n"
" |_____________|                                |  FIRSTNAME  |      |"
"___________________|\n"
"                                                |  LASTNAME   |\n"
"                                                |_____________|\n"
" ]]>"
msgstr ""
"_____________        __________________\n"
" |             |      |                  |       _____________\n"
" |   EVENTS    |      |   PERSON_EVENT   |      |             |       "
"___________________\n"
" |_____________|      |__________________|      |    PERSON   |      "
"|                   |\n"
" |             |      |                  |      |_____________|      | "
"PERSON_EMAIL_ADDR |\n"
" | *EVENT_ID   | <--> | *EVENT_ID        |      |             |      |"
"___________________|\n"
" |  EVENT_DATE |      | *PERSON_ID       | <--> | *PERSON_ID  | <--"
"> |  *PERSON_ID       |\n"
" |  TITLE      |      |__________________|      |  AGE        |      |  "
"*EMAIL_ADDR      |\n"
" |_____________|                                |  FIRSTNAME  |      |"
"___________________|\n"
"                                                |  LASTNAME   |\n"
"                                                |_____________|"

#. Tag: para
#: tutorial.xml:853
#, fuzzy, no-c-format
msgid ""
"You can see that the primary key of the collection table is in fact a "
"composite key that uses both columns. This also implies that there cannot be "
"duplicate email addresses per person, which is exactly the semantics we need "
"for a set in Java."
msgstr ""
"Sie sehen, dass der Primärschlüssel der Collection-Tabelle ein "
"zusammengesetzter Schlüssel (sog. \"composite key\") ist, der beide Spalten "
"verwendet. Dies beinhaltet außerdem, dass keine doppelten E-Mail-Addressen "
"pro Person existieren können, was genau die für ein Set benötigte Semantik "
"in Java ist."

#. Tag: para
#: tutorial.xml:859
#, fuzzy, no-c-format
msgid ""
"You can now try to add elements to this collection, just like we did before "
"by linking persons and events. It is the same code in Java:"
msgstr ""
"Sie können nun versuchen, Elemente zu dieser Collection hinzuzufügen oder "
"dieser zu entnehmen, genau wie wir es zuvor bei der Verbindung von Personen "
"und Veranstaltungen getan haben. In Java ist es derselbe Code:"

#. Tag: programlisting
#: tutorial.xml:864
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private void addEmailToPerson(Long personId, String "
"emailAddress) {\n"
"        Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"        session.beginTransaction();\n"
"\n"
"        Person aPerson = (Person) session.load(Person.class, personId);\n"
"        // adding to the emailAddress collection might trigger a lazy load "
"of the collection\n"
"        aPerson.getEmailAddresses().add(emailAddress);\n"
"\n"
"        session.getTransaction().commit();\n"
"    }]]>"
msgstr ""
"private void addEmailToPerson(Long personId, String emailAddress) {\n"
"\n"
"    Session session = HibernateUtil.getSessionFactory().getCurrentSession"
"();\n"
"    session.beginTransaction();\n"
"\n"
"    Person aPerson = (Person) session.load(Person.class, personId);\n"
"\n"
"    // The getEmailAddresses() might trigger a lazy load of the collection\n"
"    aPerson.getEmailAddresses().add(emailAddress);\n"
"\n"
"    session.getTransaction().commit();\n"
"}"

#. Tag: para
#: tutorial.xml:866
#, fuzzy, no-c-format
msgid ""
"This time we did not use a <emphasis>fetch query to initialize "
"the collection. Monitor the SQL log and try to optimize this with an eager "
"fetch."
msgstr ""
"Dieses Mal haben wir keine <emphasis>\"Fetch\"-Anfrage verwendet, "
"um die Collection zu initialisieren. Der Aufruf an die \"Getter\"-Methode "
"wird eine zusätzliche Auswahl auslösen, um sie zu initialisieren, damit ein "
"Element hinzugefügt werden kann. Beobachten Sie das SQL-Protokoll und "
"versuchen Sie es durch \"eager Fetching\" (d.h. durch zusammengefasstes "
"Laden von Objekt und assoziierten Objekten mit Verbundoperationen) zu "
"optimieren."

#. Tag: title
#: tutorial.xml:875
#, no-c-format
msgid "Bi-directional associations"
msgstr "Bidirektionale Assoziationen"

#. Tag: para
#: tutorial.xml:877
#, fuzzy, no-c-format
msgid ""
"Next you will map a bi-directional association. You will make the "
"association between person and event work from both sides in Java. The "
"database schema does not change, so you will still have many-to-many "
"multiplicity."
msgstr ""
"Als nächstes mappen wir eine bidirektionale Assoziation, so dass die "
"Assoziation zwischen zwischen Person und Veranstaltung in Java von beiden "
"Seiten aus funktioniert.Das Datenbankschema verändert sich natürlich nicht, "
"die \"Many-to-Many\"-Multiziplität bleibt weiterhin bestehen. Eine "
"relationale Datenbank ist flexibler als eine Netzwerk-Programmiersprache und "
"benötigt keine Navigationsrichtung - Daten können auf alle möglichen Arten "
"eingesehen und aufgerufen werden."

#. Tag: para
#: tutorial.xml:885
#, no-c-format
msgid ""
"A relational database is more flexible than a network programming language, "
"in that it does not need a navigation direction; data can be viewed and "
"retrieved in any possible way."
msgstr ""

#. Tag: para
#: tutorial.xml:893
#, fuzzy, no-c-format
msgid ""
"First, add a collection of participants to the <literal>Event "
"class:"
msgstr ""
"Zuerst wird eine Collection von Teilnehmern der <literal>Event "
"Veranstaltungsklasse hinzugefügt:"

#. Tag: programlisting
#: tutorial.xml:898
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private Set participants = new HashSet();\n"
"\n"
"    public Set getParticipants() {\n"
"        return participants;\n"
"    }\n"
"\n"
"    public void setParticipants(Set participants) {\n"
"        this.participants = participants;\n"
"    }]]>"
msgstr ""
"private Set participants = new HashSet();\n"
"\n"
"public Set getParticipants() {\n"
"    return participants;\n"
"}\n"
"\n"
"public void setParticipants(Set participants) {\n"
"    this.participants = participants;\n"
"}"

#. Tag: para
#: tutorial.xml:900
#, fuzzy, no-c-format
msgid ""
"Now map this side of the association in <literal>Event.hbm.xml."
msgstr ""
"Nun mappen Sie auch diese Seite der Assoziation in <literal>Event.hbm.xml"
msgstr ""
"<set name=\"participants\" table=\"PERSON_EVENT\" inverse=\"true\">\n"
"    <key column=\"EVENT_ID\"/>\n"
"    <many-to-many column=\"PERSON_ID\" class=\"events.Person\"/>\n"
"</set>"

#. Tag: para
#: tutorial.xml:906
#, fuzzy, no-c-format
msgid ""
"These are normal <literal>set mappings in both mapping documents. "
"Notice that the column names in <literal>key and many-to-"
"many</literal> swap in both mapping documents. The most important addition "
"here is the <literal>inverse=\"true\" attribute in the "
"<literal>set element of the Event's collection "
"mapping."
msgstr ""
"Wie Sie sehen handelt es sich um normale <literal>set Mappings in "
"beiden Mapping-Dokumenten. Beachten Sie, dass die Spaltennamen in "
"<literal>key und many-to-many in den beiden "
"Mapping-Dokumenten vertauscht sind. Die wichtigste Hinzufügung hier ist das "
"<literal>inverse=\"true\"-Attribut im set-"
"Element des Collection-Mappings des<literal>Events."

#. Tag: para
#: tutorial.xml:914
#, fuzzy, no-c-format
msgid ""
"What this means is that Hibernate should take the other side, the "
"<literal>Person class, when it needs to find out information about "
"the link between the two. This will be a lot easier to understand once you "
"see how the bi-directional link between our two entities is created."
msgstr ""
"Dies teilt Hibernate mit, dass es die andere Seite - die <literal>Person and an "
"<literal>Event in the unidirectional example? You add an instance "
"of <literal>Event to the collection of event references, of an "
"instance of <literal>Person. If you want to make this link bi-"
"directional, you have to do the same on the other side by adding a "
"<literal>Person reference to the collection in an Event und einem Event "
"(Veranstaltung) in dem unidirektionalen Beispiel hergestellt haben: Wir "
"haben der Collection von Veranstaltungsreferenzen einer Instanz von "
"<literal>Person eine Event-Instanz zugefügt. "
"Wenn wir diese Verbindung bidirektional machen wollen, so müssen wir "
"dasselbe auf der anderen Seite tun - also eine <literal>Person-"
"Referenz zur Collection in einem <literal>Event hinzufügen. Dieses "
"\"Setzen der Verbindung auf beiden Seiten\" ist essentiell, und Sie sollten "
"nie vergessen es zu tun."

#. Tag: para
#: tutorial.xml:935
#, fuzzy, no-c-format
msgid ""
"Many developers program defensively and create link management methods to "
"correctly set both sides (for example, in <literal>Person):"
msgstr ""
"Zahlreiche Entwickler programmieren defensiv und erstellen eine Management-"
"Methoden Verbindung, um beide Seiten korrekt einzustellen, z.B. in "
"<literal>Person:"

#. Tag: programlisting
#: tutorial.xml:940
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    protected Set getEvents() {\n"
"        return events;\n"
"    }\n"
"\n"
"    protected void setEvents(Set events) {\n"
"        this.events = events;\n"
"    }\n"
"\n"
"    public void addToEvent(Event event) {\n"
"        this.getEvents().add(event);\n"
"        event.getParticipants().add(this);\n"
"    }\n"
"\n"
"    public void removeFromEvent(Event event) {\n"
"        this.getEvents().remove(event);\n"
"        event.getParticipants().remove(this);\n"
"    }]]>"
msgstr ""
"protected Set getEvents() {\n"
"    return events;\n"
"}\n"
"\n"
"protected void setEvents(Set events) {\n"
"    this.events = events;\n"
"}\n"
"\n"
"public void addToEvent(Event event) {\n"
"    this.getEvents().add(event);\n"
"    event.getParticipants().add(this);\n"
"}\n"
"\n"
"public void removeFromEvent(Event event) {\n"
"    this.getEvents().remove(event);\n"
"    event.getParticipants().remove(this);\n"
"}"

#. Tag: para
#: tutorial.xml:942
#, fuzzy, no-c-format
msgid ""
"The get and set methods for the collection are now protected. This allows "
"classes in the same package and subclasses to still access the methods, but "
"prevents everybody else from altering the collections directly. Repeat the "
"steps for the collection on the other side."
msgstr ""
"Beachten Sie, dass die \"Get\" und \"Set\"-Methoden für die Collection nun "
"geschützt sind - die Klassen desselben Pakets und Unterklassen können nach "
"wie vor auf die Methoden zugreifen, aber (fast) niemand sonst kann direkt "
"Eingriffe an der Collection vornehmen. Es empfiehlt sich, dasselbe mit der "
"Collection auf der anderen Seite zu tun."

#. Tag: para
#: tutorial.xml:949
#, fuzzy, no-c-format
msgid ""
"What about the <literal>inverse mapping attribute? For you, and "
"for Java, a bi-directional link is simply a matter of setting the references "
"on both sides correctly. Hibernate, however, does not have enough "
"information to correctly arrange SQL <literal>INSERT and "
"<literal>UPDATE statements (to avoid constraint violations). "
"Making one side of the association <literal>inverse tells "
"Hibernate to consider it a <emphasis>mirror of the other side. "
"That is all that is necessary for Hibernate to resolve any issues that arise "
"when transforming a directional navigation model to a SQL database schema. "
"The rules are straightforward: all bi-directional associations need one side "
"as <literal>inverse. In a one-to-many association it has to be the "
"many-side, and in many-to-many association you can select either side."
msgstr ""
"Wie steht es um das <literal>inverse-Mapping-Attribut? Für Sie wie "
"auch für Java ist eine bidirektionale Verbindung lediglich eine Sache des "
"korrekten Setzens der Referenzen auf beiden Seiten. Hibernate hingegen "
"verfügt nicht über genügend Informationen, um SQL <literal>INSERT "
"und <literal>UPDATE-Anweisungen (um Coderegelverletzungen bei den "
"Randbedingung - sog. \"Constraint Violations\" - zu vermeiden) ordnungsgemäß "
"aufzubauen, und benötigt etwas Hilfe bei der korrekten Bearbeitung von "
"bidirektionalen Assoziationen. Ist eine Seite der Assoziation "
"<literal>inverse so wird sie von Hibernate ignoriert, da es diese "
"als einen <emphasis>Spiegel (\"Mirror\") der anderen Seite "
"ansieht. Das ist alles, was nötig ist, damit Hibernate alle Eventualitäten "
"bei der Transformation eines direktionalen Navigationsmodells in ein SQL "
"Datenbankschema erfolgreich bearbeitet. Die zu beachtenden Regeln sind "
"unkompliziert: Alle bidirektionalen Assoziationen benötigen eine "
"<literal>inverse Seite. In einer \"One-to-Many\"-Assoziation muss "
"das die \"Many\"-Seite, in einer \"Many-to-Many\"-Assoziation eine der "
"beiden Seiten sein."

#. Tag: title
#: tutorial.xml:965
#, no-c-format
msgid "Part 3 - The EventManager web application"
msgstr "Teil 3 - Die EventManager-Webanwendung"

#. Tag: para
#: tutorial.xml:967
#, fuzzy, no-c-format
msgid ""
"A Hibernate web application uses <literal>Session and "
"<literal>Transaction almost like a standalone application. "
"However, some common patterns are useful. You can now write an "
"<literal>EventManagerServlet. This servlet can list all events "
"stored in the database, and it provides an HTML form to enter new events."
msgstr ""
"Eine Hibernate Webanwendung verwendet <literal>Session und "
"<literal>Transaction beinahe wie eine selbständige Applikation. "
"Einige Muster sind jedoch hilfreich. Wir erstellen nun ein "
"<literal>EventManagerServlet. Dieses Servlet kann alle in der "
"Datenbank gespeicherten Veranstaltungen auflisten und bietet ein HTML-"
"Formular, in das neue Veranstaltungen eingetragen werden können."

#. Tag: title
#: tutorial.xml:975
#, no-c-format
msgid "Writing the basic servlet"
msgstr "Das Schreiben des Grundservlets"

#. Tag: para
#: tutorial.xml:977
#, fuzzy, no-c-format
msgid ""
"First we need create our basic processing servlet. Since our servlet only "
"handles HTTP <literal>GET requests, we will only implement the "
"<literal>doGet() method:"
msgstr ""
"Das Servlet bearbeitet nur HTTP <literal>GET-Anfragen, daher wird "
"die <literal>doGet()-Methode implementiert:"

#. Tag: programlisting
#: tutorial.xml:983
#, fuzzy, no-c-format
msgid ""
"<![CDATA[package org.hibernate.tutorial.web;\n"
"\n"
"// Imports\n"
"\n"
"public class EventManagerServlet extends HttpServlet {\n"
"\n"
"    protected void doGet(\n"
"            HttpServletRequest request,\n"
"            HttpServletResponse response) throws ServletException, "
"IOException {\n"
"\n"
"        SimpleDateFormat dateFormatter = new SimpleDateFormat( \"dd.MM.yyyy"
"\" );\n"
"\n"
"        try {\n"
"            // Begin unit of work\n"
"            HibernateUtil.getSessionFactory().getCurrentSession()."
"beginTransaction();\n"
"\n"
"            // Process request and render page...\n"
"\n"
"            // End unit of work\n"
"            HibernateUtil.getSessionFactory().getCurrentSession()."
"getTransaction().commit();\n"
"        }\n"
"        catch (Exception ex) {\n"
"            HibernateUtil.getSessionFactory().getCurrentSession()."
"getTransaction().rollback();\n"
"            if ( ServletException.class.isInstance( ex ) ) {\n"
"                throw ( ServletException ) ex;\n"
"            }\n"
"            else {\n"
"                throw new ServletException( ex );\n"
"            }\n"
"        }\n"
"    }\n"
"\n"
"}]]>"
msgstr ""
"protected void doGet(HttpServletRequest request,\n"
"                     HttpServletResponse response)\n"
"        throws ServletException, IOException {\n"
"\n"
"    SimpleDateFormat dateFormatter = new SimpleDateFormat(\"dd.MM.yyyy\");\n"
"\n"
"    try {\n"
"        // Begin unit of work\n"
"        HibernateUtil.getSessionFactory()\n"
"                .getCurrentSession().beginTransaction();\n"
"\n"
"        // Process request and render page...\n"
"\n"
"        // End unit of work\n"
"        HibernateUtil.getSessionFactory()\n"
"                .getCurrentSession().getTransaction().commit();\n"
"\n"
"    } catch (Exception ex) {\n"
"        HibernateUtil.getSessionFactory()\n"
"                .getCurrentSession().getTransaction().rollback();\n"
"        throw new ServletException(ex);\n"
"    }\n"
"\n"
"}"

#. Tag: para
#: tutorial.xml:985
#, no-c-format
msgid ""
"Save this servlet as <filename>src/main/java/org/hibernate/tutorial/web/"
"EventManagerServlet.java</filename>"
msgstr ""

#. Tag: para
#: tutorial.xml:990
#, fuzzy, no-c-format
msgid ""
"The pattern applied here is called <emphasis>session-per-request. "
"When a request hits the servlet, a new Hibernate <literal>Session "
"is opened through the first call to <literal>getCurrentSession() "
"on the <literal>SessionFactory. A database transaction is then "
"started. All data access occurs inside a transaction irrespective of whether "
"the data is read or written. Do not use the auto-commit mode in applications."
msgstr ""
"Das hier verwendete Muster heißt <emphasis>Session-per-Request "
"(\"Session pro Anfrage\"). Wenn eine Anfrage beim Servlet eingeht, so wird "
"eine neue Hibernate <literal>Session mit der ersten Aufruf an "
"<literal>getCurrentSession() an der SessionFactory use a new Hibernate Session "
"for every database operation. Use one Hibernate <literal>Session "
"that is scoped to the whole request. Use <literal>getCurrentSession() neue Hibernate Session, die die gesamte Anfrage umfasst. Verwenden Sie "
"<literal>getCurrentSession(), damit diese automatisch an den "
"aktuellen Java-Thread gebunden wird."

#. Tag: para
#: tutorial.xml:1006
#, fuzzy, no-c-format
msgid ""
"Next, the possible actions of the request are processed and the response "
"HTML is rendered. We will get to that part soon."
msgstr ""
"Als nächstes werden die möglichen Aktionen der Anfrage bearbeitet und die "
"HTML-Antwort gerendert. Dieser Teil wird in Kürze behandelt."

#. Tag: para
#: tutorial.xml:1011
#, fuzzy, no-c-format
msgid ""
"Finally, the unit of work ends when processing and rendering are complete. "
"If any problems occurred during processing or rendering, an exception will "
"be thrown and the database transaction rolled back. This completes the "
"<literal>session-per-request pattern. Instead of the transaction "
"demarcation code in every servlet, you could also write a servlet filter. "
"See the Hibernate website and Wiki for more information about this pattern "
"called <emphasis>Open Session in View. You will need it as soon "
"as you consider rendering your view in JSP, not in a servlet."
msgstr ""
"Die Arbeitseinheit endet schließlich, wenn Bearbeitung und Rendering "
"abgeschlossen sind. Falls es während der Bearbeitung und des Rendering zu "
"Problemen kommt, so wird eine Ausnahme gemeldet, und die "
"Datenbanktransaktion wird wiederholt. Das<literal>session-per-request— "
"(Ansicht der geöffneten Session) - Sie brauchen es, sobald Sie das Rendern "
"Ihrer Ansicht in JSP in Erwägung ziehen, nicht in einem Servlet."

#. Tag: title
#: tutorial.xml:1025
#, no-c-format
msgid "Processing and rendering"
msgstr "Bearbeitung und Rendering"

#. Tag: para
#: tutorial.xml:1027
#, fuzzy, no-c-format
msgid ""
"Now you can implement the processing of the request and the rendering of the "
"page."
msgstr ""
"Implementieren wir nun die Anfragenbearbeitung und das Rendern der Seite."

#. Tag: programlisting
#: tutorial.xml:1031
#, fuzzy, no-c-format
msgid ""
"<![CDATA[        // Write HTML header\n"
"        PrintWriter out = response.getWriter();\n"
"        out.println(\"<html>Event Manager"
"\");\n"
"\n"
"        // Handle actions\n"
"        if ( \"store\".equals(request.getParameter(\"action\")) ) {\n"
"\n"
"            String eventTitle = request.getParameter(\"eventTitle\");\n"
"            String eventDate = request.getParameter(\"eventDate\");\n"
"\n"
"            if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n"
"                out.println(\"<b>Please enter event title and date.Added event.\");\n"
"            }\n"
"        }\n"
"\n"
"        // Print page\n"
"       printEventForm(out);\n"
"       listEvents(out, dateFormatter);\n"
"\n"
"       // Write HTML footer\n"
"       out.println(\"</body>\");\n"
"       out.flush();\n"
"       out.close();]]>"
msgstr ""
"// Write HTML header\n"
"PrintWriter out = response.getWriter();\n"
"out.println(\"<html><head><title>Event Manager</"
"title></head><body>\");\n"
"\n"
"// Handle actions\n"
"if ( \"store\".equals(request.getParameter(\"action\")) ) {\n"
"\n"
"    String eventTitle = request.getParameter(\"eventTitle\");\n"
"    String eventDate = request.getParameter(\"eventDate\");\n"
"\n"
"    if ( \"\".equals(eventTitle) || \"\".equals(eventDate) ) {\n"
"        out.println(\"<b><i>Please enter event title and date."
"</i></b>\");\n"
"    } else {\n"
"        createAndStoreEvent(eventTitle, dateFormatter.parse(eventDate));\n"
"        out.println(\"<b><i>Added event.</i></b>"
"\");\n"
"    }\n"
"}\n"
"\n"
"// Print page\n"
"printEventForm(out);\n"
"listEvents(out, dateFormatter);\n"
"\n"
"// Write HTML footer\n"
"out.println(\"</body></html>\");\n"
"out.flush();\n"
"out.close();"

#. Tag: para
#: tutorial.xml:1033
#, fuzzy, no-c-format
msgid ""
"This coding style, with a mix of Java and HTML, would not scale in a more "
"complex application—keep in mind that we are only illustrating basic "
"Hibernate concepts in this tutorial. The code prints an HTML header and a "
"footer. Inside this page, an HTML form for event entry and a list of all "
"events in the database are printed. The first method is trivial and only "
"outputs HTML:"
msgstr ""
"Vorausgesetzt dieser Codierungsstil mit einer Mischung aus Java und HTML "
"würde in einer komplexeren Anwendung nicht skalieren — vergessen Sie "
"nicht, dass wir nur die grundlegenden Konzepte von Hibernate in dieser "
"Anleitung erläutern. Der Code druckt eine HTML-Kopf- und Fußzeile. Innerhalb "
"dieser Seite sind ein HTML-Formular für die Veranstaltungseingabe sowie eine "
"Liste sämtlicher Veranstaltungen in der Datenbank gedruckt. Die erste "
"Methode ist trivial und gibt nur HTML aus."

#. Tag: programlisting
#: tutorial.xml:1042
#, fuzzy, no-c-format
msgid ""
"<![CDATA[    private void printEventForm(PrintWriter out) {\n"
"        out.println(\"<h2>Add new event:\");\n"
"        out.println(\"<form>\");\n"
"        out.println(\"Title: <input name='eventTitle' length='50'/>
" "\");\n" " out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " "length='10'/><br/>\");\n" " out.println(\"<input type='submit' name='action' value='store'/>" "\");\n" " out.println(\"</form>\");\n" " }]]>" msgstr "" "private void printEventForm(PrintWriter out) {\n" " out.println(\"<h2>Add new event:</h2>\");\n" " out.println(\"<form>\");\n" " out.println(\"Title: <input name='eventTitle' length='50'/><br/" ">\");\n" " out.println(\"Date (e.g. 24.12.2009): <input name='eventDate' " "length='10'/><br/>\");\n" " out.println(\"<input type='submit' name='action' value='store'/>" "\");\n" " out.println(\"</form>\");\n" "}" #. Tag: para #: tutorial.xml:1044 #, no-c-format msgid "" "The <literal>listEvents() method uses the Hibernate " "<literal>Session bound to the current thread to execute a query:" msgstr "" "Die <literal>listEvents() Methode verwendet die an den aktuellen " "Thread gebundene Hibernate <literal>Session bei der Ausführung " "einer Abfrage:" #. Tag: programlisting #: tutorial.xml:1050 #, fuzzy, no-c-format msgid "" "<![CDATA[ private void listEvents(PrintWriter out, SimpleDateFormat " "dateFormatter) {\n" "\n" " List result = HibernateUtil.getSessionFactory()\n" " .getCurrentSession().createCriteria(Event.class).list();\n" " if (result.size() > 0) {\n" " out.println(\"<h2>Events in database:\");\n" " out.println(\"<table border='1'>\");\n" " out.println(\"<tr>\");\n" " out.println(\"<th>Event title\");\n" " out.println(\"<th>Event date\");\n" " out.println(\"</tr>\");\n" " Iterator it = result.iterator();\n" " while (it.hasNext()) {\n" " Event event = (Event) it.next();\n" " out.println(\"<tr>\");\n" " out.println(\"<td>\" + event.getTitle() + \"
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.