139 words

createNamedQuery throws wrong exception

2012-05-09 15:02


I'm tying to use ObjecDB with spring-data for JPA and there is an issue where spring-data checks for existance of named query which does not exist yet.

Based on JPA specification

     * Create an instance of <code>Query</code> for executing a named query
     * (in the Java Persistence query language or in native SQL).
     * @param name the name of a query defined in metadata
     * @return the new query instance
     * @throws IllegalArgumentException if a query has not been
     *         defined with the given name or if the query string is
     *         found to be invalid
    public Query createNamedQuery(String name);

however ObjectDB throws javax.persistence.PersistenceException instead of IllegalArgumentException which cause spring-data to not work properly.

Is there any know workaround?



mzachar's picture
Joined on 2012-05-09
User Post #1
2012-05-09 18:18

You are right, an IllegalArgumentException should be thrown in this case.

Please try build 2.3.7_25 that fixes it.

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

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