createNamedQuery throws wrong exception

#1

Hello

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?

 

Thanks

#2

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

Please try build 2.3.7_25 that fixes it.

ObjectDB Support

Reply