Welcome to Data Access Layer for Java (DAL4j), a command line tool and framework used to reverse engineer a MySQL or SQLServer database tables and views into a set of JPA Entity Beans.
DAL4j can be useful for scenarios where there is an existing database schema but a technology other that JPA is used by applications to interact with the database. DAL4j can provide an relatively pain free way to migrate your code base from other technologies such as JDBC or Hibernate to JPA.
The follow describes how DAL4j is used:
See [ejb-framework-sample] which shows how to use DAL4j ejb framework. Using the EJB framework is not required, it is provided to simplify creation of Session Beans in a J2EE environment.
See [database-re-factoring] to see how DAL4j can be used in conjunction with tools like liquibase to keep entities in sync as the schema changes.
There are currently two different types of code generators that DAL4j can use to generate Entity Beans:
com.dal4j.jpa.tools.cod]egen.SimplePojoGenerator - This class generates traditional Entity beans not for use with the DAL4j Framework. One possible use of this generator is one-time schema reverse engineering. In this case one-to-many or many-to-one associations can be manually added to the generated entities and the entities would be manually maintained going forward. See [samples-simple] for an example of a project that generates and shows usage of DAL4j Simple Entity Beans.
com.dal4j.jpa.tools.codegen.FrameworkPojoGenerator - This class generates Entity beans that inherit from the DAL4j framework classes. These beans can be used in conjunction with DAL4j framework classes such as EntityDAO<c> and DAOFactory. See [samples-framework] for an example of a project that generates and shows usage of DAL4j framework Entity Beans in a stand alone application. Two additional examples also exist that show usage of framework generated Entity Beans in EJB session beans [samples-ejb] and the last example [ejb-framework-sample] which shows usage of the DAL4j EJB framework.</c>
See the [Code-Generation] page for a description of the code generation command line tools.
See the [type-mapping] page to customize how database types are mapped during code generation.
The wiki uses Markdown syntax.
Wiki: Code-Generation
Wiki: database-re-factoring
Wiki: ejb-framework-sample
Wiki: round-trip-sample
Wiki: samples-ejb
Wiki: samples-framework
Wiki: samples-simple
Wiki: type-mapping