We are attempting to determine whether or not a named query from a parent project will use the default connection of the parent project or the default project, but found that if the named query’s connection is set to < Default >, it won’t even use the current project’s default database connection. Instead, we see:
java.lang.IllegalArgumentException: Cannot find database connection - name cannot be null.
Might the child project’s named queries (defined in the child project) when set to < Default > actually depend on the parent project’s default database (which we set to < None > for test purposes) instead of their own project’s default connection?
Detail:
[Parent_Project]
- Default connection < None >
- Named query “NQ1”
- Connection < Default >
- Named query “NQ2”
- Connection “Parent DB Connection”
[Child_Project]
- Default connection “Child DB Connection”
- Named query “NQ3”
- Connection < Default >
- Named query “NQ4”
- Connection “Child DB Connection”
When running the child project, we would expect:
NQ1 to fail on no defined connection or to succeed on “Child DB Connection” (The purpose of the test was to determine this behavior)
NQ2 to succeed on “Parent DB Connection”
NQ3 to succeed on “Child DB Connection” (This failed unexpectedly)
NQ4 to succeed on “Child DB Connection”