Pessoal, estou com o seguinte problema:
tenho uma classe com pk composta e tenho a classe DesprecPK que representa a pk assim:
package jfinances.model.bean;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* @hibernate.class
* table="DESPREC"
*
*/
public class Desprec implements Serializable {
/** identifier field */
private jfinances.model.bean.DesprecPK comp_id;
/** nullable persistent field */
private String documento;
/** persistent field */
private String descricao;
/** persistent field */
private Date dtrecord;
/** persistent field */
private Date vencimento;
/** nullable persistent field */
private Date liquidacao;
/** persistent field */
private BigDecimal valor;
/** persistent field */
private BigDecimal valororigem;
/** persistent field */
private BigDecimal saldo;
/** persistent field */
private String situacao;
/** nullable persistent field */
private jfinances.model.bean.Conta conta;
/** nullable persistent field */
private jfinances.model.bean.Grupodesprec grupodesprec;
/** persistent field */
private Set itempagrecs;
/** full constructor */
public Desprec(jfinances.model.bean.DesprecPK comp_id, String documento, String descricao, Date dtrecord, Date vencimento, Date liquidacao, BigDecimal valor, BigDecimal valororigem, BigDecimal saldo, String situacao, jfinances.model.bean.Conta conta, jfinances.model.bean.Grupodesprec grupodesprec, Set itempagrecs) {
this.comp_id = comp_id;
this.documento = documento;
this.descricao = descricao;
this.dtrecord = dtrecord;
this.vencimento = vencimento;
this.liquidacao = liquidacao;
this.valor = valor;
this.valororigem = valororigem;
this.saldo = saldo;
this.situacao = situacao;
this.conta = conta;
this.grupodesprec = grupodesprec;
this.itempagrecs = itempagrecs;
}
/** default constructor */
public Desprec() {
}
/** minimal constructor */
public Desprec(jfinances.model.bean.DesprecPK comp_id, String descricao, Date dtrecord, Date vencimento, BigDecimal valor, BigDecimal valororigem, BigDecimal saldo, String situacao, Set itempagrecs) {
this.comp_id = comp_id;
this.descricao = descricao;
this.dtrecord = dtrecord;
this.vencimento = vencimento;
this.valor = valor;
this.valororigem = valororigem;
this.saldo = saldo;
this.situacao = situacao;
this.itempagrecs = itempagrecs;
}
/**
* @hibernate.id
* generator-class="assigned"
*
*/
public jfinances.model.bean.DesprecPK getComp_id() {
return this.comp_id;
}
public void setComp_id(jfinances.model.bean.DesprecPK comp_id) {
this.comp_id = comp_id;
}
/**
* @hibernate.property
* column="DOCUMENTO"
* length="20"
*
*/
public String getDocumento() {
return this.documento;
}
public void setDocumento(String documento) {
this.documento = documento;
}
/**
* @hibernate.property
* column="DESCRICAO"
* length="60"
* not-null="true"
*
*/
public String getDescricao() {
return this.descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
/**
* @hibernate.property
* column="DTRECORD"
* length="19"
* not-null="true"
*
*/
public Date getDtrecord() {
return this.dtrecord;
}
public void setDtrecord(Date dtrecord) {
this.dtrecord = dtrecord;
}
/**
* @hibernate.property
* column="VENCIMENTO"
* length="10"
* not-null="true"
*
*/
public Date getVencimento() {
return this.vencimento;
}
public void setVencimento(Date vencimento) {
this.vencimento = vencimento;
}
/**
* @hibernate.property
* column="LIQUIDACAO"
* length="10"
*
*/
public Date getLiquidacao() {
return this.liquidacao;
}
public void setLiquidacao(Date liquidacao) {
this.liquidacao = liquidacao;
}
/**
* @hibernate.property
* column="VALOR"
* length="15"
* not-null="true"
*
*/
public BigDecimal getValor() {
return this.valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
/**
* @hibernate.property
* column="VALORORIGEM"
* length="15"
* not-null="true"
*
*/
public BigDecimal getValororigem() {
return this.valororigem;
}
public void setValororigem(BigDecimal valororigem) {
this.valororigem = valororigem;
}
/**
* @hibernate.property
* column="SALDO"
* length="15"
* not-null="true"
*
*/
public BigDecimal getSaldo() {
return this.saldo;
}
public void setSaldo(BigDecimal saldo) {
this.saldo = saldo;
}
/**
* @hibernate.property
* column="SITUACAO"
* length="1"
* not-null="true"
*
*/
public String getSituacao() {
return this.situacao;
}
public void setSituacao(String situacao) {
this.situacao = situacao;
}
/**
* @hibernate.many-to-one
* update="false"
* insert="false"
*
* @hibernate.column
* name="CONTA"
*
*/
public jfinances.model.bean.Conta getConta() {
return this.conta;
}
public void setConta(jfinances.model.bean.Conta conta) {
this.conta = conta;
}
/**
* @hibernate.many-to-one
* update="false"
* insert="false"
*
* @hibernate.column
* name="GRUPO"
*
*/
public jfinances.model.bean.Grupodesprec getGrupodesprec() {
return this.grupodesprec;
}
public void setGrupodesprec(jfinances.model.bean.Grupodesprec grupodesprec) {
this.grupodesprec = grupodesprec;
}
/**
* @hibernate.set
* lazy="true"
* inverse="true"
* cascade="none"
* @hibernate.collection-key
* column="CONTA"
* @hibernate.collection-key
* column="LANCAMENTO"
* @hibernate.collection-key
* column="PARCELA"
* @hibernate.collection-key
* column="GRUPO"
* @hibernate.collection-one-to-many
* class="jfinances.model.bean.Itempagrec"
*
*/
public Set getItempagrecs() {
return this.itempagrecs;
}
public void setItempagrecs(Set itempagrecs) {
this.itempagrecs = itempagrecs;
}
public String toString() {
return new ToStringBuilder(this)
.append("comp_id", getComp_id())
.toString();
}
public boolean equals(Object other) {
if ( !(other instanceof Desprec) ) return false;
Desprec castOther = (Desprec) other;
return new EqualsBuilder()
.append(this.getComp_id(), castOther.getComp_id())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getComp_id())
.toHashCode();
}
}
quando vou fazer uma consulta querendo somente o numero de lancamento da despesa nao está me retornando nada, retorna null... se eu faço a consulta em uma classe q tem chave normal retorna blz.. alguem sabe oq é isso e como posso fazer pra contornar esse problema, se é q é um problema? valeu
