• 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

OneToMany mappedBy composite (foreign) key gives empty collection - OpenJPA + EJB3

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I currently have 3 tables with the following structure:

company
----------
co_id [pk]
co_name

companyaddress
-------------------
co_id [pk] [fk: references company.co_id]
addr_type [pk]
addr_street
addr_suburb
addr_state
addr_postcode

companyemergencynumber
--------------------------------
emerg_id [pk]
co_id [fk: references companyaddress.co_id AND company.co_id]
addr_type [fk: references companyaddress.type_id]
emerg_phone


and the quantitative relationship between them are as follows:
company (1 to many) companyaddress (1 to many) companyemergencynumber
>> in other words:
* each company can have 1 or more companyaddress
* each companyaddress can have 1 or more companyemergencynumber

I would like to list all addresses and their corresponding emergency numbers for a selected company, and I've implemented my entity classes as follow:




My problem is when trying to access emergency numbers linked to company address. Emergency numbers do not seem to get retrieved even though OneToMany relational mapping has been defined and fetchType has been set to FetchType.EAGER.


Could anyone please help? Where did I go wrong

many thanks
Fera



 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic