سؤال

JPA gurus, let say I have the following entity :

@Entity
class MyEntity {
    @Id
    private Long id;

    // setters and getters here
}

through JPA on an Oracle database something similar would be generated :

CREATE TABLE MyEntity {
    -- table definition generated by JPA provider goes here
}

How can I get the code generated by the JPA provider ?

If it's not possible to get the sql code in a standard way defined by JPA, how can I achieve this with Hibernate 3.6.8.Final or greater ?

هل كانت مفيدة؟

المحلول

Look at classes in hbm2ddl package

http://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/tool/hbm2ddl/package-summary.html

Especially SchemaExport class.

نصائح أخرى

  <property name="show_sql">true</property>

In hibernate config

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top