-->
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: Problem with XDoclet generating hbm.xml files correctly
PostPosted: Wed Sep 07, 2005 12:07 pm 
Newbie

Joined: Thu Aug 25, 2005 6:18 pm
Posts: 1
I am new to using hibernate and XDoclet so please be patient with me.

I am having problems using hibernate and discriminator values and getting XDoclet to generate my hbm.xml files correctly.


Here is the setup below.
The interface:

public interface Entity{
public abstract Integer getEntityID();
}

Then I have an abstract class which extends the interface
/**
* @hibernate.class table="employee"
* @hibernate.discriminator column="type"
*/
public abstract class Person implements Entity{
public Integer getEntitiyID(){
return null;
}
::should essentiall be empty::
}

Then I have my base class:
/**
* @hibernate.subclass discriminator-value="price" table="products"
*/
public class Employee extends Person{
::: methods are here::
}

I am using hibernate version 3.0,XDoclet 1.2.3.

The reason I have to use 3 classes is due to a bug in XDoclet that does not recognize the "Implements" keyword. I have my hbm.xml file being generated via XDoclet and the sublcass is not showing the "table" attribute inside of the "<subclass>" element. I need to be able to use discriminator values as I am looking to make a more generic class that can take any type of Person ie ... Employee, Neighbor, Contact etc... and have this code work.

Does anyone know how I go about really using discriminator values or can lead me to a good tutorial on them. I also was wondering if anyone knew why when XDoclet generates my hbm.xml file why in the subclass the "table" attribute is left out every time. I also get an error when XDoclet runs complaining about an ID that needs to be put in same class as the one that specifies the @hibernate.class attribute.

Any help or assistance would be much apperciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 1:12 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Discriminator values are useful for the table-per-class-hierarchy strategy, since data from all descendents of the base class are stored in the same table.

It looks like you are attempting to use the table-per-sublcass strategy, which is implemented using joined-subclass. Read the guide and decide which solves your problem:

http://www.hibernate.org/hib_docs/v3/re ... tance.html

Hope this helps,

Chris


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.