-->
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.  [ 5 posts ] 
Author Message
 Post subject: Generate equals() and hashCode()
PostPosted: Tue Mar 07, 2006 9:38 am 
Newbie

Joined: Fri Feb 24, 2006 9:15 am
Posts: 17
Hello,

I'm trying to get the equal and hashCode methods generated, but no luck so far.. Here's what I've put in the mapping file:

Hibernate tools version:
3.1 beta 4
Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 24-feb-2006 19:15:12 by Hibernate Tools 3.1.0.beta4 -->
<hibernate-mapping>
<class name="es.facturacion.om.PedidoDia" table="dalbas01">
<meta attribute="generated-class" inherit="false">
es.facturacion.hibernate.PedidoDiaBase
</meta>
<meta attribute="scope-class" inherit="false">
public abstract
</meta>
<composite-id name="id"
class="es.facturacion.om.PedidoDiaId">
<meta attribute="implement-equals"/>
<key-property name="cliente" type="string">
<meta attribute="use-in-equals"/>
<column name="cliente" length="12" />
</key-property>
<key-property name="fecha" type="java.lang.Integer">
<meta attribute="use-in-equals"/>
<column name="fecha" />
</key-property>
<key-property name="serie" type="string">
<meta attribute="use-in-equals"/>
<column name="serie" length="2" />
</key-property>
<key-property name="numero" type="java.lang.Integer">
<meta attribute="use-in-equals"/>
<column name="numero" />
</key-property>
</composite-id>
<property name="tdoc" type="string">
<column name="tdoc" length="12" />
</property>
<property name="tped" type="string">
<column name="tped" length="12" />
</property>
<property name="txtped" type="string">
<column name="txtped" length="50" />
</property>
<property name="hora" type="string">
<column name="hora" length="4" />
</property>
<property name="oper" type="string">
<column name="oper" length="12" />
</property>
<property name="bases" type="java.lang.Float">
<column name="bases" precision="4" scale="0" />
</property>
<property name="impuestos" type="java.lang.Float">
<column name="impuestos" precision="4" scale="0" />
</property>
<property name="lineas" type="java.lang.Integer">
<column name="lineas" />
</property>
<property name="linbon" type="java.lang.Integer">
<column name="linbon" />
</property>
<property name="linsin" type="java.lang.Integer">
<column name="linsin" />
</property>
<property name="linpar" type="java.lang.Integer">
<column name="linpar" />
</property>
<property name="unifal" type="java.lang.Integer">
<column name="unifal" />
</property>
<property name="unibon" type="java.lang.Integer">
<column name="unibon" />
</property>
<property name="uniser" type="java.lang.Integer">
<column name="uniser" />
</property>
<property name="rure" type="string">
<column name="rure" length="12" />
</property>
</class>
</hibernate-mapping>

Any suggestions?

Cheers, Bo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 2:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and es.facturacion.om.PedidoDiaId for which you have provided use-in-equals meta attributes does not contain any equals/hashcode impl ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 3:00 pm 
Newbie

Joined: Fri Feb 24, 2006 9:15 am
Posts: 17
No, no equal or hashCode code is generated, not in that class nor in another...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 4:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
maybe setting the value to true would help ? :)

<meta attribute="use-in-equals">true</meta>

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 08, 2006 5:51 am 
Newbie

Joined: Fri Feb 24, 2006 9:15 am
Posts: 17
Ok, that did the trick! Thanks, Bo


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.