Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] AttributeGroup, EntityManager.load(...) with Relations to Abstract Superclass

I've tried a similar arrangement and it worked - the difference is no table-per-class inheritance and ManyToMany instead of OneToOne:

Employee LAZY ManyToManyMapping("projects") Project
HugeProject inherits from Project (HugeProject defines "evangelist")
HugeProject LAZY OneToOneMapping("evangelist") Employee

// read the Employee
Employee empRead = em.find(Employee.class, id);
// create LoadGroup
LoadGroup lg = new LoadGroup();
lg.addAttribute("projects.evangelist");
// load - all SELECT calls executed here
JpaHelper.getEntityManager(em).load(empRead, lg);
// both project and evangelist have been already loaded, the following line generates no SQL String evangelistName = ((HugeProject)empRead.getProjects().iterator().next()).getEvangelist().getFirstName();

On 9/14/2012 7:55 AM, sr_dd wrote:
Hello,

I have a question about fetching Relations with the
EntityManager.load(...)-functionality.

Following Example:
I have an abstract superclass "AbstractPerson" and two concrete
implementations "LargePerson", "SmallPerson". Additional to the fields and
relations defined in the "AbstractPerson" the concrete classes have some
relations on their own. All classes mapped as entities with table-per-class.

Now I have an entity "Example" with a oneToOne Mapping to a property
"person" of Type "AbstractPerson".

What I want to do now is:
* load some Entity of Type example.
* Define a AttributeGroup which contains the oneToOne relation "person" and
relations of the concrete-implemented-entities of AbstractPerson.
* execute JpaEntityManager.load(entities,attributeGroup)
* as result I expect the path example.person.concreteRelationOfTypeOfPerson
is fetched.

All I achieved so far is the path example.person is fetched.

What can I do?

best regards
Stefan





--
View this message in context: http://eclipse.1072660.n5.nabble.com/AttributeGroup-EntityManager-load-with-Relations-to-Abstract-Superclass-tp154468.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top