I have a legacy database that I'd like to build a CDT to access. It is compr

I have a legacy database that I'd like to build a CDT to access. It is comprised of many tables that have no foreign key relationship but was instead treated as a series of flat tables. For example:

Main table looks like this:
id int, primary key, description char(255), customerID int, representativeID int

Secondary table "Customer" customerID int, primary key, customer_name char(500)

Secondary table "Representative" representativeID int, primary key, representative_name (char 200)

Using an @OneToMany annotation appears to require a reference to the primary table embedded in the secondary tables. I don't find much documentation on @ManyToOne which sounds like it describes the relationship better.

Also, part of the application is to migrate this data to a newer database. That has all been created, so I really only need this for read access (and would obviously prefer to use a queryEntity).

Help?

OriginalPostID-193023

OriginalPostID-193023

  Discussion posts and replies are publicly visible

Parents
  • Sorry, for the delay, our system administrator needed to do some work to support this and we're on-premise. So the answer is a resounding yes. Using @JoinColumn to connect a lookup table is a great solution. I am unfamiliar with JPA, and made the assumption that the @JoinColumn required a relationship summary annotation (e.g. @OneToMany).

    That's not the case! Thank you!
Reply
  • Sorry, for the delay, our system administrator needed to do some work to support this and we're on-premise. So the answer is a resounding yes. Using @JoinColumn to connect a lookup table is a great solution. I am unfamiliar with JPA, and made the assumption that the @JoinColumn required a relationship summary annotation (e.g. @OneToMany).

    That's not the case! Thank you!
Children
No Data