Hey Bryan,

Thanks for the tip. From the derby.log that got created I can see that the 
following is logged:

2010-05-26 04:23:06.228 GMT Thread[http-8080-1,5,main] (XID = 313), (SESSIONID 
= 4), (DATABASE = RegistryDB), (DRDAID = null), Committing
2010-05-26 04:23:06.229 GMT Thread[http-8080-1,5,main] (XID = 313), (SESSIONID 
= 4), (DATABASE = RegistryDB), (DRDAID = null), Rolling back
2010-05-26 04:23:06.229 GMT Thread[http-8080-1,5,main] (XID = 314), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), Committing
2010-05-26 04:23:06.229 GMT Thread[http-8080-1,5,main] (XID = 314), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), Committing
2010-05-26 04:23:06.394 GMT Thread[http-8080-1,5,main] (XID = 315), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), Begin compiling prepared 
statement: select product0_.guid as guid1_, product0_.home as home1_, 
product0_.description as descript3_1_, product0_.lid as lid1_, product0_.name 
as name1_, product0_.objectType as objectType1_, product0_.status as status1_, 
product0_.userVersion as userVers8_1_, product0_.version as version1_, 
product0_.contentVersion as content10_1_, product0_.mimeType as mimeType1_ from 
Product product0_ where product0_.lid=? and product0_.userVersion=? fetch first 
2 rows only :End prepared statement
2010-05-26 04:23:06.412 GMT Thread[http-8080-1,5,main] (XID = 315), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), End compiling prepared 
statement: select product0_.guid as guid1_, product0_.home as home1_, 
product0_.description as descript3_1_, product0_.lid as lid1_, product0_.name 
as name1_, product0_.objectType as objectType1_, product0_.status as status1_, 
product0_.userVersion as userVers8_1_, product0_.version as version1_, 
product0_.contentVersion as content10_1_, product0_.mimeType as mimeType1_ from 
Product product0_ where product0_.lid=? and product0_.userVersion=? fetch first 
2 rows only :End prepared statement
2010-05-26 04:23:06.424 GMT Thread[http-8080-1,5,main] (XID = 315), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), Rolling back
2010-05-26 04:23:06.424 GMT Thread[http-8080-1,5,main] (XID = 315), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), Committing
2010-05-26 04:23:06.425 GMT Thread[http-8080-1,5,main] (XID = 315), (SESSIONID 
= 5), (DATABASE = RegistryDB), (DRDAID = null), Rolling back


This is query generated from:

@Transactional(readOnly = true)
public Product getProduct(String lid, String userVersion) {
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Product> cq = cb.createQuery(Product.class);
Root<Product> productEntity = cq.from(Product.class);
Path<String> lidAttr = productEntity.get("lid");
Path<String> userVersionAttr = productEntity.get("userVersion");
cq.where(cb.and(cb.equal(lidAttr, lid), cb.equal(userVersionAttr, 
userVersion)));
TypedQuery<Product> query = entityManager.createQuery(cq);
Product product = query.getSingleResult();
return product;
}

I used a NamedQuery before that generated essentially the same thing and ended 
up with the same error. It should only be setting 2 parameters but it looks the 
query is never executed but rather just throwing an exception before getting 
executed. In addition, it seems as though its trying to build the query twice 
even though there is only one call to the code. Any thoughts?

Thanks,
Paul

On May 25, 2010, at 7:31 PM, Bryan Pendleton wrote:


Now, to figure out what statement you are running, you can try running your
application with

  -Dderby.language.logStatementText=true

Then after running your application you should have a file named 'derby.log'
with a detailed description of each SQL statement that is issued, and the
error message (if any) that accompanies it.

thanks,

bryan

Reply via email to