ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Boisvert" <boisv...@intalio.com>
Subject Re: Hoe could I create table from JPA annotations
Date Thu, 06 Sep 2007 13:51:37 GMT
On 9/5/07, ShaoGuang Geng <shaoguanggeng@yahoo.com> wrote:
>
> I want to generate tables or schemas from JPA's annotation, but don't know
> how. Could some of you give me a clue?



You can use the OpenJPA schema tool [1] with the persistence descriptors
found under dao-jpa-ojpa-derby/src/main/descriptors.  To get a complete
schema for Ode, you'll have to merge the generated SQL with the
SimpleScheduler schema since it uses raw JDBC (see
dao-jpa-ojpa-derby/src/main/scripts).

This is essentially what the Rake build does (for each supported database):

    %w{ derby mysql oracle }.each do |db|
      db_xml = _("src/main/descriptors/persistence.#{db}.xml")
      scheduler_sql = _("src/main/scripts/simplesched-#{db}.sql")
      partial_sql = file("target/partial.#{db}.sql"=>db_xml) do |task|
        mkpath _("target"), :verbose=>false
        Buildr::OpenJPA.mapping_tool :properties=>db_xml, :action=>"build",
:sql=>task.name,
          :classpath=>projects("bpel-store", "dao-jpa", "bpel-api",
"bpel-dao", "utils" )
      end
      sql = concat(_("target/#{db}.sql")=>[_("src/main/scripts/license-
header.sql"), partial_sql, scheduler_sql])
      build sql
    end

alex

[1]
http://openjpa.apache.org/builds/1.0.0/apache-openjpa-1.0.0/docs/manual/ref_guide_schema_schematool.html

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