my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance " Watch "OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance " New topic
Author

OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance

Jonny Andersson
Ranch Hand

Joined: Sep 07, 2004
Posts: 87
I have trouble with a polymorphic unidirectional relation with single tabled inheritance. As not yet have that much experiences from JPA programming am I not quite sure if I break any syntactic rules or if it is a bug. I use OpenJPA 2 and have a class Depot which have a unidirectional relation to transactions that implements DepotTransactions where the class AbstractDepotTransaction is an entity and superclass with subclasses that implements different type of transaction types. This is how the relation is defined in the Depot class:



Persist of concrete transactions through this list works fine but when a Depot is queried is the list always empty. The problem seems to be that the query actually executed queries for transaction types of a specific type and in case that type is AbstractDepotTransaction will never anyone be found:



The part "WHERE t1.TX_TYPE = ?" is what seems to cause the problem as it limits the result set to entities of a specific type. The TX_TYPE is the discriminator column. So the question is, should this work? Or am I breaking some rule?

I hope that someone of you that have got more JPA experiences than I have so far knows. Thanks a lot in advance for any help!


Truly agile Java application developer with Extreme Programming and high quality craftsmanship
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance
 
Similar Threads
JPA(Toplink Essentials) using JTA on Glassfish: Issue In Loading References
Exception on cascade of remove in a unidirectional @OneToMany
A Tricky Stored Procedure
Doubt on some rules from stydy guide
Enthuware question on inner join