Fera Tsie

Greenhorn
+ Follow
since Oct 31, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Fera Tsie

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