Question

Dali has proven useful for design time JPA annotation validation against an installed database, using a data connection configured in Eclipse. We use this to provide a level of "type safety" to ensure the text strings in the JPA annotations actually correspond to fields in the referenced tables, etc. In our environment, the database schema is developed dis-jointly from the JPA Entity classes, often using tools external to the Eclipse IDE, such as PowerDesigner, SQL Developer, and good old DDL in Notepad++. The point is that there is no auto-generation or automated reverse engineering between the JPA Entities and the database tables. The text based JPA annotations and the separately defined text based database field and table names can be mismatched from time to time. Given this, we get a lot of value from the Dali validation and error highlighting. It is one of the few tools we have to help find mismatches that otherwise cannot be detected until testing or production.

My question is whether Dali can be scripted or otherwise run externally to Eclipse (preferable as an ant task), such that JPA validation can occur as part of our build process.

We would like to validate the JPA Entities against a specified persistence.xml and either a deployed database/data connector, or a DDL file that defines the database schema.

A bonus question would be how to get the results from such analysis into a format that's consumable by Sonar, as either static analysis results or unit test results.

Thanks!

Was it helpful?

Solution

Currently, Dali does not provide support for validating your JPA configuration outside of an Eclipse workspace. (Dali has lots of dependencies on other Eclipse plug-ins.) That's a good idea, though. Perhaps you could submit an enhancement request via Eclipse's Bugzilla[1].

That said, you could use EclipseLink's Integrity Checker to validate your settings against a live database. See these links: [2] and [3]. If you are using another JPA implementation, it is possible it also provides a way to perform validation.

[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Dali%20JPA%20Tools

[2] http://wiki.eclipse.org/EclipseLink/Examples/JPA/IntegrityChecker

[3] http://wiki.eclipse.org/Configuring_a_Session_%28ELUG%29#Configuring_the_Integrity_Checker

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top