[jboss-cvs] JBossAS SVN: r95719 - projects/docs/enterprise/5.0/Hibernate/Hibernate_Core/pt-BR.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 28 21:20:18 EDT 2009


Author: ldelima at redhat.com
Date: 2009-10-28 21:20:17 -0400 (Wed, 28 Oct 2009)
New Revision: 95719

Modified:
   projects/docs/enterprise/5.0/Hibernate/Hibernate_Core/pt-BR/example_weblog.po
Log:
translation ongoing

Modified: projects/docs/enterprise/5.0/Hibernate/Hibernate_Core/pt-BR/example_weblog.po
===================================================================
--- projects/docs/enterprise/5.0/Hibernate/Hibernate_Core/pt-BR/example_weblog.po	2009-10-29 01:19:28 UTC (rev 95718)
+++ projects/docs/enterprise/5.0/Hibernate/Hibernate_Core/pt-BR/example_weblog.po	2009-10-29 01:20:17 UTC (rev 95719)
@@ -109,7 +109,7 @@
 "Project-Id-Version: example_weblog\n"
 "Report-Msgid-Bugs-To: http://bugs.kde.org\n"
 "POT-Creation-Date: 2009-09-15 07:03+0000\n"
-"PO-Revision-Date: 2009-10-29 11:18+1000\n"
+"PO-Revision-Date: 2009-10-29 11:19+1000\n"
 "Last-Translator: \n"
 "Language-Team:  <en at li.org>\n"
 "MIME-Version: 1.0\n"
@@ -742,4 +742,242 @@
 "    }\n"
 "}]]>"
 msgstr ""
+"<![CDATA[package eg;\n"
+"\n"
+"import java.util.ArrayList;\n"
+"import java.util.Calendar;\n"
+"import java.util.Iterator;\n"
+"import java.util.List;\n"
+"\n"
+"import org.hibernate.HibernateException;\n"
+"import org.hibernate.Query;\n"
+"import org.hibernate.Session;\n"
+"import org.hibernate.SessionFactory;\n"
+"import org.hibernate.Transaction;\n"
+"import org.hibernate.cfg.Configuration;\n"
+"import org.hibernate.tool.hbm2ddl.SchemaExport;\n"
+"\n"
+"public class BlogMain {\n"
+"    \n"
+"    private SessionFactory _sessions;\n"
+"    \n"
+"    public void configure() throws HibernateException {\n"
+"        _sessions = new Configuration()\n"
+"            .addClass(Blog.class)\n"
+"            .addClass(BlogItem.class)\n"
+"            .buildSessionFactory();\n"
+"    }\n"
+"    \n"
+"    public void exportTables() throws HibernateException {\n"
+"        Configuration cfg = new Configuration()\n"
+"            .addClass(Blog.class)\n"
+"            .addClass(BlogItem.class);\n"
+"        new SchemaExport(cfg).create(true, true);\n"
+"    }\n"
+"    \n"
+"    public Blog createBlog(String name) throws HibernateException {\n"
+"        \n"
+"        Blog blog = new Blog();\n"
+"        blog.setName(name);\n"
+"        blog.setItems( new ArrayList() );\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            session.persist(blog);\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"        return blog;\n"
+"    }\n"
+"    \n"
+"    public BlogItem createBlogItem(Blog blog, String title, String text)\n"
+"                        throws HibernateException {\n"
+"        \n"
+"        BlogItem item = new BlogItem();\n"
+"        item.setTitle(title);\n"
+"        item.setText(text);\n"
+"        item.setBlog(blog);\n"
+"        item.setDatetime( Calendar.getInstance() );\n"
+"        blog.getItems().add(item);\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            session.update(blog);\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"        return item;\n"
+"    }\n"
+"    \n"
+"    public BlogItem createBlogItem(Long blogid, String title, String text)\n"
+"                        throws HibernateException {\n"
+"        \n"
+"        BlogItem item = new BlogItem();\n"
+"        item.setTitle(title);\n"
+"        item.setText(text);\n"
+"        item.setDatetime( Calendar.getInstance() );\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            Blog blog = (Blog) session.load(Blog.class, blogid);\n"
+"            item.setBlog(blog);\n"
+"            blog.getItems().add(item);\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"        return item;\n"
+"    }\n"
+"    \n"
+"    public void updateBlogItem(BlogItem item, String text)\n"
+"                    throws HibernateException {\n"
+"        \n"
+"        item.setText(text);\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            session.update(item);\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"    }\n"
+"    \n"
+"    public void updateBlogItem(Long itemid, String text)\n"
+"                    throws HibernateException {\n"
+"    \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            BlogItem item = (BlogItem) session.load(BlogItem.class, "
+"itemid);\n"
+"            item.setText(text);\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"    }\n"
+"    \n"
+"    public List listAllBlogNamesAndItemCounts(int max)\n"
+"                    throws HibernateException {\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        List result = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            Query q = session.createQuery(\n"
+"                \"select blog.id, blog.name, count(blogItem) \" +\n"
+"                \"from Blog as blog \" +\n"
+"                \"left outer join blog.items as blogItem \" +\n"
+"                \"group by blog.name, blog.id \" +\n"
+"                \"order by max(blogItem.datetime)\"\n"
+"            );\n"
+"            q.setMaxResults(max);\n"
+"            result = q.list();\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"        return result;\n"
+"    }\n"
+"    \n"
+"    public Blog getBlogAndAllItems(Long blogid)\n"
+"                    throws HibernateException {\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        Blog blog = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            Query q = session.createQuery(\n"
+"                \"from Blog as blog \" +\n"
+"                \"left outer join fetch blog.items \" +\n"
+"                \"where blog.id = :blogid\"\n"
+"            );\n"
+"            q.setParameter(\"blogid\", blogid);\n"
+"            blog  = (Blog) q.uniqueResult();\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"        return blog;\n"
+"    }\n"
+"    \n"
+"    public List listBlogsAndRecentItems() throws HibernateException {\n"
+"        \n"
+"        Session session = _sessions.openSession();\n"
+"        Transaction tx = null;\n"
+"        List result = null;\n"
+"        try {\n"
+"            tx = session.beginTransaction();\n"
+"            Query q = session.createQuery(\n"
+"                \"from Blog as blog \" +\n"
+"                \"inner join blog.items as blogItem \" +\n"
+"                \"where blogItem.datetime > :minDate\"\n"
+"            );\n"
+"\n"
+"            Calendar cal = Calendar.getInstance();\n"
+"            cal.roll(Calendar.MONTH, false);\n"
+"            q.setCalendar(\"minDate\", cal);\n"
+"            \n"
+"            result = q.list();\n"
+"            tx.commit();\n"
+"        }\n"
+"        catch (HibernateException he) {\n"
+"            if (tx!=null) tx.rollback();\n"
+"            throw he;\n"
+"        }\n"
+"        finally {\n"
+"            session.close();\n"
+"        }\n"
+"        return result;\n"
+"    }\n"
+"}]]>"
 




More information about the jboss-cvs-commits mailing list