How can I transform Entity-Based diagram to a JPA java code
Asked Answered
T

4

2

I have class diagram created with "Sparx Enterprise Architect v8.0" and i need to generate JPA-based classes with annotations that reflect relations to use it in the code. The problem is that i can convert it to EJB but not JPA which is required for my task.

Tripos answered 20/11, 2011 at 14:37 Comment(1)
if you are interested in MDA I would invite you to follow this stack overflow like QA group dedicated to MDA topics >MDA<.Dinar
A
2

I don't know this product, however they claim that it:

supports modeling of database schema and automatic generation of DDL scripts for eleven DBMS targets out-of-the-box

Once you have the database schema I believe there are various tools that can reverse engineer it and generate JPA entities. Few random hits in Google:

Antiphon answered 20/11, 2011 at 15:14 Comment(3)
Dear Tomasz, Thank you for your response, actually I not am looking for reverse engineering, the Idea is generating the database schema and DAO classes from class diagram.Tripos
Sorry, maybe I wasn't clear enough and you misunderstood me. I don't know Sparx Enterprise Architect, but it can generate database schema for you (DDL script, see quote above), and from DDL script (existing databse schema) you can easily create JPA entities with various tools (see links).Antiphon
If you find this approach helpful consider accepting an answer. Otherwise please provide more detail so me and other could think about it more.Antiphon
B
0

Have a look at the JPA Modeler for Netbeans, will be best fit for your requirement :

generate the database schema and DAO classes from class diagram

You can find the demo here : JPA Modeler Demo - Youtube

Bosk answered 25/2, 2014 at 11:6 Comment(0)
M
0

If you export your model to ecore format, then you can use Texo to generate JPA annotated POJO for your model.

Mnemonics answered 8/10, 2015 at 6:32 Comment(0)
I
0

G9 plugin from Marketplace in Spring Tool Suit did job.

  1. Install Plugin G9
  2. Select Project (JAVA)
  3. Import "Import Database Model"
  4. Select JDBC Driver (In my case mysql)
  5. Maintain JDBC Connection
    • New
    • Provide Driver Name, Add Jar, Port, Driver Class and connection url along with schema (jdbc:mysql://localhost:3306/{schema_name})
  6. Close JDBC Connection Box
  7. Port, DB Name, User Name and PWD
  8. Fetch

Reference URL https://www.esito.no/produkter/dbimport/

Ilene answered 23/10, 2018 at 7:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.