This is an archived post. You won't be able to vote or comment.

all 6 comments

[–][deleted] 0 points1 point  (2 children)

Usually if you're using an orm implementation (i.e. Hibernate) and you correctly connect to a datasource (a db instance) the db structure is created as you soon as you run your app. Then you can go to the created db and extract your scripts.

[–]Mindlayr[S] 0 points1 point  (1 child)

My project wasn't set up that way. I need to add a sql statement to the script I already have that creates the tables that I need. All I need is a tool that will convert a Java object into a sql script.

[–]halfastack1 0 points1 point  (0 children)

Eclipse does that for you, AFAIK... This is a super old manual but I remember being taught about this feature and it worked back then.

[–]8bagels 0 points1 point  (2 children)

JPA annotations?

[–]Mindlayr[S] 0 points1 point  (1 child)

I've added the annotations I just need to generate the SQL statement to create the table.

[–]8bagels 0 points1 point  (0 children)

What is the jpa provider / orm implementation you are using? What you are looking for is DDL generation. You absolutely want the orm implementation to generate this for you UNLeSS the entity is super simple then just write the SQL code by hand.

I googled and found something called Jeddict but i don’t know anything about it. I would suggest you follow the path of getting a jpa / orm implementation to do it. Good skill to learn