• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Hibernate on DB's w/o Primary Keys

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey All -

This is my first post here, so go easy on me

The system I am working on has 2 main databases (we'll call them DB1 and DB2), with tables spread among several schemas. DB2 is accessed via synonyms in DB1, so the application only logs into DB1. To complicate things, tables in DB1 have foreign key mappings into tables in DB2. The tables in DB2 don't have primary keys, only unique indexes.

So, middlegen is not giving me very accurate HBM files. It is basically giving me a class that has no relation to any other table, and it has a composite-id made out of every column.

Has anyone out there dealt with this? I'm not really sure what other information you might need to help me with this, so please ask if I left some stuff out (which I'm sure I did).

Thanks a ton!
Lavie
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch Lavie

Unique indices should be enough to uniquely identify rows, so the lack of PKs shouldn't be an issue in that regards. You can map your id property to the fields in the unique index and use an "assigned" key generator.

Of course, you can't have any real referential integrity if you don't use PKs, so that is presumably why middlegen is not producing mapping files with associations. I'd revert to manually writing your mapping files. A little tedious, but if you don't have a proper relational data model to work with there is not much else you can do I'm afraid.
 
Lavie Tobey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was afraid of that

Thanks for the response!
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic