You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by coloradoflyer <op...@parallelsw.com> on 2009/10/10 07:59:52 UTC

Inhertance problem with ManyToOne

Hi all,

I'm working on some new code and came across a problem in using
@@Inheritance(strategy = InheritanceType.JOINED).  The entire solution I'm
building is much bigger than this, but I have been able to cut the code down
to a relatively small piece.  First, I'm very familiar with EJB3 and JPA,
but have not worked a lot with inheritance, this was my first stab at using
it.  I have mapped several classes using the @MappedSuperclass, and came up
with this problem first from using the MappedSuperclass.

The code works with (Standalone mode) openejb 3.1.1 using openjpa 1.2.1

So, I changed the problem into something more general, and easier (I hope)
to explain.  The code I can post, unless we can figure out what I did wrong
from my description models, an Invoice, each Invoice, has a set of
InvoiceLineItems, the super for the InvoiceLineItem is modeled to be
@Inheritance(strategy = InheritanceType.JOINED).  The InvoiceLineItem
superclass has a mapping for a name, and a type, the name is a String, the
type (not the inherited type) is a very simple entity mapped to be ManyToOne
from the InvoiceLineItem super.

The problem is in this simple invoicelineitemtype mapping. The system will
create the entities with all of the relationships in place, without an
issue, but when I try to load all of the Invoices i.e. ("select i from
InvoiceImpl i") I get the exception shown below.  I can post a working test
case that shows the error, but wanted to find out if this rings a bell with
someone for what may be wrong.  If you would like to see more of the model
or code, I will post any or all of it, whatever is needed.  

The code produces the following exception:
Caused by: <openjpa-1.2.1-r752877:753278 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: 3
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:875)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:774)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:982)
<snip />
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
	at
org.apache.openjpa.meta.ClassMetaData.getExtraFieldDataIndex(ClassMetaData.java:859)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:358)
<snip/>

Please let me know if you have seen this or have a work around... Or If I
should post the example code.

thanks in advance,
-chris
-- 
View this message in context: http://n2.nabble.com/Inhertance-problem-with-ManyToOne-tp3798715p3798715.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.