Hi,
The "database" JoinSyntax is reserved for database-specific syntax;
for example, Oracle's old '+' outer join syntax. It's largely obsolete
in modern databases, and is by definition not something that
DBDictionary knows how to implement, since DBDictionary is
generic-SQL.
I guess a case could be made for making "database" default to the same
behavior as "sql92".
-Patrick
On Tue, Mar 4, 2008 at 3:57 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi everybody,
> I was trying to retrieve an object along with one of its many-to-one
> relation eagerly from the datastore.
> Using a "database" JoinSyntax I always got the following exception:
>
> org.apache.openjpa.persistence.PersistenceException: null
> 23:46:40,808 ERROR [STDERR] at
> org
> .apache.openjpa.jdbc.sql.DBDictionary.toNativeJoin(DBDictionary.java:
> 2172)
> 23:46:40,808 ERROR [STDERR] at
> org.apache.openjpa.jdbc.sql.SelectImpl.append(SelectImpl.java:1702)
> 23:46:40,808 ERROR [STDERR] at
> org.apache.openjpa.jdbc.sql.DBDictionary.getWhere(DBDictionary.java:
> 2061)
> 23:46:40,809 ERROR [STDERR] at
> org.apache.openjpa.jdbc.sql.DBDictionary.toSelect(DBDictionary.java:
> 2000)
> 23:46:40,809 ERROR [STDERR] at
> org.apache.openjpa.jdbc.sql.SelectImpl.toSelect(SelectImpl.java:213)
> 23:46:40,809 ERROR [STDERR] at
> org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:344)
> 23:46:40,809 ERROR [STDERR] at
> org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:318)
> 23:46:40,809 ERROR [STDERR] at
> org
> .apache
> .openjpa
> .jdbc
> .kernel
> .SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
> 23:46:40,809 ERROR [STDERR] at
> org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:
> 34)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1223)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:842)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:773)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:
> 525)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:237)
> 23:46:40,810 ERROR [STDERR] at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:
> 277)
>
> which is due to the missing implementation of the
> org.apache.openjpa.jdbc.sql.DBDictionary.toNativeJoin(Join join)
> method. Here is it taken from the OpenJAP 1.0.2 sources:
>
> /**
> * Use the given join instance to create SQL joining its tables in
> * the database's native syntax. Throws an exception by default.
> */
> public SQLBuffer toNativeJoin(Join join) {
> throw new UnsupportedException();
> }
>
> After having discovered this I have changed my JoinSyntax setting from
> "database" to "sql92" and everything went fine.
> Could anyone please explain me why?
>
> Note: I'm using OpenJPA 1.0.2 along with MySQL 5.0.51a.
>
> Any help is appreciated.
>
> Best regards,
> Francesco
>
--
Patrick Linskey
202 669 5907