-->
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.  [ 2 posts ] 
Author Message
 Post subject: inheritance question
PostPosted: Fri Jan 13, 2006 6:38 am 
Regular
Regular

Joined: Wed Sep 21, 2005 1:37 pm
Posts: 53
Location: Montpellier - France
Hello,

I have an exception during session configuration.

I want to use 2 tables for thoses classes :

The first class must use the table 'Entities' :
Code:
class AbstractEntity {
//with some persistent data
}


This class contained data but JBoss use and other sub-class
Code:
class PersonBean extends AbstractEntity {
//with some persistent data
}


The last class is a sub-class of the previous and must store all the data of
'PersonBean' in 'PERSONS' :
Code:
class PersonBMP extends PersonBean {
//with no data but generated by xdoclet and used by JBoss
}


The problems are :
- it seems that I can't use 'PersonBean' in mappings because the class used to instanciate objects is 'PersonBMP'
- when I use 'PersonBMP' to define mappings, it first super-class is not 'AbstractEntity' and the mappings don't work.


Hibernate version: 3

Mapping documents:
<hibernate-mapping auto-import="true" default-access="property">
<!-- PersonBMP -->
<class name="org.infodavid.data.entities.AbstractEntity" table="ENTITIES" abstract="true">
<id name="primaryKey" column="entity_id" type="java.lang.Long">
<generator class="identity"/>
</id>
<version name="version" column="version" type="java.lang.Integer"/>
<property name="comment" column="comment" type="java.lang.String"/>
<property name="userData1" column="userData1" type="java.lang.String"/>
<property name="userData2" column="userData2" type="java.lang.String"/>
<property name="identity" column="identity" type="java.lang.String"/>
<property name="image" column="image" type="javax.swing.Icon"/>

<union-subclass name="org.infodavid.data.entities.PersonBean" table="ENTITIES">
<union-subclass name="org.infodavid.data.entities.PersonBMP" table="PERSONS">
<property name="firstname" column="firstname" type="java.lang.String"/>
<property name="birthdate" column="birthdate" type="java.sql.Timestamp"/>
<!--
<many-to-one name="title" class="org.infodavid.data.entities.PersonTitleBMP" column="title_id"/>
-->
</union-subclass>
</union-subclass>
</class>
</hibernate-mapping>

Name and version of the database you are using: Hsql in JBoss


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 10:09 am 
Regular
Regular

Joined: Wed Sep 21, 2005 1:37 pm
Posts: 53
Location: Montpellier - France
It's now ok.

I use 'PersonBean' as hibernate entity and a simple joined-subclass to use the 2 tables.

Now, I must see the associations and how to create a remote associated object, not a 'PersonBean' or 'PersonBMP'.
I must use the EJB home to do that.


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

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.