Rob
Rob

Reputation: 16002

JPA/JSP/EJB : How to create tables from entities?

I'm learning how to use JPA with NetBeans/Glassfish.

I have created a new EE project, and some entities in the EJB. I also created a new database. While creating the entities I also created a new persistence unit. In Data Source I chosed "New data source", and for the database connection I used the one I've created just before.

But when I look in services to my database, I don't see any table corresponding to the entities. What should I do now?

enter image description here enter image description here

Thanks for your help. And sorry if the question is obvious but I'm really new to this kind of programming.

Upvotes: 0

Views: 546

Answers (1)

DataNucleus
DataNucleus

Reputation: 15577

JPA (2.1) allows you to create the schema appropriate for your JPA entities in your persistence-unit when the EntityManagerFactory is created. The linked page tells you what persistence properties to specify in your persistence-unit for this to happen automatically. (assuming your JPA implementation is for JPA version 2.1)

Upvotes: 1

Related Questions