-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JPA and Abstract class problem
PostPosted: Thu Jan 03, 2008 11:12 am 
Newbie

Joined: Thu Jan 03, 2008 10:58 am
Posts: 1
Hi,

I have a problem using hibernate as a JPA provider.

I have a class hierarchy consisting of one abstract class and two subclasses that extend this abstract class. I have another class that containts a Set of the abstract class so it can contain instances of the two subclasses. Whenever I try to get the Set of classes I get a Persistence exception saying Hibernate can't instantiate an abstract class when it really should create instances of the subclasses.

I know there is a way using the native hibernate mapping xml file using the property abstract = "true", but I'm using the JPA orm.xml mapping file which you can't use such property.

Any suggestions about how to solve this problem ?

Thank you.

CR

Hibernate version: hibernate-3.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

javax.persistence.PersistenceException: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: com.festina.tventas.app.dmo.Articulo
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)

Name and version of the database you are using:

mysql 5.0.41

The generated SQL (show_sql=true):


Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.