File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes @Embedded not loading with owner entity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "@Embedded not loading with owner entity" Watch "@Embedded not loading with owner entity" New topic

@Embedded not loading with owner entity

john lazeraski
Ranch Hand

Joined: Nov 14, 2011
Posts: 76
Hi all,

I have a User entity and Address entity that is marked @Emeddable, it has not @Table, no @Id, etc. I am doing much like many examples out there with a User and Address setup, where Address is embedded. I am able to persist the address no problem. But when I retrieve the User which IS found, the Address object is not null, but the fields in it are. The data is in the DB columns correctly. To add a twist to this, I have a State and Country entity, both of which are mapped as @OneToOne in the Address entity. Those DO load correctly. So user.getAddress().getState().getId() works. But user.getAddress().getCity() is null.

Any clue why this might be?
Vijitha Kumara

Joined: Mar 24, 2008
Posts: 3902

Can you post the relevant code fragments for this?

[How to ask questions] [Twitter]
I agree. Here's the link:
subject: @Embedded not loading with owner entity
jQuery in Action, 3rd edition