-->
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: xdoclet joined-subclass not creating mapping in superclass.
PostPosted: Tue Mar 08, 2005 3:54 pm 
Newbie

Joined: Wed Mar 02, 2005 7:41 pm
Posts: 7
Hi,

I am new to Hibernate.

This is more of a XDoclet issue than Hibernate issue.

I have 3 classes

1. OIDObject.java : generates sequence ID.
2. Error.java extends OIDObject : Superclass
3. WorkRequestError extends Error : Subclass

I am using "Table per Subclass".

Sequence ID generation is working fine.

Problem Description :

When I put @hibernate.joined-subclass and @hibernate.joined-subclass-key tags in WorkRequesError.java, it is not creating "<Joined-subclass>" mapping in superclass mapping file i.e. error.hbm.xml file.

Am I missing something here ?

My mapping file and Java classes are listed below.

Please Help !!!

Thanks

JP


============= OIDObject.java =======================

/**
* @hibernate.class
*/

public class OIDObject extends NumberedObject
{
protected Long OID;

public void setOID(Long oid)
{
OID = oid;
}

/**
* @hibernate.id
* column="oid"
* generator-class="sequence"
*
* @hibernate.generator-param
* name="sequence"
* value="SequenceName"
* @return
*/
public Long getOID()
{
return OID;
}
}

============== End OIDObject.java ====================

============== Error.java ==========================
/**
*
* @hibernate.class table="error"
*
*/
public class Error extends OIDObject
{
protected String message;

protected String description;

protected String errorMode;

protected String type;

/**
* @hibernate.property
* column="error_message"
* not-null="true"
*
*/
public String getMessage()
{
return message;
}

public void setMessage(String m)
{
message = m;
}

/**
* @hibernate.property
* column="description"
*
*/
public String getDescription()
{
return description;
}

public void setDescription(String desc)
{
description = desc;
}

/**
* @hibernate.property
* column="errormode"
* not-null="true"
*
*/
public String getErrorMode()
{
return errorMode;
}

public void setErrorMode(String errorMode)
{
this.errorMode = errorMode;
}

/**
* @hibernate.property
* column="error_type"
* not-null="true"
*
*/

public String getType()
{
return type;
}

public void setType(String newType)
{
type = newType;
}
}

============== End Error.java =======================

============== WorkRequestError.java =================
/**
* @hibernate.joined-subclass table="workreqerror"
* @hibernate.joined-subclass-key column="oid"
*
*/
public class WorkRequestError extends Error
{
protected WorkRequest workRequest;

/**
* @hibernate.many-to-one column="workrequestoid"
*
* @return
*/
public WorkRequest getWorkRequest()
{

return this.workRequest;
}

public void setWorkRequest(WorkRequest wreq)
{

this.workRequest = wreq;

}
}

============== End WorkRequestError.java ==============

Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

2.1.8

Mapping File

<?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="Error"
table="error"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>

<id
name="OID"
column="oid"
type="java.lang.Long"
>
<generator class="sequence">
<param name="sequence">SequenceName</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Error.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<property
name="message"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="error_message"
not-null="true"
/>

<property
name="description"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="description"
/>

<property
name="errorMode"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="errormode"
not-null="true"
/>

<property
name="type"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="error_type"
not-null="true"
/>

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

</class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close(): None

Full stack trace of any exception that occurs : No Exception

Name and version of the database you are using : Oracle 9i

The generated SQL (show_sql=true) : N/A

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 5:53 pm 
Newbie

Joined: Wed Mar 02, 2005 7:41 pm
Posts: 7
Some progress on this ...

If I move, subclass, WorkRequestError.java in the same package as superclass, Error.java, xdoclet is generating "joined-subclass" mapping. But would not work in separate packages...

Any input ?

Thanks

JP


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.