openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srikanth Routhu <srou...@gmail.com>
Subject ReverseMapping Tool
Date Thu, 06 Mar 2014 19:38:02 GMT
Hi,
  I am new to OpenJPA and trying to generate java entity class based on
schema.xml. Java file is generated but couldn't get annotation,
@GeneratedValue for column "Id".

Any help is greatly appreciated.

*script.sh:*

#!/bin/sh

cd "$(dirname "$0")"

rm -rf ./jpa/reversemapping/*.java

rm -rf ./orm.xml

java -cp
lib/*:.:openjpa-2.2.2.jar:hsqldb.jar:mysql-connector-java-3.1.14-bin.jar \

-Dopenjpa.Log=commons \

-Dopenjpa.ConnectionDriverName=org.hsqldb.jdbc.JDBCDriver \

-Dopenjpa.ConnectionURL=jdbc:hsqldb:mem:com.good.server.db \

-Dopenjpa.ConnectionUserName=sa  -Dopenjpa.ConnectionPassword=sa \

org.apache.openjpa.jdbc.meta.ReverseMappingTool -annotations true
-useGenericCollections true -nullableAsObject true -d jpa -pkg
reversemapping -p src/main/resources/META-INF/persistence.xml
src/main/resources/META-INF/schema.xml


*schema.xml:*

<?xml version="1.0" encoding="UTF-8"?>

<schemas>

    <schema>

        <table name="BuildSchemaPC">

            <pk column="id"/>

            <column name="id" type="integer" auto-assign="true" not-null=
"true"/>

            <column name="chain" type="varchar" size="50"/>

        </table>

    </schema>

</schemas>

*persistence.xml:*

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

    version="1.0">

    <persistence-unit name="reversemapping" transaction-type=
"RESOURCE_LOCAL">

<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
=jdbc/server-ds)</jta-data-source>

     <class>reversemapping.BuildSchemaPC</class>

<exclude-unlisted-classes>true</exclude-unlisted-classes>

        <properties>

            <property name="openjpa.jdbc.SynchronizeMappings" value=
"buildSchema(ForeignKeys=true)"/>

            <property name="openjpa.jdbc.DBDictionary" value="hsql"/>

        </properties>

    </persistence-unit>

   </persistence>

Thanks
Srikanth

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message