How to map an entity to table using hibernate??

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]

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]

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

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

Last updated