-->
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.  [ 4 posts ] 
Author Message
 Post subject: using xdoclet to generate mapping
PostPosted: Fri Oct 07, 2005 6:54 pm 
Newbie

Joined: Thu Sep 22, 2005 5:17 pm
Posts: 11
hello, i'm trying to use xdoclet to generate hibernate mapping
i have classes:

/**
*@hibernate.class table="TKeystone"
*/
class Keystone {
private Integer id;
/**
*@hibernate.id ...
// getter and setter
}
for this class mapping is generated correctly

/**
*@hibernate.joined-subclass table="TCast"
*/
class Cast extends Keystone {
...
}
for Cast class nothing was generated
how to write xdoclet for this class to generate the mapping???

thanks blaf


Top
 Profile  
 
 Post subject: Xdoclet for joined subclass
PostPosted: Sat Oct 08, 2005 1:20 am 
Newbie

Joined: Fri Oct 07, 2005 12:03 am
Posts: 3
You have to provide @hibernate.joined-subclass-key for the foreign key mapping.

See below for example:

// BASE CLASS

package com.paypod.cm.core.domain;

import com.paypod.cm.core.ObjectBase;

/**
* @hibernate.class table="corepersistencebase"
*/
public class CorePersistenceBase
extends ObjectBase
{

/**
* the persistent object id, must be unique
*/
private Long id;

/**
* the persistent object id, must be unique custom object - so id can be
* independent of types
*/
private PPId pID = new PPId();

public CorePersistenceBase()
{
super();
}

/**
* @hibernate.property insert="false" update="false"
* @hibernate.id generator-class="native" column="id"
*/
public Long getId()
{
return id;
}

public void setId(Long lId)
{
id = lId;
}

/**
* @return PPId
*
* @hibernate.component insert="false" update="false"
*/
public PPId getpID()
{
return pID;
}

public void setpID(PPId pId)
{
this.pID = pId;
}

}



// JOINED SUB-CLASS

package com.paypod.cm.core.domain;

/**
* @hibernate.joined-subclass table="user"
* @hibernate.joined-subclass-key column="id"
*/
public class User
extends CorePersistenceBase
{

protected String username;
protected String password;

public User()
{
}

public User(String username)
{
this.username = username;
}

/**
* Returns the username.
*
* @return String
*
* @hibernate.property
*/
public String getUsername()
{
return username;
}

/**
* Returns the password.
*
* @return String
*
* @hibernate.property
*/
public String getPassword()
{
return password;
}

/**
* Sets the username.
*
* @param username The username to set
*/
public void setUsername(String username)
{
this.username = username;
}

/**
* Sets the password.
*
* @param password The password to set
*/
public void setPassword(String password)
{
this.password = password;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 08, 2005 4:12 am 
Newbie

Joined: Thu Sep 22, 2005 5:17 pm
Posts: 11
yeah, the same i have, but ant script generates nothing, here is the script:

<target name="@generateHibernateMapping" depends="init">
<!-- Define the hibernatedoclet task -->
<taskdef name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask">
<classpath>
<fileset dir="${bec.xdoclet.lib}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</taskdef>

<!-- Execute the hibernatedoclet task -->
<hibernatedoclet
destdir="${src.hbm.dir}"
excludedtags="@version,@author,@todo"
mergedir="${src.hbm.dir}"
verbose="false">

<fileset dir="${src.java.dir}">
<include name="**/*.java"/>
</fileset>

<hibernate/>

</hibernatedoclet>
</target>

_________________
thanks
blaf


Top
 Profile  
 
 Post subject: make sure all source files are in xdoclet path
PostPosted: Mon Oct 10, 2005 12:02 am 
Newbie

Joined: Fri Oct 07, 2005 12:03 am
Posts: 3
Make sure all of the source files are in the path.

If no mapping is generated, either the source files are not fed in correctly..

or hibernate.class is missing at the class level tagging.

Also make sure if in case of inheritance mapping, check you are applying the right strategy.

table per class and table per subclass will use a single hbm file, and so all of the sources must be in the xdoclet path.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.