File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One - to -one mapping using non primary key

 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 553
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic