You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by sw...@comcast.net on 2008/12/01 01:49:57 UTC
Re: schemaName not valued with MySQL
Never mind.... I found this -> http://issues.apache.org/jira/browse/OPENJPA-592.
They fixed it the same way I did (except they used the colMeta.getString("TABLE_CAT") to get the schema whereas I hard-coded it). I've incorporated this patch for now. Will monitor for when the fix gets into a release.
Ken
-------------- Original message ----------------------
From: swanson198@comcast.net
>
> Hi,
>
> I have a small application which uses JPA and MS SQL Server. It works on that
> platform but I am having a problem when using MySQL for the database. I get an
> error trying to resolve metadata. I stepped thru the JPA code and found out
> that the problem occurs because the schemaName is not being returned from the
> SHOW FULL COLUMNS which is called to get all the columns for the table. When
> the new Column object is created - it has no shemaName. JPA wants to use this
> schemaName for hashmaps for schemaGroups, etc. Later, when it tries to resolve
> each table/column with the correct schema name (which I guess it is getting from
> orm.xml) it can�t find it. I get an error saying the table does not exist (even
> though it was clearly accessing the table and it�s columns from the database).
>
> I was able to work around this by sub-classing MySQLDictionary and overriding
> the newColumn(ResultSet meta) method. I invoke super.newColumn(meta) and if the
> column returned doesn�t have a schemaName (which it never does), then I
> hard-code my value. Obviously this shouldn�t be necessary and I must not have
> something configured correctly � but it seems I should have a better error
> message. Is this a JPA bug?
>
> I am using the following properties :
>
> <property name="openjpa.Optimistic" value="true" />
> <property name="openjpa.NontransactionalRead" value="true" />
> <property name="openjpa.NontransactionalWrite" value="false" />
> <!--property name="openjpa.jdbc.DBDictionary"
> value="org.apache.openjpa.jdbc.sql.MySQLDictionary" /-->
> <property name="openjpa.jdbc.DBDictionary"
> value="com.siemens.soarian.eld.entity.KensMySQLDictionary" />
> <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/eld"
> />
> <property name="openjpa.ConnectionUserName" value="Smsapps" />
> <property name="openjpa.ConnectionPassword" value="Smspass1!" />
> <property name="openjpa.ConnectionDriverName"
> value="com.mysql.jdbc.Driver" />
> <property name="openjpa.ConnectionProperties"
> value="sendStringParametersAsUnicode=false,InsensitiveResultSetBufferSize=-1,Que
> ryTimeout=10" />
> <property name="openjpa.ConnectionFactoryProperties"
> value="PrettyPrint=true, PrettyPrintLineLength=72, QueryTimeout=10,
> TrackParameters=true, WarningAction=none, MaxCachedStatements=0" />
> <property name="openjpa.ConnectionFactoryMode" value="local" />
> <property name="openjpa.ConnectionRetainMode" value="transaction" />
> <property name="openjpa.DataCache" value="false" />
> <property name="openjpa.QueryCache" value="false" />
> <property name="openjpa.RemoteCommitProvider" value="sjvm" />
> <property name="openjpa.FlushBeforeQueries" value="true" />
> <property name="openjpa.IgnoreChanges" value="true" />
> <property name="openjpa.RetainState" value="true" />
> <property name="openjpa.RestoreState" value="true" />
> <property name="openjpa.jdbc.SubclassFetchMode" value="join" />
> <!-- Need to check this next one - OpenJPA does not define any values
> yet -->
> <property name="openjpa.Compatibility"
> value="ValidateFalseReturnsHollow=false,ValidateTrueChecksStore=true" />
> <property name="openjpa.jdbc.SchemaFactory"
> value="native(ForeignKeys=true)" />
> <property name="openjpa.jdbc.Schema" value="dbo"/>
> <property name="openjpa.TransactionMode" value="managed" />
> <property name="openjpa.ManagedRuntime"
>
> value="invocation(TransactionManagerMethod=com.siemens.soarian.se.soa.server.EMF
> TestHelper.getTransactionManager)" />
> <property name="openjpa.Log" value="DefaultLevel=TRACE, SQL=TRACE,
> Runtime=TRACE, Query=TRACE, MetaData=TRACE, Tool=INFO" />
>
>
> Ken Swanson
>
> Swanson198@comcast.net
> kenneth.swanson@siemens.com
>
>