How to map an entity to table using hibernate??

Last updated 8 months ago

Here shows how to map an entity to table using hibernate

First of all, you have to create your application and connect to the database, for that you must click on "Application builder" and then click "configure database" [Fig. 1] and put information from your database [Fig. 2]

[Fig1] Application builder
[Fig.2] Configure database

Open eclipse, it is automatic create the file with the the same name of your connection (hibernate_app_pg_1). Open the file and map yours classes [Fig. 3]

[Fig. 3] Hibernate mapping

Now, just create your class Teste and Voilá [Fig. 4] And don't forget put your connection name on your classe [Fig. 5]

[Fig. 5] Connection name

Then you can see your table created in your database [Fig. 6]

[Fig. 6] table teste on database