File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "@Embedded not loading with owner entity" Watch "@Embedded not loading with owner entity" New topic
Author

@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
Bartender

Joined: Mar 24, 2008
Posts: 3838

Can you post the relevant code fragments for this?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @Embedded not loading with owner entity