aspose file tools*
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
Author

One - to -one mapping using non primary key

Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 87
Hi,

I have two tables:

Table1 :
{
id:primary key
name:
email:
}

Table2:
Lid: primary key
tname:
email:
}

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.

See,
http://en.wikibooks.org/wiki/Java_Persistence/Relationships#Filtering.2C_Complex_Joins


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: One - to -one mapping using non primary key