I am using hibernate annotations with spring MVC.
Now i always create table using GUI editor like SQLYOG or phpmyadmin.
So i just create table with columns and even if i have some tables primaray key in other table , i just make that column with name like
Person ---id--name--age
SUbject------person_id----description
So i made those tables using GUI with mentioning anything about foreign key etc.
There is option in GUI editor ti make it primary kay and Auto increment so it usually works till now.
But i want to know that in Hibernate do i need to make tables with proper sql command . i mean do i need to mention which table is primary key and which is foreign key
or hibernate annotations are enough for that
Hibernate will work just fine as long as your annotations are correct.
But from a database design point of view I strongly suggest that you create at least the primary key and foreign key constraints.
Your queries will run much faster if you create the primary keys. You can improve performance a little more by creating other kinds of indexes to.
PHPMyAdmin is perfectly able to create primary keys for you, as well as every other index types there is in mysql. There’s no need to write your creation code by hand.