openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phani Madgula" <phanibalaji.madg...@gmail.com>
Subject Fwd: Generate Script SQL Script files.
Date Tue, 16 Dec 2008 05:28:14 GMT
Forwaring this mail to dev list.

Thanks in advance.
Phani


---------- Forwarded message ----------
From: Phani Madgula <phanibalaji.madgula@gmail.com>
Date: Wed, 10 Dec 2008 15:27:28 +0530
Subject: Generate Script SQL Script files.
To: users@openjpa.apache.org

Hi,
I have the following persistence.xml file.
***************
<?xml version="1.0" encoding="UTF-8" ?>
- <persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">

- <persistence-unit name="Tutorial" transaction-type="JTA">
  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
  <non-jta-data-source>ProductDS</non-jta-data-source>

  <class>samples.jpa.Product</class>
  <class>samples.jpa.Book</class>

- <properties>

  <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(SchemaAction='add,deleteTableContents',ForeignKeys=true,sqlFile=./logs/jpaSQL.log)"
/>

  <property name="openjpa.Log"
value="DefaultLevel=INFO,SQL=TRACE,File=./logs/jpaEnhancerLog.log,Runtime=INFO,Tool=INFO"
/>

  </properties>

  </persistence-unit>
  </persistence>
**********************

I wanted JPA to generate SQL scripts for entities in my WAR file into
"/logs/jpaSQL.log" file as configured above during runtime.

When I used "sqlFile=./logs/jpaSQL.log", it threw an exception as below.

********************
.servlet.ServletException: <openjpa-1.0.2-r420667:627158 nonfatal
general error> org.apache.openjpa.persistence.PersistenceException:
There was an error while setting up the configuration plugin option
"SynchronizeMappings". The plugin was of type
"org.apache.openjpa.jdbc.meta.MappingTool". Setter methods for the
following plugin properties were not available in that type:
[sqlFile]. Possible plugin properties are: [ACTIONS, ACTION_ADD,
ACTION_BUILD_SCHEMA, ACTION_DROP, ACTION_EXPORT, ACTION_IMPORT,
ACTION_REFRESH, ACTION_VALIDATE, DropUnusedComponents, ForeignKeys,
IgnoreErrors, Indexes, MODE_ANN_MAPPING, MODE_MAPPING,
MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY, MappingWriter,
MetaDataFile, PrimaryKeys, ReadSchema, Repository, SCHEMA_ACTION_NONE,
SchemaAction, SchemaGroup, SchemaTool, SchemaWriter, Sequences].
Ensure that your plugin configuration string uses key values that
correspond to setter methods in the plugin class.
	samples.jpa.Test.doGet(Test.java:63)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
*************************

Looks like "sqlFile" is not a valid option for "buildSchema" action.
Currenty I am working around this problem by generating SQL scripts in
"/logs/jpaEnhancerLog and manually copying the SQL statements.

Questions??

How do I generate SQL script files into a seperate file?? WHat
configurations are required for forward mapping in a runtime
environment??

Thanks in advance.
Phani

Mime
View raw message