After this i see my Orders table with 3 columns. id,customer,customer_id
Why do you see three columns? Is Hibernate generating your tables?
Anyway, in the
Java side just think of Java objects, not FK and PKs like said before.
Your mapping should be simple too. Do not have any int customer_id fk properties in your Java objects.
When mapping OneToMany or ManyToOne, I always include @JoinColumn so that if Hibernate is generating your tables that it puts a FK field into the Child table, instead of creating a Join Table between the Parent and Child tables.
I recommend reading a book on Hibernate to fully understand the ORM design and how things work.
Good Luck
Mark