MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
edovale
Post subject: @hibernate.subclass is not generating correct hbm.xml file  PostPosted: Oct 16, 2004 - 05:26 PM
Veteran Member
Veteran Member


Joined: Oct 16, 2004
Posts: 26

Hello there guys,

Here goes the issue:

Code:

/**
 * @hibernate.class table = "table_A"
 * @hibernate.discriminator column = "disc_column" length = "10"
*/
interface A {
 /* some method */
}

/**
 * @hibernate.subclass discriminator-value = "classB"
*/
class B implements A{
/* some methods */
}



The mapping generated does not includes the subclass definition although it does contains the discrimitar column.

here goes the mapping:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="model.User" table="User" dynamic-update="false"
dynamic-insert="false" select-before-update="false">

<id name="id" column="id" type="int" unsaved-value="-1">
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-User.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<discriminator column="usertype" length="10" />

<property name="myFirstName" type="java.lang.String"
update="true" insert="true" access="property" column="firstname"
length="30" />

<property name="myIsActive" type="boolean" update="true"
insert="true" access="property" column="isactive" />

<property name="myLastLogon" type="java.util.Date" update="true"
insert="true" access="property" column="lastlogon" />

<property name="myLastName" type="java.lang.String"
update="true" insert="true" access="property" column="lastname"
length="30" />

<property name="myPassword" type="java.lang.String"
update="true" insert="true" access="property" column="password"
length="20" />

<property name="myUsername" type="java.lang.String"
update="true" insert="true" access="property" column="username"
length="30" />

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-User.xml
containing the additional properties and place it in your merge dir
-->

</class>

</hibernate-mapping>
 
 View user's profile Send private message  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Oct 18, 2004 - 02:56 PM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

edovale,

Quote:

The mapping generated does not includes the subclass definition although it does contains the discrimitar column.

I don't believe the discriminator value is actually supposed to be the classname, according to what I read in the hibernate documentation. There's a really nice tutorial that seems to cover this issue at the IBM website here:
http://www-106.ibm.com/developerworks/java/library/j-hibern/

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
edovale
Post subject:   PostPosted: Oct 18, 2004 - 04:47 PM
Veteran Member
Veteran Member


Joined: Oct 16, 2004
Posts: 26

I don't believe this is the problem. I have tested with different values for the discriminator and regardless of it xdoclet does not generate the proper tags in the hbm.xml file.
I recall having read about a bug in xdoclet regarding this. The question would be if you guys have a fix for it.

Thanks.
 
 View user's profile Send private message  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Oct 18, 2004 - 05:04 PM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

Quote:

I recall having read about a bug in xdoclet regarding this. The question would be if you guys have a fix for it.

For XDoclet fixes, we typically wait for the XDoclet team to release them and then integrate the new version into each service release of MyEclipse. So, we don't have a specific fix for this one. However, if the XDoclet team has released a fix, you can
update the modules used by MyEclipse yourself by following the instructions in the MyEclipse User Guide, available here:
http://myeclipseide.com/enterpriseworkbench/help/topic/com.genuitec.myeclipse.doc/html/gettingstarted/xdoclet-overview/core/refresh.html

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
mraible
Post subject:   PostPosted: Nov 12, 2004 - 05:24 AM
Registered Member
Registered Member


Joined: Nov 10, 2003
Posts: 3

I had this same problem, but it was because I was spelling descriminator wrong. Once I changed it to be discriminator-value="VALUE", the mapping was generated correctly. I'm using XDoclet 1.2.2.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Nov 12, 2004 - 05:50 PM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

Matt,

Thanks for pointing this out. It's a tricky error to diagnose.

By the way, "Happy Joining-MyEclipse Anniversary". ;-)

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits