• 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

Help required in problems with Assigned generator class

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am using assigned generator class. Because I have lot of legacy data. To manage that I started using assigned generator class. What are all the problems I may face with this? How to overcome them? Please help me to get out from this problem.
Thanks,
Kumar.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I really don't see what problem you're talking about?

If you decide to use "assigned" generator for your Hibernated domain objects, then Hibernate lets you do all ID assignments for newly created entities. I.e. when you want to create a new persisted Order object, you say "myNewOrder = new Order()" and call the primary key setter, e.g. "myNewOrder.setId(getNextAvailableIdFromSomewhere())".
 
Sripad Kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!,
We are migrating our database from SQL Server to Oracle, meanwhile we decided to use hibernate. We cannot add extra id column to the database tables. We must use the existing primary-key as id in our case.

Hibernate supports assigned generator class to support this. But hibernate-reference.pdf document or hibernate in action book says if we use assigned generator we will be in troubles while working with detached objects/Trancient Persistence.

Is there any other generator class which will accomplish my requirement.
Thanks,
Kumar.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. I see. I haven't worked with detached objects in Hibernate yet so I'm afraid I can't be of much help there.
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But hibernate-reference.pdf document or hibernate in action book says if we use assigned generator we will be in troubles while working with detached objects/Trancient Persistence.


if you have HiA, at the end of 3.4.3 (page 92), i think they refer to your problem and say they discuss it in chapter 8, section 8.3.1 - legacy schemas and composite keys
 
reply
    Bookmark Topic Watch Topic
  • New Topic