Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758
{"id":1290,"date":"2014-08-14T23:21:01","date_gmt":"2014-08-15T02:21:01","guid":{"rendered":"http:\/\/www.feltex.com.br\/felix\/?p=1290"},"modified":"2014-08-20T01:50:46","modified_gmt":"2014-08-20T04:50:46","slug":"gerenciar-transacao-jpa-via-filtro-projeto-web","status":"publish","type":"post","link":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/","title":{"rendered":"Como gerenciar a transa\u00e7\u00e3o JPA com Hibernate via Filtro em projeto Web"},"content":{"rendered":"

Como gerenciar a transa\u00e7\u00e3o JPA com Hibernate via Filtro em projeto Web<\/H1><\/p>\n

Ol\u00e1 amigos, muitos vezes precisamos gerenciar a transa\u00e7\u00e3o JPA em nosso servidor e n\u00e3o temos a op\u00e7\u00e3o de utilizar EJB ou Spring. Dessa forma, ficar a cargo do programador gerenciar o in\u00edcio e fim da transa\u00e7\u00e3o jpa como o banco dados. Entre a v\u00e1rias alternativas<\/p>\n

Ent\u00e3o vamos mostrar uma das formas de se fazer isso.
\n \"Transa\u00e7\u00e3o<\/p>\n


\n

Tecnologias utilizadas<\/H2><\/p>\n
    \n
  1. Java 7<\/li>\n
  2. Eclipse Luna<\/li>\n
  3. PrimeFaces 4<\/li>\n
  4. Tomcat 8<\/li>\n
  5. Hibernate 4<\/li>\n<\/ol>\n

    Essa abordagem \u00e9 muito comum e utilizada quando nossa aplica\u00e7\u00e3o fica dispon\u00edvel no Apache Tomcat<\/a>. Ele \u00e9 um servidor WEB e n\u00e3o <\/strong>possui suporte a tecnologia EJB, por exemplo.
    \n Em aplica\u00e7\u00f5es desktop(JSE), quando utilizamos JPA precisamos controlar a transa\u00e7\u00e3o jpa manualmente. Veja o exemplo abaixo dispon\u00edvel em nosso tutorial sobre JPA com
    Hibernate<\/a>.<\/p>\n

    \r\npublic void incluir(Aluno aluno) {\r\n\t\ttry {\r\n\t\t\tsession = HibernateUtil.getSession();\r\n\t\t\tsession.beginTransaction();\r\n\t\t\tsession.save(aluno);\r\n\t\t\tsession.getTransaction().commit();\r\n\t\t} catch (Exception e) {\r\n\t\t\tsession.getTransaction().rollback();\r\n\t\t\te.printStackTrace();\r\n\t\t} finally {\r\n\t\t\tsession.close();\r\n\t\t}\r\n\t}\r\n<\/pre>\n

    Veja que o c\u00f3digo acima precisamos fazer a chamada aos m\u00e9todos “session.beginTransaction();” e “session.getTransaction().commit();” isto \u00e9 necess\u00e1rio, pois estamos utilizando o padr\u00e3o BTM (Bean-Managed Transactions), ou seja, nossa aplica\u00e7\u00e3o tem que iniciar, executar a opera\u00e7\u00e3o desejada e em seguida concluir a opera\u00e7\u00e3o com um “commit” e caso ocorra um erro precisamos enviar o comando “session.getTransaction().rollback();” para desfazer as opera\u00e7\u00e3o que foram executadas.<\/p>\n

    Para o post de hoje utilizaremos o Exemplo completo com JSF Primefaces + Hibernate + MySQL<\/a> criado aqui no Blog para auxiliar no nosso aprendizado.<\/p>\n

    Fa\u00e7a download o WAR e importe no seu eclipse. Para lembrar como isso funciona acesse Importando um projeto Web no Eclipse<\/a> Ent\u00e3o criaremos um filtro, para isso ap\u00f3s a importa\u00e7\u00e3o no eclipse selecione o projeto com o bot\u00e3o direito “New ==> Filter” no campo pacote adicione:
    \n“br.com.feltex.academicnet.filter” e no campo Class Name digite: “FiltroJPA”. Selecione Finish.<\/p>\n

    O c\u00f3digo do seu filtro ficar\u00e1 dessa maneira:<\/p>\n

    \r\npackage br.com.feltex.academicnet.filter;\r\n\r\nimport java.io.IOException;\r\n\r\nimport javax.servlet.Filter;\r\nimport javax.servlet.FilterChain;\r\nimport javax.servlet.FilterConfig;\r\nimport javax.servlet.ServletException;\r\nimport javax.servlet.ServletRequest;\r\nimport javax.servlet.ServletResponse;\r\nimport javax.servlet.annotation.WebFilter;\r\n\r\nimport org.hibernate.Session;\r\n\r\nimport br.com.feltex.hibernate.util.HibernateUtil;\r\n\r\n\/\/ Aten\u00e7\u00e3o que apenas as chamadas JSF ser\u00e3o filtradas por este filtro\r\n@WebFilter(\"*.xhtml\")\r\npublic class FiltroJPA implements Filter {\r\n\r\n\tpublic FiltroJPA() {}\r\n\r\n\tpublic void destroy() {}\r\n\r\n\tpublic void doFilter(ServletRequest request, ServletResponse response,\r\n\t\t\tFilterChain chain) throws IOException, ServletException {\r\n\t\tSession session = HibernateUtil.getSession();\r\n\t\ttry {\r\n\t\t\tsession.beginTransaction();\r\n\t\t\tchain.doFilter(request, response);\r\n\t\t\tsession.getTransaction().commit();\r\n\t\t} catch (Exception e) {\r\n\t\t\tsession.getTransaction().rollback();\r\n\t\t\te.printStackTrace();\r\n\t\t} finally {\r\n\t\t\tif (session != null && session.isOpen()) {\r\n\t\t\t\tsession.close();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void init(FilterConfig fConfig) throws ServletException {}\r\n}  \r\n<\/pre>\n

    Nesse filtro estamos fazendo o controle de transa\u00e7\u00e3o jpa de todas as opera\u00e7\u00f5es no nosso banco de dados. Antes de fazer qualquer a\u00e7\u00e3o no banco de dados as chamadas da nossa aplica\u00e7\u00e3o passam no nosso filtro que cria uma sess\u00e3o e inicia uma transa\u00e7\u00e3o jpa “beginTransaction”. Em seguida \u00e9 executado o m\u00e9todo “chain.doFilter(request, response);” que permite a execu\u00e7\u00e3o do m\u00e9todo desejado no DAO. Em seguida a execu\u00e7\u00e3o volta para o nosso FiltroJPA que conclui a transa\u00e7\u00e3o jpa executando um commit.<\/p>\n

    Agora vamos analisar a nossa classe “AlunoHibernateDAO” que ficou simplificada em rela\u00e7\u00e3o \u00e0 vers\u00e3o que est\u00e1 no Post Exemplo completo com JSF Primefaces + Hibernate + MySQL<\/a>.<\/p>\n

    \r\npackage br.com.feltex.academicnet.dao.hibernate;\r\n\r\nimport java.util.List;\r\n\r\nimport org.hibernate.Criteria;\r\nimport org.hibernate.Session;\r\nimport org.hibernate.criterion.Order;\r\nimport org.hibernate.criterion.Restrictions;\r\n\r\nimport br.com.feltex.academicnet.dao.AlunoDAO;\r\nimport br.com.feltex.academicnet.entidade.Aluno;\r\nimport br.com.feltex.hibernate.util.HibernateUtil;\r\n\r\npublic class AlunoHibernateDAO implements AlunoDAO {\r\n\r\n\tprivate Session session;\r\n\r\n\tpublic void alterar(Aluno p) {\r\n\t\tsession = HibernateUtil.getSession();\r\n\t\tsession.merge(p);\r\n\t}\r\n\r\n\tpublic Aluno consultar(Aluno aluno) {\r\n\t\tsession = HibernateUtil.getSession();\r\n\t\treturn (Aluno) session.get(Aluno.class, aluno.getMatricula());\r\n\t}\r\n\r\n\tpublic void excluir(Aluno p) {\r\n\t\tsession = HibernateUtil.getSession();\r\n\t\tAluno alunoPesquisado = consultar(p);\r\n\t\tsession.delete(alunoPesquisado);\r\n\t}\r\n\r\n\tpublic boolean existe(Aluno aluno) {\r\n\t\tAluno a = consultar(aluno);\r\n\t\treturn (a.getMatricula() != null);\r\n\t}\r\n\r\n\tpublic void inserir(Aluno p) {\r\n\t\tsession = HibernateUtil.getSession();\r\n\t\tsession.save(p);\r\n\t}\r\n\r\n\t@SuppressWarnings(\"unchecked\")\r\n\tpublic List listar() {\r\n\t\tsession = HibernateUtil.getSession();\r\n\t\treturn (List) session.createCriteria(Aluno.class).list();\r\n\t}\r\n\r\n\t@SuppressWarnings(\"unchecked\")\r\n\tpublic List listar(Aluno aluno) {\r\n\t\tCriteria c = session.createCriteria(Aluno.class);\r\n\t\tif (aluno.getNome().length() > 0) {\r\n\t\t\tc.add(Restrictions.like(\"nome\", aluno.getNome() + \"%\"));\r\n\t\t}\r\n\t\tc.addOrder(Order.asc(\"nome\"));\r\n\t\treturn (List) c.list();\r\n\t}\r\n}\r\n<\/pre>\n

    Vejamos como foram as mudan\u00e7as, para isso compare o m\u00e9todo incluir <\/p>\n

    Antes:<\/p>\n

    \r\npublic void incluir(Aluno aluno) {\r\n\t\ttry {\r\n\t\t\tsession = HibernateUtil.getSession();\r\n\t\t\tsession.beginTransaction();\r\n\t\t\tsession.save(aluno);\r\n\t\t\tsession.getTransaction().commit();\r\n\t\t} catch (Exception e) {\r\n\t\t\tsession.getTransaction().rollback();\r\n\t\t\te.printStackTrace();\r\n\t\t} finally {\r\n\t\t\tsession.close();\r\n\t\t}\r\n\t}\r\n<\/pre>\n

    E depois!<\/p>\n

    \r\npublic void inserir(Aluno p) {\r\n\t\tsession = HibernateUtil.getSession();\r\n\t\tsession.save(p);\r\n\t}\r\n<\/pre>\n

    Isto n\u00e3o \u00e9 MAGIA e sim TECNOLOGIA!<\/strong>
    \n O que fizemos neste caso foi a passagem do controle de transa\u00e7\u00e3o jpa para o filtro que ir\u00e1 interceptar todas as chamadas (xhtml) antes de ocorrerem as opera\u00e7\u00f5es no DAO.<\/p>\n

    Tamb\u00e9m fizemos a altera\u00e7\u00e3o da Classe Hibernate Util para pegar sempre a mesma sess\u00e3o:<\/p>\n

    \r\n\r\npackage br.com.feltex.hibernate.util;\r\n\r\nimport org.hibernate.Session;\r\nimport org.hibernate.SessionFactory;\r\nimport org.hibernate.cfg.Configuration;\r\nimport org.hibernate.service.ServiceRegistry;\r\nimport org.hibernate.service.ServiceRegistryBuilder;\r\nimport org.hibernate.tool.hbm2ddl.SchemaExport;\r\n\r\npublic class HibernateUtil {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tSystem.out.println(\"Inicio\");\r\n\r\n\t\tConfiguration cfg = new Configuration();\r\n\t\tcfg.configure();\r\n\t\tSchemaExport se = new SchemaExport(cfg);\r\n\t\tse.create(true, true);\r\n\r\n\t\tSystem.out.println(\"Fim\");\r\n\t}\r\n\r\n\tprivate static SessionFactory sessionFactory = null;\r\n\tprivate static ServiceRegistry serviceRegistry;\r\n\r\n\tstatic {\r\n\t\ttry {\r\n\t\t\tsessionFactory = getSessionFactory();\r\n\t\t} catch (Throwable ex) {\r\n\t\t\tSystem.err.println(\"Initial SessionFactory creation failed.\" + ex);\r\n\t\t\tthrow new ExceptionInInitializerError(ex);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static SessionFactory getSessionFactory() {\r\n\t\tif (sessionFactory == null) {\r\n\t\t\tConfiguration configuration = new Configuration();\r\n\t\t\tconfiguration.configure();\r\n\t\t\tserviceRegistry = new ServiceRegistryBuilder().applySettings(\r\n\t\t\t\t\tconfiguration.getProperties()).buildServiceRegistry();\r\n\t\t\tsessionFactory = configuration.buildSessionFactory(serviceRegistry);\r\n\t\t\tsessionFactory.openSession();\r\n\t\t\treturn sessionFactory;\r\n\t\t}\r\n\t\treturn sessionFactory;\r\n\t}\r\n\r\n\tpublic static Session getSession() {\r\n\t\t\/\/ return sessionFactory.openSession();\r\n\t\treturn getSessionFactory().getCurrentSession();\r\n\t}\r\n}\r\n\r\n<\/pre>\n

    No m\u00e9todo “getSession()” tivemos que mudar de openSession para “getCurrentSession()” isso faz com que nossa aplica\u00e7\u00e3o reutilize a sess\u00e3o que est\u00e1 aberta.
    \nNosso arquivo de configura\u00e7\u00e3o do Hibernate (hibernate.cfg.xml) tamb\u00e9m foi alterado e ficou assim:<\/p>\n

    \r\n\r\n\r\n\r\n\r\n\t\r\n\t\t com.mysql.jdbc.Driver<\/property>\r\n        jdbc:mysql:\/\/localhost:3306\/bdacademicnet<\/property>\r\n        root<\/property>\r\n        teco01<\/property>\r\n        org.hibernate.dialect.MySQLDialect<\/property>\r\n        thread<\/property>\r\n\t\ttrue<\/property>\r\n\t\ttrue<\/property>\r\n\t\t20<\/property>\r\n\r\n\t\t1<\/property>\r\n\t\t100<\/property>\r\n\t\t100<\/property>\r\n\t\t0<\/property>\r\n\t\t10<\/property>\r\n\t\t100<\/property>\r\n\t\t\r\n\t\tupdate<\/property>\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\t\r\n\t<\/session-factory>\r\n<\/hibernate-configuration>\r\n<\/pre>\n

    Adicionamos a linha: “thread<\/property>” para garantir que o m\u00e9todo “getCurrentSession()” da classe HibernateUtil funcione corretamente.<\/p>\n

    Conclus\u00e3o<\/H2><\/p>\n

    Esta forma de controle de transa\u00e7\u00e3o jpa \u00e9 muito interessante quando n\u00e3o podemos utilizar o CTM – Container Transaction Manager. Isso \u00e9 comum em aplica\u00e7\u00f5es que s\u00f3 rodam em container Web, sistemas legados ou aplica\u00e7\u00f5es que tem como premissa o uso de tecnologias Servlet ou JSF.
    \n Leia mais sobre
    EJB 3<\/a> que traz muitas facilidades no uso de CTM, mas tem que ser executado em um EJB container (JBoss\/WildFly, Websphere, WebLogic).
    \n Como alternativa leia tamb\u00e9m sobre o uso do Framework Spring que tamb\u00e9m faz o controle de transa\u00e7\u00e3o jpa para nossa aplica\u00e7\u00e3o e tem a vantagem de rodar no Tomcat e nos EJB Containers.<\/p>\n

    Para pegar o c\u00f3digo completo clique aqui<\/a><\/p>\n

    Veja como ficar\u00e1 a nossa aplica\u00e7\u00e3o:
    \n\"Transa\u00e7\u00e3o<\/p>\n

    Ent\u00e3o amigos por hoje \u00e9 s\u00f3 e vida que segue.<\/strong><\/em><\/p>\n

    Links relacionados<\/H2>
    \n
    Configura\u00e7\u00e3o de acesso a console do servidor TOMCAT 8<\/a>
    \n
    Tomcat<\/a>
    \n
    Instala\u00e7\u00e3o e configura\u00e7\u00e3o do TOMCAT<\/a>
    \n
    Criar datasource no servidor Tomcat 8<\/a><\/p>\n

    Tutorial da Oracle<\/a><\/p>\n

    N\u00e3o esque\u00e7a de curtir este post nas rede sociais. D\u00ea a sua contribui\u00e7\u00e3o social e ajude o autor:<\/H2><\/p>\n","protected":false},"excerpt":{"rendered":"

    Como gerenciar a transa\u00e7\u00e3o JPA com Hibernate via Filtro em projeto Web Ol\u00e1 amigos, muitos vezes precisamos gerenciar a transa\u00e7\u00e3o JPA em nosso servidor e n\u00e3o temos a op\u00e7\u00e3o de utilizar EJB ou Spring. Dessa forma, ficar a cargo do …<\/p>\n

    Como gerenciar a transa\u00e7\u00e3o JPA com Hibernate via Filtro em projeto Web<\/span> Read More »<\/a><\/p>\n

    <\/p>\n","protected":false},"author":1,"featured_media":1300,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[1],"tags":[],"yoast_head":"\nComo gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web<\/title>\n<meta name=\"description\" content=\"Como podemos gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web\" \/>\n<meta property=\"og:description\" content=\"Como podemos gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/\" \/>\n<meta property=\"og:site_name\" content=\"Aprenda Java\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/feltex.br\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-15T02:21:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-08-20T04:50:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/08\/Transa\u00e7\u00e3o-JPA.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"591\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andr\u00e9 F\u00e9lix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/\",\"name\":\"Aprenda Java\",\"description\":\"Cursos de java, SQL e Engenharia de Software\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#primaryimage\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/08\/Transa\\u00e7\\u00e3o-JPA.png\",\"contentUrl\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/08\/Transa\\u00e7\\u00e3o-JPA.png\",\"width\":640,\"height\":591,\"caption\":\"Transa\\u00e7\\u00e3o JPA\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#webpage\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/\",\"name\":\"Como gerenciar a transa\\u00e7\\u00e3o JPA via Filtro em projeto Web\",\"isPartOf\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#primaryimage\"},\"datePublished\":\"2014-08-15T02:21:01+00:00\",\"dateModified\":\"2014-08-20T04:50:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\"},\"description\":\"Como podemos gerenciar a transa\\u00e7\\u00e3o JPA via Filtro em projeto Web\",\"breadcrumb\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Como gerenciar a transa\\u00e7\\u00e3o JPA com Hibernate via Filtro em projeto Web\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\",\"name\":\"Andr\\u00e9 F\\u00e9lix\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#personlogo\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"caption\":\"Andr\\u00e9 F\\u00e9lix\"},\"sameAs\":[\"http:\/\/www.feltex.com.br\"],\"url\":\"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web","description":"Como podemos gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/","og_locale":"pt_BR","og_type":"article","og_title":"Como gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web","og_description":"Como podemos gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web","og_url":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/","og_site_name":"Aprenda Java","article_publisher":"https:\/\/www.facebook.com\/feltex.br","article_published_time":"2014-08-15T02:21:01+00:00","article_modified_time":"2014-08-20T04:50:46+00:00","og_image":[{"width":640,"height":591,"url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/08\/Transa\u00e7\u00e3o-JPA.png","type":"image\/png"}],"twitter_misc":{"Escrito por":"Andr\u00e9 F\u00e9lix","Est. tempo de leitura":"6 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.feltex.com.br\/felix\/#website","url":"https:\/\/www.feltex.com.br\/felix\/","name":"Aprenda Java","description":"Cursos de java, SQL e Engenharia de Software","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#primaryimage","inLanguage":"pt-BR","url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/08\/Transa\u00e7\u00e3o-JPA.png","contentUrl":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/08\/Transa\u00e7\u00e3o-JPA.png","width":640,"height":591,"caption":"Transa\u00e7\u00e3o JPA"},{"@type":"WebPage","@id":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#webpage","url":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/","name":"Como gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web","isPartOf":{"@id":"https:\/\/www.feltex.com.br\/felix\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#primaryimage"},"datePublished":"2014-08-15T02:21:01+00:00","dateModified":"2014-08-20T04:50:46+00:00","author":{"@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069"},"description":"Como podemos gerenciar a transa\u00e7\u00e3o JPA via Filtro em projeto Web","breadcrumb":{"@id":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.feltex.com.br\/felix\/gerenciar-transacao-jpa-via-filtro-projeto-web\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Como gerenciar a transa\u00e7\u00e3o JPA com Hibernate via Filtro em projeto Web"}]},{"@type":"Person","@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069","name":"Andr\u00e9 F\u00e9lix","image":{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/#personlogo","inLanguage":"pt-BR","url":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","caption":"Andr\u00e9 F\u00e9lix"},"sameAs":["http:\/\/www.feltex.com.br"],"url":"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/"}]}},"_links":{"self":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/1290"}],"collection":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/comments?post=1290"}],"version-history":[{"count":28,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/1290\/revisions"}],"predecessor-version":[{"id":1332,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/1290\/revisions\/1332"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media\/1300"}],"wp:attachment":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media?parent=1290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/categories?post=1290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/tags?post=1290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}