-->
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: Ant (XDoclet) dies trying to build hbn files
PostPosted: Wed Jun 30, 2004 3:32 pm 
Newbie

Joined: Fri Jun 18, 2004 11:33 am
Posts: 6
Location: Pennsylvania, USA
I have a class with a composite PK that i'm using a separate PK class to implement. Seems to be an issue within XDoclet, but i'm not sure. Maybe somebody can catch my dumb error or otherwise move me in the right direction.

Role.java
package com.cimconsultants.STACS.hibernate;
import com.cimconsultants.STACS.hibernate.compositeKeys.RolePK;

/**
* Represents a Role from the database
*
* @hibernate.class table="UserRoles"
*
* @author Jason L. van Brackel
* @version 1.0
*/
public class Role {

private RolePK pk = null;
private String roleGroup = null;

public Role() {}

/**
* Return the Primary Key
*
* @hibernate.id generator-class = "assigned"
*
* @author Jason L. van Brackel
* @return String roleGroup
**/
public RolePK getPrimaryKey() {
if(pk == null) {
pk = new RolePK();
}
return pk;
}

/**
* Sets the roleGroup for this object
*
* @author Jason L. van Brackel
* @param String roleGrop
**/
public void setPrimaryKey(RolePK primaryKey) {
pk = primaryKey;
}



/**
* Return the Role Group (Roles)
*
* @hibernate.property column = "RoleGroup"
*
* @author Jason L. van Brackel
* @return String roleGroup
**/
public String getRoleGroup() {
return roleGroup;
}

/**
* Sets the roleGroup for this object
*
* @author Jason L. van Brackel
* @param String roleGrop
**/
public void setRoleGroup(String roleGroup) {
this.roleGroup = roleGroup;
}
}


RolePK.java

package com.cimconsultants.STACS.hibernate.compositeKeys;

import java.io.Serializable;

/**
* @author Jason L. van Brackel
*/
public class RolePK implements Serializable {
private String username;
private String role;

/**
* @hibernate.property column = "username"
* type = "string"
* not-null = "true"
* @author Jason
*/
public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

/**
* @hibernate.property column = "roles"
* type = "string"
* not-null = "true"
*
* @author Jason
*/
public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

public int hashCode() {
return this.hashCode();
}
}


XDoclet Stack Trace

Buildfile: C:\Working\STACS\WebApplication\build\build.xml
init:
generate-Hibernate:
[hibernatedoclet] (XDocletMain.start 47 ) Running <hibernate/>
[hibernatedoclet] Generating mapping file for com.cimconsultants.STACS.hibernate.Role.
[hibernatedoclet] com.cimconsultants.STACS.hibernate.Role
[hibernatedoclet] (TemplateEngine.invokeMethod 573 ) Invoking method failed: xdoclet.modules.hibernate.HibernateTagsHandler.ifHasCompositeId, line=132 of template file: jar:file:C:\eclipse-3.0\plugins\org.jboss.ide.eclipse.xdoclet.core_1.2.430\xdoclet-hibernate-module-1.2.1.jar!/xdoclet/modules/hibernate/resources/hibernate.xdt
[hibernatedoclet] java.lang.reflect.InvocationTargetException
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[hibernatedoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatedoclet] at java.lang.reflect.Method.invoke(Method.java:324)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:635)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:561)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:959)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:926)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:466)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:347)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:414)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:560)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:301)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[hibernatedoclet] Caused by: java.lang.NullPointerException
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:626)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasCompositeId(HibernateTagsHandler.java:173)
[hibernatedoclet] ... 27 more
[hibernatedoclet] xdoclet.template.TemplateException: Invoking method in class xdoclet.modules.hibernate.HibernateTagsHandler failed: ifHasCompositeId, line=132 of template file: jar:file:C:\eclipse-3.0\plugins\org.jboss.ide.eclipse.xdoclet.core_1.2.430\xdoclet-hibernate-module-1.2.1.jar!/xdoclet/modules/hibernate/resources/hibernate.xdt, exception: null
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:574)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:959)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:926)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:466)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:347)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:414)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:560)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:301)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[hibernatedoclet] (XDocletMain.start 53 ) Running XDoclet failed.
[hibernatedoclet] (XDocletMain.start 54 ) <<Running XDoclet failed.>>
[hibernatedoclet] xdoclet.template.TemplateException: Invoking method in class xdoclet.modules.hibernate.HibernateTagsHandler failed: ifHasCompositeId, line=132 of template file: jar:file:C:\eclipse-3.0\plugins\org.jboss.ide.eclipse.xdoclet.core_1.2.430\xdoclet-hibernate-module-1.2.1.jar!/xdoclet/modules/hibernate/resources/hibernate.xdt, exception: null
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:574)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:959)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:926)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:466)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:347)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:414)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:560)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:301)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[hibernatedoclet] C:\Working\STACS\WebApplication\build\build.xml:43: XDoclet failed.
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:465)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:301)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[hibernatedoclet] Caused by: xdoclet.XDocletException: Running XDoclet failed.
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:776)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] ... 8 more
[hibernatedoclet] --- Nested Exception ---
[hibernatedoclet] xdoclet.XDocletException: Running XDoclet failed.
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:776)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:301)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
[hibernatedoclet] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
BUILD FAILED: C:\Working\STACS\WebApplication\build\build.xml:43: Unexpected error
Total time: 1 second


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 11:10 am 
Newbie

Joined: Tue Feb 06, 2007 11:02 am
Posts: 5
You must override both the equals() method and the hashCode() method within your composite key class (RolePK)


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.