alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (xml.po)

This example Hibernate source code file (xml.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

account, cdata, cdata, customer, customer_id, element, element, hibernate, pojo, session, tag, tag, xml, xml

The Hibernate xml.po source code

# translation of Collection_Mapping.po to
# Xi Huang <xhuang@redhat.com>, 2006.
# Xi HUANG <xhuang@redhat.com>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-10T07:25:35\n"
"PO-Revision-Date: 2010-03-16 10:02+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team:  <en@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.11.4\n"

#. Tag: title
#, no-c-format
msgid "XML Mapping"
msgstr "XML 映射"

#. Tag: para
#, no-c-format
msgid "<emphasis> XML Mapping is an experimental feature in Hibernate 3.0 and is currently under active development. "
msgstr "<emphasis>注意 XML 映射只是 Hibernate 3.0 的一个实验性的特性。这一特性仍在积极开发中。 "

#. Tag: title
#, no-c-format
msgid "Working with XML data"
msgstr "用 XML 数据进行工作"

#. Tag: para
#, no-c-format
msgid "Hibernate allows you to work with persistent XML data in much the same way you work with persistent POJOs. A parsed XML tree can be thought of as another way of representing the relational data at the object level, instead of POJOs."
msgstr "Hibernate 使得你可以用 XML 数据来进行工作,恰如你用持久化的 POJO 进行工作那样。解析过的 XML 树 可以被认为是代替 POJO 的另外一种在对象层面上表示关系型数据的途径。"

#. Tag: para
#, no-c-format
msgid "Hibernate supports dom4j as API for manipulating XML trees. You can write queries that retrieve dom4j trees from the database and have any modification you make to the tree automatically synchronized to the database. You can even take an XML document, parse it using dom4j, and write it to the database with any of Hibernate's basic operations: <literal>persist(), saveOrUpdate(), merge(), delete(), replicate() (merging is not yet supported)."
msgstr "Hibernate 支持采用 dom4j 作为操作 XML 树的 API。你可以写一些查询从数据库中检索出 dom4j 树,随后你对这颗树做的任何修改都将自动同步回数据库。你甚至可以用 dom4j 解析 一篇 XML 文档,然后使用 Hibernate 的任一基本操作将它写入数据库:<literal>persist(),saveOrUpdate(),merge(),delete(),replicate() (合并操作merge()目前还不支持)。"

#. Tag: para
#, no-c-format
msgid "This feature has many applications including data import/export, externalization of entity data via JMS or SOAP and XSLT-based reporting."
msgstr "这一特性可以应用在很多场合,包括数据导入导出,通过 JMS 或 SOAP 具体化实体数据以及 基于 XSLT 的报表。"

#. Tag: para
#, no-c-format
msgid "A single mapping can be used to simultaneously map properties of a class and nodes of an XML document to the database, or, if there is no class to map, it can be used to map just the XML."
msgstr "一个单一的映射就可以将类的属性和 XML 文档的节点同时映射到数据库。如果不需要映射类,它也可以用来只映射 XML 文档。 "

#. Tag: title
#, no-c-format
msgid "Specifying XML and class mapping together"
msgstr "指定同时映射 XML 和类"

#. Tag: para
#, no-c-format
msgid "Here is an example of mapping a POJO and XML simultaneously:"
msgstr "这是一个同时映射 POJO 和 XML 的例子:"

#. Tag: title
#, no-c-format
msgid "Specifying only an XML mapping"
msgstr "只定义 XML 映射"

#. Tag: para
#, no-c-format
msgid "Here is an example where there is no POJO class:"
msgstr "这是一个不映射 POJO 的例子:"

#. Tag: para
#, no-c-format
msgid "This mapping allows you to access the data as a dom4j tree, or as a graph of property name/value pairs or java <literal>Maps. The property names are purely logical constructs that can be referred to in HQL queries."
msgstr "这个映射使得你既可以把数据作为一棵 dom4j 树那样访问,又可以作为由属性键值对(java <literal>Map)组成的图那样访问。属性名字纯粹是逻辑上的结构,你可以在 HQL 查询中引用它。"

#. Tag: title
#, no-c-format
msgid "XML mapping metadata"
msgstr "XML 映射元数据"

#. Tag: para
#, no-c-format
msgid "A range of Hibernate mapping elements accept the <literal>node attribute. This lets you specify the name of an XML attribute or element that holds the property or entity data. The format of the node attribute must be one of the following:"
msgstr "许多 Hibernate 映射元素具有 <literal>node 属性。这使你可以指定用来保存 属性或实体数据的 XML 属性或元素。node 属性必须是下列格式之一: "

#. Tag: para
#, no-c-format
msgid "<literal>\"element-name\": map to the named XML element"
msgstr "<literal>\"element-name\":映射为指定的 XML 元素"

#. Tag: para
#, no-c-format
msgid "<literal>\"@attribute-name\": map to the named XML attribute"
msgstr "<literal>\"@attribute-name\":映射为指定的 XML 属性"

#. Tag: para
#, no-c-format
msgid "<literal>\".\": map to the parent element"
msgstr "<literal>\".\":映射为父元素"

#. Tag: para
#, no-c-format
msgid "<literal>\"element-name/@attribute-name\": map to the named attribute of the named element"
msgstr "<literal>\"element-name/@attribute-name\":映射为指定元素的指定属性"

#. Tag: para
#, no-c-format
msgid "For collections and single valued associations, there is an additional <literal>embed-xml attribute. If embed-xml=\"true\", the default, the XML tree for the associated entity (or collection of value type) will be embedded directly in the XML tree for the entity that owns the association. Otherwise, if embed-xml=\"false\", then only the referenced identifier value will appear in the XML for single point associations and collections will not appear at all."
msgstr "对于集合和单值的关联,有一个额外的 <literal>embed-xml 属性可用。这个属性的缺省值是真(embed-xml=\"true\")。如果 embed-xml=\"true\",则对应于被关联实体或值类型的集合的XML树将直接嵌入拥有这些关联的实体的 XML 树中。否则,如果 embed-xml=\"false\",那么对于单值的关联,仅被引用的实体的标识符出现在 XML 树中(被引用实体本身不出现),而集合则根本不出现。"

#. Tag: para
#, no-c-format
msgid "Do not leave <literal>embed-xml=\"true\" for too many associations, since XML does not deal well with circularity."
msgstr "你应该小心,不要让太多关联的 embed-xml 属性为真(<literal>embed-xml=\"true\"),因为 XML 不能很好地处理循环引用。"

#. Tag: para
#, no-c-format
msgid "In this case, the collection of account ids is embedded, but not the actual account data. The following HQL query:"
msgstr "在这个例子中,我们决定嵌入帐目号码(account id)的集合,但不嵌入实际的帐目数据。下面的 HQL 查询: "

#. Tag: para
#, no-c-format
msgid "would return datasets such as this:"
msgstr "返回的数据集将是这样: "

#. Tag: para
#, no-c-format
msgid "If you set <literal>embed-xml=\"true\" on the <one-to-many> mapping, the data might look more like this:"
msgstr "如果你把一对多映射 <literal><one-to-many> 的 embed-xml 属性置为真(embed-xml=\"true\"),则数据看上去就像这样:"

#. Tag: title
#, no-c-format
msgid "Manipulating XML data"
msgstr "操作 XML 数据"

#. Tag: para
#, no-c-format
msgid "You can also re-read and update XML documents in the application. You can do this by obtaining a dom4j session:"
msgstr "你也可以重新读入和更新应用程序中的 XML 文档。通过获取一个 dom4j 会话可以做到这一点:"

#. Tag: para
#, no-c-format
msgid "When implementing XML-based data import/export, it is useful to combine this feature with Hibernate's <literal>replicate() operation."
msgstr "将这一特色与 Hibernate 的 <literal>replicate() 操作结合起来对于实现的基于 XML 的数据导入/导出将非常有用。"

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["
#~ msgid ""
#~ "<![CDATA[from Customer c left join fetch c.accounts where c.lastName "
#~ "like :lastName]]>"
#~ msgstr ""
#~ "<![CDATA[from Customer c left join fetch c.accounts where c.lastName "
#~ "like :lastName]]>"
#~ msgid ""
#~ "<![CDATA[\n"
#~ "    <account short-desc=\"Credit Card\">985612323\n"
#~ "    <name>\n"
#~ "        <first-name>Gavin\n"
#~ "        <initial>A\n"
#~ "        <last-name>King\n"
#~ "    </name>\n"
#~ "    ...\n"
#~ "</customer>]]>"
#~ msgstr ""
#~ "<![CDATA[\n"
#~ "    <account short-desc=\"Credit Card\">985612323\n"
#~ "    <name>\n"
#~ "        <first-name>Gavin\n"
#~ "        <initial>A\n"
#~ "        <last-name>King\n"
#~ "    </name>\n"
#~ "    ...\n"
#~ "</customer>]]>"
#~ msgid ""
#~ "<![CDATA[\n"
#~ "    </account>\n"
#~ "    <account id=\"985612323\" short-desc=\"Credit Card\">\n"
#~ "        <customer id=\"123456789\"/>\n"
#~ "        <balance>-2370.34\n"
#~ "    </account>\n"
#~ "    <name>\n"
#~ "        <first-name>Gavin\n"
#~ "        <initial>A\n"
#~ "        <last-name>King\n"
#~ "    </name>\n"
#~ "    ...\n"
#~ "</customer>]]>"
#~ msgstr ""
#~ "<![CDATA[\n"
#~ "    </account>\n"
#~ "    <account id=\"985612323\" short-desc=\"Credit Card\">\n"
#~ "        <customer id=\"123456789\"/>\n"
#~ "        <balance>-2370.34\n"
#~ "    </account>\n"
#~ "    <name>\n"
#~ "        <first-name>Gavin\n"
#~ "        <initial>A\n"
#~ "        <last-name>King\n"
#~ "    </name>\n"
#~ "    ...\n"
#~ "</customer>]]>"
#~ msgid ""
#~ "<![CDATA[Document doc = ....;\n"
#~ "       \n"
#~ "Session session = factory.openSession();\n"
#~ "Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "List results = dom4jSession\n"
#~ "    .createQuery(\"from Customer c left join fetch c.accounts where c."
#~ "lastName like :lastName\")\n"
#~ "    .list();\n"
#~ "for ( int i=0; i<results.size(); i++ ) {\n"
#~ "    //add the customer data to the XML document\n"
#~ "    Element customer = (Element) results.get(i);\n"
#~ "    doc.add(customer);\n"
#~ "}\n"
#~ "\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgstr ""
#~ "<![CDATA[Document doc = ....;\n"
#~ "       \n"
#~ "Session session = factory.openSession();\n"
#~ "Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "List results = dom4jSession\n"
#~ "    .createQuery(\"from Customer c left join fetch c.accounts where c."
#~ "lastName like :lastName\")\n"
#~ "    .list();\n"
#~ "for ( int i=0; i<results.size(); i++ ) {\n"
#~ "    //add the customer data to the XML document\n"
#~ "    Element customer = (Element) results.get(i);\n"
#~ "    doc.add(customer);\n"
#~ "}\n"
#~ "\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgid ""
#~ "<![CDATA[Session session = factory.openSession();\n"
#~ "Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "Element cust = (Element) dom4jSession.get(\"Customer\", customerId);\n"
#~ "for ( int i=0; i<results.size(); i++ ) {\n"
#~ "    Element customer = (Element) results.get(i);\n"
#~ "    //change the customer name in the XML and database\n"
#~ "    Element name = customer.element(\"name\");\n"
#~ "    name.element(\"first-name\").setText(firstName);\n"
#~ "    name.element(\"initial\").setText(initial);\n"
#~ "    name.element(\"last-name\").setText(lastName);\n"
#~ "}\n"
#~ "\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgstr ""
#~ "<![CDATA[Session session = factory.openSession();\n"
#~ "Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "Element cust = (Element) dom4jSession.get(\"Customer\", customerId);\n"
#~ "for ( int i=0; i<results.size(); i++ ) {\n"
#~ "    Element customer = (Element) results.get(i);\n"
#~ "    //change the customer name in the XML and database\n"
#~ "    Element name = customer.element(\"name\");\n"
#~ "    name.element(\"first-name\").setText(firstName);\n"
#~ "    name.element(\"initial\").setText(initial);\n"
#~ "    name.element(\"last-name\").setText(lastName);\n"
#~ "}\n"
#~ "\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"

Other Hibernate examples (source code examples)

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

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.