-->
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.  [ 3 posts ] 
Author Message
 Post subject: SOLVED !!Joined Subclass
PostPosted: Thu Oct 30, 2008 8:15 am 
Newbie

Joined: Thu Oct 30, 2008 8:04 am
Posts: 5
Hi, i am trying to use in inheritance mapping.

So, i have a Super Class Artikel and one child class FremdArtikel. Furthermore i have a link from FremdArtikel to Artikel.

So, how can i do that?

My Mapping looks like that:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

    <class
        name="hello.Artikel"
        table="artikel">

        <id
            name="id"
            column="id">
            <generator class="native"/>
        </id>

        <property
            name="ItemCode"
            column="ItemCode"/>

        <property
            name="ItemName"
            column="ItemName"/>

        <property
            name="Description"
            column="Description"/>
           
        <joined-subclass name="FremdArtikel"
      table="fremdartikel">
      <key column="ID"/>
      <many-to-one name="refitem" class="Artikel" column="refitem"/>
      
   </joined-subclass>
       
    </class>

</hibernate-mapping>

And the FremdArtikel Class looks like that:
Code:
public class FremdArtikel extends Artikel{
   
    private int RefItem;

   
    public int getRefItem() {
        return RefItem;
    }

    public void setRefItem(int RefItem) {
        this.RefItem = RefItem;
    }

    public FremdArtikel() {
    }
   
}


But i get the error message: org.hibernate.MappingException: An association from the table fremdartikel refers to an unmapped class: Artikel after compiling.

what did i do wrong?

best regards

Philipp


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2008 10:22 pm 
Beginner
Beginner

Joined: Fri Sep 12, 2008 10:55 am
Posts: 33
stupid question - but does the class Artikel have package as:
Code:
package hello;

public class Artikel {
...
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2008 11:42 am 
Newbie

Joined: Fri Oct 31, 2008 10:51 am
Posts: 7
Location: Guatemala
i haven't used the mapping, i just have used annotations but as long as i see

<many-to-one name="refitem" class="Artikel" column="refitem"/>

there's class="Artikel"

but in your class

private int RefItem;

RefItem's class is an integer not an Artikel type


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.