• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One - to -one mapping using non primary key

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic