openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abe White (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-592) In MySQL explicitly specifying openjpa.jdbc.Schema with default schema gives an error on first time EM access if mapping is already done
Date Mon, 19 May 2008 15:57:58 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597985#action_12597985
] 

Abe White commented on OPENJPA-592:
-----------------------------------

Jason, will you be submitting a new patch that fixes the issue in the Informix way?  And if
this is only a problem for certain MySQL drivers, we should make sure to only change the behavior
by default for drivers we know exhibit the problem.

> In MySQL explicitly specifying openjpa.jdbc.Schema with default schema gives an error
on first time EM access if mapping is already done
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-592
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-592
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>            Reporter: Jason Zheng
>         Attachments: patch-592.txt
>
>
> Suppose we have an entity "Employee" and we have the following properties specified in
persistence.xml:
> <property name='openjpa.jdbc.SynchronizeMappings'  value='buildSchema(ForeignKeys=true)'
/>
> <property name='openjpa.jdbc.Schema' value='jpa' />
> OpenJPA  should create table "jpa:employee" if it does not exist in the database, and
do nothing if the table already exists.
> But in MySQL, it tries to create the table when the table already exists in database,
and we will get the following exception because of this:
> <openjpa-1.1.0-SNAPSHOT-r422266:647033 nonfatal general error> 
> org.apache.openjpa.persistence.PersistenceException: Table 'employee' already exists
{stmnt 7294825 CREATE TABLE jpa.employee (id BIGINT NOT NULL, PRIMARY KEY (id)) TYPE = innodb}
[code=1050, state=42S01]
> at  org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:553)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:453)
> at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:159)
> ...
> This is because MySQL doesn't have concept of schema, and the column metadata from MySQL
doesn't contain schema information. Hence OpenJPA fails to find the table although the table
exists in database.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message