openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sherry Shen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-94) Allow MappingTool and persistence.xml to support drop-create for database schema
Date Tue, 27 Feb 2007 20:33:05 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476367
] 

Sherry Shen commented on OPENJPA-94:
------------------------------------

        <property name="openjpa.jdbc.SynchronizeMappings"
              value="buildSchema(SchemaAction='add,deleteTableContents')"/>
This one works.
However, it doesn't work if deleteTableContents is replaced with delete-table-contents.
I observed the error, 
  Exception in thread "main" <0|false|0.9.7-incubating-SNAPSHOT>
  org.apache.openjpa.persistence.PersistenceException: 
        action == delete-table-contents
        at org.apache.openjpa.kernel.AbstractBrokerFactory.
            newBroker(AbstractBrokerFactory.java:190)
        at org.apache.openjpa.kernel.DelegatingBrokerFactory.
            newBroker(DelegatingBrokerFactory.java:139)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.
             createEntityManager(EntityManagerFactoryImpl.java:187)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.
             createEntityManager(EntityManagerFactoryImpl.java:140)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.
            createEntityManager(EntityManagerFactoryImpl.java:52)
        at TestClient.main(TestClient.java:13)
      Caused by: java.lang.IllegalArgumentException: action == delete-table-contents

I also tried the other suggestion.
        <property name="openjpa.jdbc.SynchronizeMappings"
                      value="buildSchema(SchemaAction=\\\"add,delete-table-contents\\\")"/>
The test with \\\" has  SAXParseException similar to the test with \".

You may use my test in the attachemnt of this issue to try which one works.

It is better to document the usage with examples.


> Allow MappingTool and persistence.xml to support drop-create for database schema
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-94
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-94
>             Project: OpenJPA
>          Issue Type: New Feature
>            Reporter: Shay Banon
>         Attachments: openjpa_94.zip
>
>
> Currently, in the persistence context, one can define:
> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
> Which causes OpenJPA to build the database schema based on the mapping defined. Currently,
there is no way to define it to drop tables if they exists before creating the database schema.
This is very useful for tests that drop (if exists) and creates new tables for each test.

-- 
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