Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 5366 invoked from network); 3 Dec 2008 19:05:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Dec 2008 19:05:55 -0000 Received: (qmail 27494 invoked by uid 500); 3 Dec 2008 19:06:04 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 27470 invoked by uid 500); 3 Dec 2008 19:06:04 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 27459 invoked by uid 99); 3 Dec 2008 19:06:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 11:06:04 -0800 X-ASF-Spam-Status: No, hits=-0.3 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of fern@alum.mit.edu does not designate 66.111.4.25 as permitted sender) Received: from [66.111.4.25] (HELO out1.smtp.messagingengine.com) (66.111.4.25) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 19:04:37 +0000 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 1CA4E1CC231 for ; Wed, 3 Dec 2008 14:02:15 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 03 Dec 2008 14:02:15 -0500 X-Sasl-enc: 1aTwlKJ0YA7zRRDtrMGElcUOLmHdAMQp5+DGNG8KOM3m 1228330934 Received: from [10.0.7.180] (unknown [63.202.1.94]) by mail.messagingengine.com (Postfix) with ESMTPSA id 81CBC1BCAE for ; Wed, 3 Dec 2008 14:02:14 -0500 (EST) Message-ID: <4936D79B.2010008@alum.mit.edu> Date: Wed, 03 Dec 2008 11:01:47 -0800 From: Fernando Padilla User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: users@openjpa.apache.org Subject: Re: Targeted Query in Slices References: <1227695057973-1580324.post@n2.nabble.com> <1227715082979-1581281.post@n2.nabble.com> <1227779073573-1584618.post@n2.nabble.com> <1227858108937-1588175.post@n2.nabble.com> <1227872899560-1588895.post@n2.nabble.com> In-Reply-To: <1227872899560-1588895.post@n2.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Any progress on this?? ps - Since I'm committing myself to moving our company to openjpa-slices I am very interested in any and all bugs with slices :) :) (though i'm not a developer in openjpa) thiago ananias wrote: > > Hello again Pinaki! > > I'm running this simple test: > > import java.util.*; > import javax.persistence.*; > import br.unicsul.model.*; > import br.unicsul.sistema.Utility; > import org.apache.openjpa.slice.SlicePersistence; > > public class Main { > > public static void main(String args[]) { > > Properties props = new Properties(); > > EntityManagerFactory factory = > Persistence.createEntityManagerFactory("PersistenceUnit", props); > EntityManager em2 = factory.createEntityManager(); > > Query q = em2.createQuery("select p from Livro p"); > q.setHint("openjpa.hint.slice.Target", "TWO"); > > for (Livro v : (List) q.getResultList()) { > > System.out.println("Returned Slice --> " + > SlicePersistence.getSlice(v)); > > System.out.println("Retorno do BD --> " + v.getNome() + " > (created on: " + v.getDtInsert() + ")"); > System.out.println("Retorno JSON --> " + Utility.toJSON(v)); > > } > > em2.close(); > factory.close(); > > } > > } > > > if i put the hint "TWO" the program return this message > 2027 PersistenceUnit.ONE TRACE [main] openjpa.jdbc.SQL - conn 5156931> executing prepstmnt 17226426 SELECT t0.id, t0.DTYPE, t0.db, > t0.dt_insert, t0.tx_descricao, t0.vc_destaque, t0.vl_estoque, t0.vc_nome, > t0.vl_preco, t1.id, t1.db, t1.dt_insert, t1.vc_nome, t2.id, t2.db, > t2.dt_insert, t2.vc_nome, t0.it_ano, t0.it_edicao, t3.id, t3.db, > t3.dt_insert, t3.vc_logo, t3.vc_nome, t3.vc_site, t0.vc_isbn, t0.it_paginas > FROM produto t0 LEFT OUTER JOIN secao t1 ON t0.pai = t1.id LEFT OUTER JOIN > editora t3 ON t0.editora = t3.id LEFT OUTER JOIN secao t2 ON t1.pai = t2.id > WHERE t0.DTYPE = ? [params=(String) Livro] > > if i put the hint "TWO" the program return this message > 1411 PersistenceUnit.ONE TRACE [main] openjpa.jdbc.SQL - conn 5156931> executing prepstmnt 4579880 SELECT t0.id, t0.DTYPE, t0.db, > t0.dt_insert, t0.tx_descricao, t0.vc_destaque, t0.vl_estoque, t0.vc_nome, > t0.vl_preco, t1.id, t1.db, t1.dt_insert, t1.vc_nome, t2.id, t2.db, > t2.dt_insert, t2.vc_nome, t0.it_ano, t0.it_edicao, t3.id, t3.db, > t3.dt_insert, t3.vc_logo, t3.vc_nome, t3.vc_site, t0.vc_isbn, t0.it_paginas > FROM produto t0 LEFT OUTER JOIN secao t1 ON t0.pai = t1.id LEFT OUTER JOIN > editora t3 ON t0.editora = t3.id LEFT OUTER JOIN secao t2 ON t1.pai = t2.id > WHERE t0.DTYPE = ? [params=(String) Livro] > > if i put the hint "ONE, TWO" the program return this message > 1296 PersistenceUnit.ONE TRACE [main] openjpa.jdbc.SQL - 6666040> executing prepstmnt 15021407 SELECT t0.id, t0.DTYPE, t0.db, > t0.dt_insert, t0.tx_descricao, t0.vc_destaque, t0.vl_estoque, t0.vc_nome, > t0.vl_preco, t1.id, t1.db, t1.dt_insert, t1.vc_nome, t2.id, t2.db, > t2.dt_insert, t2.vc_nome, t0.it_ano, t0.it_edicao, t3.id, t3.db, > t3.dt_insert, t3.vc_logo, t3.vc_nome, t3.vc_site, t0.vc_isbn, t0.it_paginas > FROM produto t0 LEFT OUTER JOIN secao t1 ON t0.pai = t1.id LEFT OUTER JOIN > editora t3 ON t0.editora = t3.id LEFT OUTER JOIN secao t2 ON t1.pai = t2.id > WHERE t0.DTYPE = ? [params=(String) Livro] > 1298 PersistenceUnit.ONE TRACE [main] openjpa.jdbc.SQL - 6666040> [1 ms] spent > 1067 PersistenceUnit.TWO TRACE [main] openjpa.jdbc.SQL - 2889719> executing prepstmnt 28220074 SELECT t0.id, t0.DTYPE, t0.db, > t0.dt_insert, t0.tx_descricao, t0.vc_destaque, t0.vl_estoque, t0.vc_nome, > t0.vl_preco, t1.id, t1.db, t1.dt_insert, t1.vc_nome, t2.id, t2.db, > t2.dt_insert, t2.vc_nome, t0.it_ano, t0.it_edicao, t3.id, t3.db, > t3.dt_insert, t3.vc_logo, t3.vc_nome, t3.vc_site, t0.vc_isbn, t0.it_paginas > FROM produto t0 LEFT OUTER JOIN secao t1 ON t0.pai = t1.id LEFT OUTER JOIN > editora t3 ON t0.editora = t3.id LEFT OUTER JOIN secao t2 ON t1.pai = t2.id > WHERE t0.DTYPE = ? [params=(String) Livro] > 1069 PersistenceUnit.TWO TRACE [main] openjpa.jdbc.SQL - 2889719> [1 ms] spent > > > So i don't understand what's happening... my XML it's here: > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > transaction-type="RESOURCE_LOCAL"> > > org.apache.openjpa.persistence.PersistenceProviderImpl > br.unicsul.model.Global > br.unicsul.model.Produto > br.unicsul.model.Livro > br.unicsul.model.Editora > br.unicsul.model.Autor > br.unicsul.model.Secao > br.unicsul.model.Cliente > br.unicsul.model.Pedido > br.unicsul.model.PedidoItem > > > > > > value="br.unicsul.sistema.DistributionRules"/> > > > value="jdbc:sqlserver://TANANIAS-D\SQLEXPRESS;database=cadastro;user=sa;password=testando123"/> > value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> > > > value="jdbc:sqlserver://TANANIAS-D\SQLEXPRESS;database=cadastro;user=sa;password=testando123"/> > value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> > > > value="jdbc:mysql://localhost:3306/cadastro"/> > value="com.mysql.jdbc.Driver"/> > > > > > > > > > > > > > > > > > Thanks for the help! > > Regards > > Thiago Ananias > > > > > > > > > Pinaki Poddar wrote: >> Hi, >> I have verified hints against OpenJPA test bucket [1] and I do not see >> any error. >> org.apache.openjpa.slice.TestQuery.java#testHint(). >> >> May be you can post a small test with the persistence.xml? >> >> >> >> thiago ananias wrote: >>> >>> >>> Pinaki Poddar wrote: >>>> Hi, >>>>> I put the Slice "ONE", but when i remove the "hint" clause the result >>>>> comes for me, but i know that at >>>>> least one result have to return in this query, i don't know what i'am >>>>> doing wrong... >>>> Your question is not clear to me. >>>> 1. Please explain further >>>> 2. Examine the generated SQL. Each executed SQL is logged with the >>>> slice name it has been executed on. When you query with or without the >>>> hint -- what SQLs do you see? On which slices are these SQLs being >>>> executed? >>>> >>>> >>> OK, let explain the problem! >>> >>> I'm making a targered query >>> Query query = em.createQuery("SELECT c FROM Cliente c WHERE >>> c.email = :email AND c.senha = :senha"); >>> query.setParameter("email", email); >>> query.setParameter("senha", senha); >>> query.setHint("openjpa.hint.slice.Target", "TWO"); >>> >>> With this query i want the results of the Slice named "TWO" but the SQL >>> log sent this for me: >>> >>> "2078 PersistenceUnit.ONE TRACE [http-8084-1] openjpa.jdbc.SQL - >> 21111684, conn 11387974> executing prepstmnt 2867588 SELECT t0.id, t0.db, >>> t0.dt_insert, t0.vc_bairro, t0.vc_cep, t0.vc_cidade, t0.vc_complemento, >>> t0.dt_nascimento, t0.vc_email, t0.vc_endereco, t0.vc_estado, t0.vc_nome, >>> t0.vc_numero, t0.vc_rg, t0.vc_senha, t0.vc_sexo, t0.vc_telefone FROM >>> cliente t0 WHERE (t0.vc_email = ? AND t0.vc_senha = ?) [params=(String) >>> thiagoananias@hotmail.com, (String) 010203]" >>> >>> I put Slice two in the query but it returns for me the slice one...what >>> i'm doing wrong? >>> >>> Regards >>> >>> Thiago Ananias >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >