aspose file tools
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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: 85
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!


Effective Java Programming Language Guide: Think in terms of exported APIs because it tends to improve the quality of the software you write
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OpenJPA-problem with polymorphic unidirectional relation with single tabled inheritance
 
Similar Threads
A Tricky Stored Procedure
Enthuware question on inner join
Doubt on some rules from stydy guide
Exception on cascade of remove in a unidirectional @OneToMany
JPA(Toplink Essentials) using JTA on Glassfish: Issue In Loading References