Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 1
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 221 times and has 0 replies Next Thread
Male sidney
Newbie



China
Joined: Mar 3, 2010
Post Count: 5
Status: Offline
Reply to this Post  Reply with Quote 
confused JDO2 maxFetchDepth issue

Hi expert,

There 3 classes, referencing the following code


@PersistenceCapable(identityType = IdentityType.APPLICATION, table = "ADDRESS")
public class Address {
......
}

@PersistenceCapable(identityType = IdentityType.APPLICATION, table = "ACCOUNT")
public class Account {

@Persistent(primaryKey = "true", column = "ACCOUNT_ID", valueStrategy = IdGeneratorStrategy.IDENTITY)
private long accountId;

@Persistent(name = "addresses", defaultFetchGroup = "true")
@Column(name = "ACCOUNT_ID")
private Set<Address> addresses = new HashSet<Address>();
......
}

@PersistenceCapable(identityType = IdentityType.APPLICATION, table = "USER")
public class User {
......
@Persistent(name = "account", persistenceModifier = PersistenceModifier.PERSISTENT, column = "ACCOUNT_ID", defaultFetchGroup = "true")
private Account account;
.....
}


The field account in User and addresses in Account use the default fetch group.

When retrieving Account, the field addresses in Account will be retrieved immediately. But when retrieving User, the field addresses will be changed to lazy load.

And I also try to config the fetch plan in User like following

@FetchGroup(name="group_1", members=@Persistent(name="account"))
@FetchPlan(name="plan_1", maxFetchDepth=3, fetchGroups="group_1")


However, the addresses is also lazyload, when retrieving User.
And the attribute 'recursionDepth' in '@Persistent' is also not work.

I want to get addresses immediately, when retrieving User.

How to do?

Best Regards,
Sidney
[Mar 4, 2010 11:09:58 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread