96 words

Query debugging configuration from class

2014-09-27 10:15

Is there a way to show what queries are actually being executed from within a Java class?

I'm getting the exception:

Exception in thread "main" [ObjectDB 2.5.4_05] javax.persistence.NonUniqueResultException

However, I'm unable to debug it because I don't know what the query's actually searching for. I would like to log (in the console or in a separate log file) what it's actually executing without setting it in xml but rather through Java if possible?

ThreaT's picture
Joined on 2014-02-19
User Post #29
2014-09-27 20:52

If you have the Query instance (e.g. in a catch clause), you should be able to use toString to obtain the query string.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support's picture
Joined on 2010-05-03
User Post #2,044

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB