Illarion Kovalchuk
Illarion Kovalchuk

Reputation: 5894

How to generate orm mapping classes from sql schema in Java

I have an existing sql schema file for db. Is it possible to generate and re-generate when needed DAO's entities and all other required helper/client classes to access it? I don't mind what will it be -- hibernate, other jpa or something else.

Upvotes: 0

Views: 2095

Answers (1)

syr
syr

Reputation: 934

Asuming you/others are still looking for a solution:

I just got the same problem and got it working in Eclipse (slightly different) as follows:

  1. created JPA Project and downloaded & added user library in the wizard
  2. Also wanted to give a schema-sql-file as input but instead found a way to take an actual db as input. (That was surely much easier for the developers of the tool to process than parsing proprietary sql-script-files)
  3. To do that "rightclick" you jpa project an there "new/other/jpa/entities from tables"
  4. In the following Wizard you have to create a db-connection to the db whose schema you want to get as jpa-annotated POJOs (IMHO It's very intuitive..but you may ask if there is a problem)

  5. After finishing all jpa-classes are generated from the db...saved me from a lot of dummy work :)

Upvotes: 1

Related Questions