You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2010/07/26 23:20:40 UTC
svn commit: r979447 - in /openjpa/trunk/openjpa-tools: ./
src/main/resources/META-INF/ src/test/ src/test/java/ src/test/java/org/
src/test/java/org/apache/ src/test/java/org/apache/openjpa/
src/test/java/org/apache/openjpa/tools/ src/test/resources/
Author: ppoddar
Date: Mon Jul 26 21:20:39 2010
New Revision: 979447
URL: http://svn.apache.org/viewvc?rev=979447&view=rev
Log:
OPENJPA-1745: Test cases + modified pom.xml with reduced dependency and parent-less build
Added:
openjpa/trunk/openjpa-tools/src/test/
openjpa/trunk/openjpa-tools/src/test/java/
openjpa/trunk/openjpa-tools/src/test/java/org/
openjpa/trunk/openjpa-tools/src/test/java/org/apache/
openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/
openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/
openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/SchemaErrorDetector.java (with props)
openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigratedOutput.java (with props)
openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigrationSchema.java (with props)
openjpa/trunk/openjpa-tools/src/test/resources/
openjpa/trunk/openjpa-tools/src/test/resources/invalid-migration-actions.xml (with props)
openjpa/trunk/openjpa-tools/src/test/resources/sample.hbm.xml (with props)
Modified:
openjpa/trunk/openjpa-tools/pom.xml
openjpa/trunk/openjpa-tools/src/main/resources/META-INF/migration-actions.xml
Modified: openjpa/trunk/openjpa-tools/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/pom.xml?rev=979447&r1=979446&r2=979447&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/pom.xml (original)
+++ openjpa/trunk/openjpa-tools/pom.xml Mon Jul 26 21:20:39 2010
@@ -1,70 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!--
- Maven release plugin requires the project tag to be on a single line.
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <!--
+ Please keep the project tag on one line to avoid confusing the release
+ plugin.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
- <modelVersion>4.0.0</modelVersion>
+ <version>0.1.0-SNAPSHOT</version>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-tools</artifactId>
+ <packaging>jar</packaging>
- <parent>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-parent</artifactId>
- <version>2.1.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-tools</artifactId>
- <packaging>jar</packaging>
- <name>OpenJPA Tools</name>
- <description>OpenJPA Tools</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-lib</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-tests</id>
- <phase>verify</phase>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <name>OpenJPA Tools</name>
+ <description>OpenJPA Tools</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
+
Modified: openjpa/trunk/openjpa-tools/src/main/resources/META-INF/migration-actions.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/src/main/resources/META-INF/migration-actions.xml?rev=979447&r1=979446&r2=979447&view=diff
==============================================================================
--- openjpa/trunk/openjpa-tools/src/main/resources/META-INF/migration-actions.xml (original)
+++ openjpa/trunk/openjpa-tools/src/main/resources/META-INF/migration-actions.xml Mon Jul 26 21:20:39 2010
@@ -24,7 +24,8 @@
changed to an equivalent element in JPA Mapping file.
====================================================================== -->
-<migration-actions>
+<migration-actions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation='META-INF/migration-actions.xsd'>
<actions for="hibernate-mapping">
<rename-node to="entity-mappings"/>
Added: openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/SchemaErrorDetector.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/SchemaErrorDetector.java?rev=979447&view=auto
==============================================================================
--- openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/SchemaErrorDetector.java (added)
+++ openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/SchemaErrorDetector.java Mon Jul 26 21:20:39 2010
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.tools;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A SAX Default Handler to catch any errors during parsing.
+ *
+ * @author Pinaki Poddar
+ *
+ */
+public class SchemaErrorDetector extends DefaultHandler {
+ private boolean _expectingError;
+ private List<String> errors = new ArrayList<String>();
+ private Locator _locator;
+ private String _source;
+
+
+ SchemaErrorDetector(String source, boolean expectingError) {
+ _source = source;
+ _expectingError = expectingError;
+ }
+
+ @Override
+ public void setDocumentLocator(Locator locator) {
+ _locator = locator;
+ }
+
+ @Override
+ public void error(SAXParseException exception) throws SAXException {
+ handleError(exception);
+ }
+
+ @Override
+ public void fatalError(SAXParseException exception) throws SAXException {
+ handleError(exception);
+ }
+
+ @Override
+ public void warning(SAXParseException exception) throws SAXException {
+ handleError(exception);
+ }
+
+ private void handleError(SAXParseException exception) {
+ String msg = _source + ":" + _locator.getLineNumber() + ":" + exception.getMessage();
+ if (_expectingError) {
+ System.err.println("The following is an expected error:");
+ }
+ System.err.println(msg);
+
+ errors.add(msg);
+ if (!_expectingError)
+ exception.printStackTrace();
+
+ }
+
+ boolean hasErrors() {
+ return !errors.isEmpty();
+ }
+
+ void print() {
+ for (String s : errors) {
+ System.err.println(s);
+ }
+ }
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ for (String s : errors) {
+ buf.append(s).append("\r\n");
+ }
+ return buf.toString();
+ }
+}
+
Propchange: openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/SchemaErrorDetector.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigratedOutput.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigratedOutput.java?rev=979447&view=auto
==============================================================================
--- openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigratedOutput.java (added)
+++ openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigratedOutput.java Mon Jul 26 21:20:39 2010
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.tools;
+
+import java.io.InputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import junit.framework.TestCase;
+
+public class TestMigratedOutput extends TestCase {
+ static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
+ static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String ORM_XSD = "META-INF/orm_2_0-xsd.rsrc";
+
+
+ SAXParser builder;
+ InputStream xsd;
+
+ public void setUp() throws Exception {
+ xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream(ORM_XSD);
+ assertNotNull(ORM_XSD + " not found", xsd);
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setValidating(true);
+ factory.setNamespaceAware(true);
+
+ builder = factory.newSAXParser();
+
+ builder.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
+ builder.setProperty(JAXP_SCHEMA_SOURCE, xsd);
+ }
+
+ public void tearDown() throws Exception {
+ xsd.close();
+ }
+
+
+ public void testSampleIsJPACompliant() {
+ migrateAndValidate("sample");
+ }
+
+ void migrateAndValidate(String type) {
+ String outDir = "target/test-classes/";
+ String input = type + ".hbm.xml";
+ String output = type + ".orm.xml";
+ String[] args = {"-i", input, "-o", outDir + output};
+ SchemaErrorDetector parserError = new SchemaErrorDetector(output, false);
+ try {
+ new MigrationTool().run(args);
+ InputStream generated = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(output);
+ assertNotNull(generated);
+ builder.parse(generated, parserError);
+ assertTrue(parserError.toString(), !parserError.hasErrors());
+ } catch (Exception e) {
+ parserError.print();
+ e.printStackTrace();
+ fail(e.toString());
+ }
+ }
+
+
+}
Propchange: openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigratedOutput.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigrationSchema.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigrationSchema.java?rev=979447&view=auto
==============================================================================
--- openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigrationSchema.java (added)
+++ openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigrationSchema.java Mon Jul 26 21:20:39 2010
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.tools;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.SAXException;
+
+import junit.framework.TestCase;
+
+/**
+ * Verifies the XML schema for the migration actions can distinguish between
+ * valid and invalid document.
+ *
+ * @author Pinaki Poddar
+ *
+ */
+public class TestMigrationSchema extends TestCase {
+ static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
+ static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String ACTIONS_XSD = "META-INF/migration-actions.xsd";
+
+ SAXParser parser;
+ InputStream xsd;
+
+ public void setUp() throws Exception {
+ if (parser == null) {
+ xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream(ACTIONS_XSD);
+ assertNotNull(ACTIONS_XSD + " not found", xsd);
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setValidating(true);
+ factory.setNamespaceAware(true);
+
+ parser = factory.newSAXParser();
+
+ parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
+ parser.setProperty(JAXP_SCHEMA_SOURCE, xsd);
+ }
+
+ }
+
+ public void testValidDocument() {
+ String input = "META-INF/migration-actions.xml";
+ InputStream is = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(input);
+ assertNotNull(input + " not found in classpath", is);
+ try {
+ SchemaErrorDetector detector = new SchemaErrorDetector(input, false);
+ parser.parse(is, detector);
+ assertTrue(detector.toString(), !detector.hasErrors());
+ } catch (SAXException e) {
+ e.printStackTrace();
+ fail();
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void testInvalidDocument() {
+ String input = "invalid-migration-actions.xml";
+ InputStream is = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(input);
+ assertNotNull(input + " not found in classpath", is);
+ try {
+ SchemaErrorDetector detector = new SchemaErrorDetector(input, true);
+ parser.parse(is, detector);
+ assertTrue(detector.hasErrors());
+ } catch (SAXException e) {
+ e.printStackTrace();
+ fail();
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+}
Propchange: openjpa/trunk/openjpa-tools/src/test/java/org/apache/openjpa/tools/TestMigrationSchema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openjpa/trunk/openjpa-tools/src/test/resources/invalid-migration-actions.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/src/test/resources/invalid-migration-actions.xml?rev=979447&view=auto
==============================================================================
--- openjpa/trunk/openjpa-tools/src/test/resources/invalid-migration-actions.xml (added)
+++ openjpa/trunk/openjpa-tools/src/test/resources/invalid-migration-actions.xml Mon Jul 26 21:20:39 2010
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+ <!-- =====================================================================
+ This XML file describes how each element in Hibernate mapping file is changed to
+ an equivalent element in JPA Mapping file.
+ ====================================================================== -->
+
+<migration-actions>
+
+<actions for="hibernate-mapping">
+ <rename to="entity-mappings"/>
+</actions>
+
+</migration-actions>
Propchange: openjpa/trunk/openjpa-tools/src/test/resources/invalid-migration-actions.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: openjpa/trunk/openjpa-tools/src/test/resources/sample.hbm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-tools/src/test/resources/sample.hbm.xml?rev=979447&view=auto
==============================================================================
--- openjpa/trunk/openjpa-tools/src/test/resources/sample.hbm.xml (added)
+++ openjpa/trunk/openjpa-tools/src/test/resources/sample.hbm.xml Mon Jul 26 21:20:39 2010
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping
+ default-cascade="none"
+ default-access="property"
+ default-lazy="true"
+ auto-import="true">
+
+ <class name="com.approuter.deploy.Project" table="PROJECTS"
+ mutable="true" polymorphism="implicit" dynamic-update="false"
+ dynamic-insert="false" select-before-update="false" optimistic-lock="version">
+ <cache usage="read-write" />
+ <id name="id" type="java.lang.Long" column="ID">
+ <generator class="native" />
+ </id>
+ <property name="envId" type="com.approuter.common.hibernate.GuidUserType"
+ length="64" unique-key="env_name_version">
+ <column name="ENV_ID" index="IDX_PROJECT_ENV" />
+ </property>
+ <property name="data" type="binary" column="DATA" length="20000000"
+ unique="false" optimistic-lock="true" lazy="true" generated="never" />
+ <property name="name" type="java.lang.String" column="NAME"
+ not-null="true" length="80" unique-key="env_name_version" unique="false"
+ optimistic-lock="true" lazy="false" generated="never" />
+ <property name="description" type="java.lang.String" column="DESCRIPTION"
+ length="2000" unique="false" optimistic-lock="true" lazy="false"
+ generated="never" />
+ <property name="version" type="java.lang.String" column="VERSION"
+ not-null="true" length="80" unique-key="env_name_version" unique="false"
+ optimistic-lock="true" lazy="false" generated="never" />
+ <property name="lastpublished"
+ type="com.approuter.common.hibernate.NumericTimestampType" column="LASTPUBLISHED"
+ not-null="false" length="26" unique="false" optimistic-lock="true"
+ lazy="false" generated="never" />
+ <property name="authToolVersion" type="java.lang.String"
+ column="AUTH_TOOL_VERSION" not-null="false" length="80" unique="false"
+ optimistic-lock="true" lazy="false" generated="never" />
+ <property name="depth" type="java.lang.Short">
+ <column name="DEPTH" default="0" />
+ </property>
+ <!-- Associations -->
+ <!-- bi-directional one-to-many association to Asset -->
+ <set name="assets" lazy="true" outer-join="true" inverse="true"
+ cascade="merge,all-delete-orphan" sort="unsorted" mutable="true"
+ optimistic-lock="true" embed-xml="true">
+ <cache usage="read-write" />
+ <key column="PROJECT_ID" on-delete="cascade" />
+ <one-to-many class="com.approuter.deploy.Asset"
+ not-found="exception" embed-xml="true" />
+ </set>
+ <!-- bi-directional one-to-many association to Orchestration -->
+ <set name="orchestrations" lazy="true" outer-join="true" inverse="true"
+ cascade="merge,all-delete-orphan" sort="unsorted" mutable="true"
+ optimistic-lock="true" embed-xml="true">
+ <cache usage="read-write" />
+ <key column="PROJECT_ID" on-delete="cascade" />
+ <one-to-many class="com.approuter.deploy.Orchestration"
+ not-found="exception" embed-xml="true" />
+ </set>
+ <!-- bi-directional one-to-many association to Property -->
+ <set name="properties" lazy="true" outer-join="true" inverse="true"
+ cascade="merge,all-delete-orphan" sort="unsorted" mutable="true"
+ optimistic-lock="true" embed-xml="true">
+ <cache usage="read-write" />
+ <key column="PROJECT_ID" on-delete="cascade" />
+ <one-to-many class="com.approuter.deploy.Property"
+ not-found="exception" embed-xml="true" />
+ </set>
+ <!-- bi-directional one-to-many association to Configuration -->
+ <set name="configurations" lazy="true" outer-join="true" inverse="true"
+ cascade="merge,all-delete-orphan" sort="unsorted" mutable="true"
+ optimistic-lock="true" embed-xml="true">
+ <cache usage="read-write" />
+ <key column="PROJECT_ID" on-delete="cascade" />
+ <one-to-many class="com.approuter.deploy.Configuration"
+ not-found="exception" embed-xml="true" />
+ </set>
+
+ <set name="subprojects" lazy="true" table="SUBPROJECTS">
+ <cache usage="read-write" />
+ <key column="PROJECT_ID" />
+ <many-to-many class="com.approuter.deploy.Project"
+ column="SUBPROJECT_ID" />
+ </set>
+ </class>
+
+ <class
+ name="com.approuter.deploy.Asset"
+ table="ASSETS"
+ >
+ <id
+ name="id"
+ type="java.lang.Long"
+ column="ID"
+ >
+ <generator class="native"/>
+ </id>
+ <property
+ name="baseobject"
+ type="java.lang.String"
+ column="BASEOBJECT"
+ not-null="true"
+ length="80"
+ />
+ <property
+ name="moduleid"
+ type="java.lang.String"
+ column="MODULEID"
+ not-null="true"
+ length="80"
+ />
+ <property
+ name="orchestration"
+ type="java.lang.String"
+ column="ORCHESTRATION"
+ length="80"
+ />
+
+ <!-- Associations -->
+
+ <!-- bi-directional many-to-one association to Project -->
+ <many-to-one
+ name="project"
+ class="com.approuter.deploy.Project"
+ not-null="true"
+ >
+ <column name="PROJECT_ID"/>
+ </many-to-one>
+
+ <!-- bi-directional one-to-many association to Property -->
+ <!--
+ <set
+ name="properties"
+ lazy="true"
+ outer-join="true"
+ inverse="true"
+ cascade="merge,all-delete-orphan"
+ >
+ <key column="ASSET_ID" on-delete="cascade"/>
+ <one-to-many class="com.approuter.deploy.Property"/>
+ </set>
+ -->
+ </class>
+
+ <class name="com.approuter.logging.Log" table="LOG">
+ <id name="id" column="ID" type="long"/>
+ <property name="host" type="string" length="64"/>
+ <property name="envId" type="com.approuter.common.hibernate.GuidUserType" length="64">
+ <column name="ENV_ID" index="IDX_LOG_ENV"/>
+ </property>
+ <property name="loggerName" column="LOGGER_NAME" type="string" length="255" not-null="true"/>
+ <property name="message" column="MESSAGE_KEY" type="string" length="1024" not-null="true"/>
+ <property name="jobId" column="JOB_ID" type="string" length="80"/>
+ <property name="notifiedValue" column="NOTIFIED" type="short"/>
+ <property name="timestamp" type="com.approuter.common.hibernate.NumericTimestampType">
+ <column name="TIME_STAMP" index="IDX_LOG_TIME_STAMP" not-null="true"/>
+ </property>
+ <property name="levelValue" type="short">
+ <column name="LEVEL" index="IDX_LOG_LEVEL" not-null="true"/>
+ </property>
+ <property name="orchestrationId" column="ORCH_ID" type="long"/>
+ <property name="resolvedOn" column="RESOLVED_ON" type="com.approuter.common.hibernate.NumericTimestampType"/>
+ <property name="resolvedBy" column="RESOLVED_BY" type="string" length="80"/>
+ <property name="parameters" column="PARAMS" type="binary" length="2048"/>
+ </class>
+
+</hibernate-mapping>
+
Propchange: openjpa/trunk/openjpa-tools/src/test/resources/sample.hbm.xml
------------------------------------------------------------------------------
svn:eol-style = native