Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Subhendu Mahanta

Greenhorn
+ Follow
since Jan 28, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Subhendu Mahanta

It is also available in Hibernate reference http://docs.jboss.org/hibernate/core/3.5/reference/en/html/tutorial.html section 1.1.6. Startup and helpers.
Because reference is also written by same people: Christian Bauer & Gavin King.
Here is your HibernateUtil class:

I wanted to mean "Thanks Ran".Sorry for the typo.
Thanks Ron.
You are correct that this is part of a learning experience.There is no need for address to point back to customer.Let's say there are 2 entities A & B which have a bi-directional association. In that case I think shared primary key will be the preferred technique.
I have 2 entities :Customer & Address.

With @OneToOne and @JoinTable Customer.java looks like this:



Now Address.java



When I try to persist a customer I get the following stack-trace:



I have tried this change in Address entity:



with no effect. Surely this could be done without using JoinTable.But I want to do it this way for academic interest.Is it possibe?