File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes One - to -one mapping using non primary key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "One - to -one mapping using non primary key" Watch "One - to -one mapping using non primary key" New topic

One - to -one mapping using non primary key

Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 88

I have two tables:

Table1 :
id:primary key

Lid: primary key

In both the cases email is neither primary key, nor the foreign. Is it possible to establish one-to-one mapping between both of these tables for the column email. I am using xml for mapping.
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Are you using JPA? JPA requires the JoinColumn reference the Id, but some JPA providers allow this.

In EclipseLink this is supported, but possibly not through JPA config, you may need to use a customizer.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
I agree. Here's the link:
subject: One - to -one mapping using non primary key
It's not a secret anymore!