Hi!
If you cannot migrate the referenced tables in the same step (which may be impossible due to time-constraints or application structure), than the only way I see is, to reference only the foreign-key (as it is) in the Hibernate-mapped object. When you pass such Hibernate object into legacy sections, old-style SQL would access the foreign-key directly and use it.
However: In my experience it is much less work to create also a mapping for the referenced table than doing all such work-arounds. You may not want to convert all places in your application where you use the referenced object in the same time, but you can. And - because of the lazy loading - the referenced object is only fetched, when you actually call the getter. It also works for legacy code where you can get the ID from the mapped object. Try it! :-)
All the best,
René
|