-->
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: Mapping Static subclasses with "One table per hierarchy
PostPosted: Thu Sep 11, 2003 1:28 pm 
Newbie

Joined: Wed Sep 10, 2003 10:24 am
Posts: 5
Hi All,

I got a problem when tried to map a hierarchy using the "one table per hierarchy" strategy.

I have an abstract superclass, named A, and 3 subclasses, B, C, and D.
The problem is that I programmed B, C, and D, as private static classes of the superclass A. Something like this:

public class A
{
int oid;
String name;

public A(String name)
{
this.nome = nome;
}

...

private static class B extends A()
{
public B()
{
super("B");
}

}
...
}

My intention is to use attribute "name" as a discriminator. But it is not working.

The descriptor mapping for class A is the following:
<class name="A" table="tb_a">
<id name="oid" type="int" column="id" unsaved-value="0">
<generator class="identity"/>
</id>
<discriminator column="name" type="string"/>

<property name="nome">
<column name="nome" sql-type="varchar(32)" not-null="true"/>
</property>

<subclass name="A$B" discriminator-value="b">
</subclass>
...
</class>
Is it correct ?
How could I implement that mapping strategy for this implementation ?


Thanks in adv

Gustavo


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 1:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The discriminator mapping does not refer to any property of the class. It is managed internally by Hibernate.


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.