1

I'm looking for easy way to check inconsistency between entity and table for my JPA application.

After changing table definition (ex. column name, type, add new column, delete column), I sometimes forget to change entity definition.

So I'd like to be notified if entity and table definitions are inconsistent.

Is some tool available? Eclipse plugin is preferable, but others are also considerable.

I know Dali. But this tool does not suit for me because I should modify Dali output. (I'm using class inheritance as this question, and so on.)

Community
  • 1
  • 1
N.F.
  • 3,844
  • 3
  • 22
  • 53

1 Answers1

0

Your JPA implementation should provide a property on persistence.xml to make it for you. By example, Hibernate provides hibernate.hbm2ddl.auto property which allow to create the schema, update or just validate.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence ...>
<persistence-unit ...>
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <properties>
            <!-- ... -->
            <!-- ... -->
            <property name="hibernate.hbm2ddl.auto" value="validate"/>

This makes the schema validation process on EntityManager initialization.

Check on your current JPA implementation documentation to find the equivalent property.

Good luck!

jmvivo
  • 2,653
  • 1
  • 16
  • 20
  • Thanks for reply. I'm using EclipseLink. After some investigation, I found that EL does not have equivalent option, but have "Integrity Checker". I'll try it on monday and report the result. – N.F. Oct 03 '14 at 15:00