Nilesh
Nilesh

Reputation: 4177

Is there a way to create database tables alongside classes in Spring Roo?

I have set up entities and their relationships with Spring Roo. I am trying to run "perform tests" through Roo but see that corresponding tables for these entities are not created in the datbase that I selected as part of my database setup.

Is there a way to tell Spring Roo to generate database tables, columns too alongside entities and its fields?

Upvotes: 0

Views: 2879

Answers (3)

David Sanders
David Sanders

Reputation: 56

You may need to create the database yourself, then Hibernate will create the tables for you. I had the same problem and my db user was root so I just assumed that Hibernate would create the database - but it wasn't. As soon as I created the schema, everything worked fine.

The tables seem to be created during sessionFactory creation according to this answer.

Upvotes: 4

abalogh
abalogh

Reputation: 8281

Have you done the "persistence setup .." step? If so, you should have a persistence.xml in src/main/resources/META-INF. Do you have a property named "hibernate.hbm2ddl.auto" there? What is its value?

Upvotes: 2

Constantiner
Constantiner

Reputation: 14221

You can find an example of filling in memory DB with test data here. Hope this helps.

Upvotes: 0

Related Questions