• 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

adding id members to various classes

 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there,

i have a bunch of different objects, all of them auto-generated from an xml-scheme. to give you an example:



i need to get those objects persistent into the database. even though i want to use an ORM tool, prefarable iBATIS, the data needs to be relational accessible via pure SQL. this lead to a data-base design like this:



(without this requirement, the schema would be pretty much the same i guess ;-) )

and here is my problem:

as i dont have influence on the classes i need to persist, they don't have id values. as already mentioned, they are JAXB-generated from an xml scheme. but for persistence with 1:1 and 1:n relations, unique persistant ids are an absolute must.

every single ORM example i find in the web comes with it's objects having id fields, making them perfectly identifiable.

so, where do i get my id's from?

i don't consider this an ORM question, pls dont move. i'd rather put my question like this - what would be the best aproach to get the id to the objects?

(1) changing the classes
hm, i have hundreds of those

(2) wrapping it somehow
how would "somehow" work with so many different classes? effectiveness and performance is a must. am i blind or is the solution non-trivial?

(3) influence on jaxb to generate id's
i'll investigate in this direction

any ideas welcomed!

many thanks,
jan
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... i solved the problem with extending all schema-derived classes from one common superclass which provides ids ...
 
reply
    Bookmark Topic Watch Topic
  • New Topic