Replacement For @Element annotation and mappedBy, defaultFetchGroup of JDO with Objectify

Hello There, 
 
Is Anyone knows How to replace @Element annotation and mappedBy, defaultFetchGroup of JDO with Objectify. Please check below example.
 
@Entity
public class TestGCPClass1 implements Serializable {
 
private Long pId;
 
@Index
private String name;
 
//This is below JDO representation, Wants to replace with Objectify
 
@Persistent(mappedBy = "testGcpClass1", defaultFetchGroup = "true")
@Element(dependent = "true")
private Set<TestUserClass1> users;
 
//This is below JDO representation, Wants to replace with Objectify
 
@Persistent(mappedBy = "testGcpClass1", defaultFetchGroup = "true")
@Element(dependent = "true")
private Set<TestGroupClass2> group;
 
}
 
 
@Entity
public class TestUserClass1 implements Serializable {
 
private Long pId;
 
@Index
private String name;
 
//This is below JDO representation, Wants to replace with Objectify
@Persistent
private TestGCPClass1 testGcpClass1;
 
}
1 1 60
1 REPLY 1

Hi @mangesh-mpl,

Welcome to Google Cloud Community!

Replacing JDO annotations with Objectify equivalents:

Key differences:

  • Annotations: Objectify uses fewer annotations like @Id and @Load instead of JDO's @Persis@Element, and mappedBy.
  • Relationships: Objectify doesn't use mappedBy. Use @Load and @Parent to fetch related entities and manage their lifecycle manually.
  • Fetch groups: Objectify doesn't have fetch groups. Explicitly fetch related entities using @Load.

Remember, Objectify is no longer actively maintained, so you might encounter limitations or outdated information in its documentation. If you're starting a new project, consider using more actively supported libraries like EclipseLink JPA.