openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grenier Nicolas" <Nicolas.Gren...@atosorigin.com>
Subject Find by primary key does not return the real type of a record but instance of the type passed as parameter
Date Thu, 12 Oct 2006 09:58:43 GMT
Hello,

I have developed a small test application using OpenJPA (fresh checkout)
in which I have the following class hierarchy:

	RootEntityClass <- ChildMappedClass <- LeafEntityClass

In my application I do a find by primary key using the entity manager
like this:

	LeafEntityClass myLeaf = (LeafEntityClass)entityManager.find
(RootEntityClass.class, id);

I know that I can only get a Leaf instance (I've only such records in
database) so I attempt to cast it to the Leaf type. 
This code works fine with Hibernate but with OpenJPA, the entity manager
returns instances of RootEntityClass and not LeafEntityClass.

Is this a bug ; specifications are not very clear concerning the find
method behaviour ?

Thanks in advance.

Nicolas.



Mime
View raw message