سؤال

We want to change the JPA Provider EclipseLink and use Hibernate for the future. The problem is that I didn't find all property equivalents. So the following are missing:

<property name="eclipselink.ddl-generation.index-foreign-keys" value="true"/>

I didnt't find any Hibernate equivalent.

<property name="eclipselink.ddl-generation.output-mode" value="database"/>

I probably have to set:

hibernate.show_sql=true
hibernate.format_sql=true
هل كانت مفيدة؟

المحلول

As far as I know, there are no such things in Hibernate. But those properties are set by default in Hibernate as you have them in EclipseLink: Hibernate will always try to create the foreign keys (given you have a <property name="hibernate.hbm2ddl.auto" value="update"/> or create) and the output is redirected automatically to Database. If you are looking for a behavior like exporting to a file, you will have to code a bit (using the fields you mentioned).

نصائح أخرى

The last two Hibernate properties you mentioned are used to configure Hibernate log output.

As Andrei said, some stuff are already done automatically by Hibernate... but not always, it is dependent on the database dialect used.

However, DDL generation is one of the new feature in JPA 2.1 (see here). It could be worth having a look at it.

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