-->
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: XDoclet - Composite-id
PostPosted: Tue Aug 29, 2006 7:13 am 
Newbie

Joined: Mon Aug 28, 2006 4:09 pm
Posts: 6
Hi, I'm trying to create a compost primary key and this error is raised:

SEVERE: Invoking method failed: xdoclet.modules.hibernate.HibernateTagsHandler.ifHasCompositeId, line=169 of template file
...
Caused by: java.lang.NullPointerException

My code:


public class AcessoId implements Serializable{

// <editor-fold defaultstate="collapsed" desc=" Property: String id_usuario ">
private String id_usuario;
/**
* @hibernate.property
* column="id_usuario"
* @hibernate.column
* name="id_usuario"
*/
public String getId_usuario() {
return id_usuario;
}
public void setId_usuario(String id_usuario) {
this.id_usuario = id_usuario;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc=" Property: String cod_sist ">
private String cod_sist;
/**
* @hibernate.property
* column="cod_sist"
* @hibernate.column
* name="cod_sist"
*/
public String getCod_sist() {
return cod_sist;
}
public void setCod_sist(String cod_sist) {
this.cod_sist = cod_sist;
}
// </editor-fold>
}


package custom.entities ;
/**
*
*
* @hibernate.class
* table="acesso"
*
*/
public class Acesso {

// <editor-fold defaultstate="collapsed" desc=" PrimaryKey: custom.entities.AcessoId acessoId ">
private custom.entities.AcessoId acessoId;
/**
* @hibernate.id
* generator-class="assigned"
*/
public custom.entities.AcessoId getAcessoId () {
return acessoId;
}
public void setAcessoId (custom.entities.AcessoId acessoId) {
this.acessoId = acessoId;
}
//</editor-fold>


}
What's happening?

Thank's


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 8:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I don't use compound keys. Having said that this should work fine. I would suggest you look at the test with the version of Xdoclet (which we don't know) that you are using.


Top
 Profile  
 
 Post subject: Reason
PostPosted: Sun Jun 24, 2007 7:36 am 
Newbie

Joined: Tue May 15, 2007 4:10 am
Posts: 2
Hi!

I had the same problem, but I solved it.

If you implement/override the hashCode() , equals() methods in your
ID class than it will work.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 8:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Yes correct you do need to implement hashcode and equals.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.