Hibernate version:
3.1.3
Mapping documents:
Code:
<class name="sic.business.Socio" table="socio" dynamic-insert="true" dynamic-update="true" lazy="false" batch-size="10">
<cache usage="read-write"/>
<id name="id" type="long" column="soc_id">
<!-- <generator class="identity"/> -->
<generator class="assigned"/>
</id>
<version name="version" column="soc_version" type="int"/>
<!-- Proprietà fondamentali -->
<property name="titolo" column="soc_titolo" type="string"/>
<property name="nome" column="soc_nome" type="string" not-null="true"/>
<property name="cognome" column="soc_cognome" type="string" not-null="true"/>
<property name="nomeCompleto" formula="CONCAT(soc_cognome,' ',soc_nome)" />
<property name="sesso" column="soc_sesso" type="gender" not-null="true"/>
<property name="comuneNascita" column="soc_nascita_comune" type="string"/>
<many-to-one name="provinciaNascita" column="prv_nascita_sigla" class="sic.business.Provincia" fetch="join" />
<many-to-one name="paeseNascita" column="pse_nascita_sigla" class="sic.business.Paese" fetch="join" />
<property name="dataNascita" column="soc_nascita_data" type="date" not-null="true"/>
<property name="codiceFiscale" column="soc_codice_fiscale" type="string" unique="true"/>
<!-- informazioni sulla vita opzionali -->
<many-to-one name="professione" column="prf_id" class="sic.business.Professione" fetch="join" />
<many-to-one name="settore" column="stt_id" class="sic.business.Settore" fetch="join"/>
<many-to-one name="titoloStudio" column="tst_id" class="sic.business.TitoloStudio" fetch="join"/>
<property name="societa" column="soc_societa" type="string"/>
<property name="societaWeb" column="soc_sito_societa" type="string"/>
<!-- contatti necessari -->
<many-to-one name="provincia" column="prv_sigla" class="sic.business.Provincia" fetch="join" />
<many-to-one name="paese" column="pse_sigla" class="sic.business.Paese" fetch="join" />
<property name="comune" column="soc_comune" type="string" />
<property name="cap" column="soc_cap" type="string"/>
<property name="domicilio" column="soc_indirizzo" type="string" />
<property name="email" column="soc_email" type="string" unique="true" not-null="false" />
<list name="telefoni" cascade="all-delete-orphan" fetch="join">
<key column="soc_id" not-null="true"/>
<list-index column="tlf_idx"/>
<composite-element class="sic.business.Telefono">
<property name="numero" type="string" column="tlf_numero" not-null="true" />
<property name="note" type="string" column="tlf_note" not-null="false"/>
<property name="tipo" type="tipoTelefono" column="tlf_tipo" not-null="true"/>
</composite-element>
</list>
<!-- informazioni sullo stato -->
<many-to-one name="tipo" column="tpo_id" class="sic.business.TipoSocio" not-null="true" fetch="join" />
<many-to-one name="conto" column="cnt_id" class="sic.business.Conto" unique="true" not-null="false" cascade="none" fetch="join"/>
<many-to-one name="sport" column="spr_id" class="sic.business.Sport" fetch="join" />
<property name="iscritto" type="boolean" column="soc_iscritto"/>
<property name="dataPrimaIscrizione" type="date" column="soc_data_prima_iscrizione"/>
<property name="dataIscrizione" type="date" column="soc_data_iscrizione" not-null="true"/>
<property name="dataDimissioni" type="date" column="soc_data_dimissioni"/>
<property name="assente" type="boolean" column="soc_assente" not-null="true"/>
<property name="dataAssenza" type="date" column="soc_data_assenza"/>
<property name="sospeso" column="soc_sospeso" type="boolean" not-null="true"/>
<property name="sociPresentatori" column="soc_soci_presentatori" type="string"/>
<!-- funzioni particolari -->
<!-- <many-to-one name="user" column="usr_id" unique="true" not-null="false"/> -->
<property name="note" column="soc_note" type="string" not-null="false"/>
<property name="diffusione" column="soc_diffusione" type="boolean" not-null="true"/>
<bag name="richieste" inverse="true" >
<key column="soc_id" not-null="true"/>
<one-to-many class="sic.business.Richiesta"/>
</bag>
</class>
the classes are:
Code:
public class Telefono {
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
this);
private String numero;
private String note;
private TipoTelefono tipo;
/**
* Default costructor
*/
public Telefono() {
}
public Telefono(TipoTelefono tipo, String numero, String note) {
this.tipo = tipo;
this.numero = numero;
this.note = note;
}
public String getNote() {
return note;
}
public void setNote(String note) {
Object old = this.note;
this.note = note;
changeSupport.firePropertyChange("note", old, note);
}
public String getNumero() {
return numero;
}
public void setNumero(String numero) {
Object old = this.numero;
this.numero = numero;
changeSupport.firePropertyChange("numero", old, numero);
}
public TipoTelefono getTipo() {
return tipo;
}
public void setTipo(TipoTelefono tipo) {
Object old = this.tipo;
this.tipo = tipo;
changeSupport.firePropertyChange("tipo", old, tipo);
}
public void addPropertyChangeListener(PropertyChangeListener l) {
changeSupport.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changeSupport.removePropertyChangeListener(l);
}
/* Commons methods */
/*
* public boolean equals(Object obj) { boolean res = false;
*
* if (obj instanceof Telefono) { Telefono other = (Telefono) obj;
*
* res = id == other.id;
*
* if (res && id == null) res = super.equals(other); }
*
* return res; }
*
* public int hashCode() { if (id != null) return getClass().hashCode() +
* getId().hashCode(); else return super.hashCode(); }
*
*/
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(numero);
if (note != null) {
sb.append(" (").append(note).append(")");
}
return sb.toString();
}
public boolean equals(Object obj) {
if (obj instanceof Telefono == false) {
return false;
}
if (this == obj) {
return true;
}
Telefono other = (Telefono) obj;
return new EqualsBuilder().append(numero, other.numero).append(tipo,
other.tipo).append(note, other.note).isEquals();
}
public int hashCode() {
return new HashCodeBuilder().append(Telefono.class).append(numero)
.append(tipo).toHashCode();
}
and:
Code:
package sic.business;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.VetoableChangeListener;
import java.beans.VetoableChangeSupport;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.hibernate.annotations.AccessType;
import org.hibernate.annotations.Formula;
/**
*
* @author Filippo De Luca
* @version 1.0.00
*
* FIXME Creare una classe che testa le proprietà
*/
@Table(name = "socio")
@Entity
public class Socio implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
this);
private VetoableChangeSupport vetos = new VetoableChangeSupport(this);
@Id
@Column(name = "soc_id")
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@Version
@Column(name = "soc_version")
private int version;
@Basic(fetch = FetchType.EAGER)
@Column(name = "soc_titolo")
private String titolo;
@Basic(fetch = FetchType.EAGER)
@Column(name = "soc_nome")
private String nome;
@Basic(fetch = FetchType.EAGER)
@Column(name = "soc_cognome")
private String cognome;
@Basic
@Formula(value = "CONCAT(soc_cognome, ' ', soc_nome")
private String nomeCompleto;
@Basic
@Column(name = "soc_sesso")
private Gender sesso;
@Basic
@Column(name = "soc_codice_fiscale")
private String codiceFiscale;
/**
* Mapping da definire
*/
@OneToMany
@org.hibernate.annotations.CollectionOfElements
private List telefoni;
@Basic
@Column(name = "soc_email")
private String email;
@Basic
@Column(name = "soc_societa")
private String societa;
@Basic
@Column(name = "soc_email")
private String societaWeb;
@Basic
@Column(name = "soc_note")
private String note;
private String sociPresentatori;
private String comuneNascita;
private Paese paeseNascita;
private Professione professione;
@ManyToOne(targetEntity = Provincia.class, fetch = FetchType.LAZY)
@Column(name = "prv_nascita_sigla")
private Provincia provinciaNascita;
@ManyToOne(targetEntity = Settore.class, fetch = FetchType.LAZY)
@Column(name = "prv_nascita_sigla")
private Settore settore;
@ManyToOne(targetEntity = TitoloStudio.class, fetch = FetchType.LAZY)
@Column(name = "prv_nascita_sigla")
private TitoloStudio titoloStudio;
@Basic
@Column(name = "soc_comune")
private String comune;
@ManyToOne(targetEntity = Provincia.class, fetch = FetchType.LAZY)
@Column(name = "prv_sigla")
private Provincia provincia;
@ManyToOne(targetEntity = Paese.class, fetch = FetchType.LAZY)
@Column(name = "pse_sigla")
private Paese paese;
@Basic
@Column(name = "soc_cap")
private String cap;
private String domicilio;
private boolean diffusione;
private TipoSocio tipo;
private Conto conto;
private Sport sport;
private boolean assente;
private Date dataAssenza;
private Date dataNascita;
private boolean iscritto;
private Date dataPrimaIscrizione;
private Date dataIscrizione;
private Date dataDimissioni;
private boolean sospeso;
private Badge badge;
private User user;
private List<Richiesta> richieste;
public Socio() {
//telefoni = new ArrayList<Telefono>();
}
public void setId(Long id) {
Long oldId = this.id;
this.id = id;
changeSupport.firePropertyChange("id", oldId, id);
}
protected void setVersion(int version) {
int oldVersion = this.version;
this.version = version;
changeSupport.firePropertyChange("version",oldVersion,version);
}
public void setNome(String nome) {
String oldNome = this.nome;
this.nome = nome;
changeSupport.firePropertyChange("nome", oldNome, nome);
}
public void setCognome(String cognome) {
String oldCognome = this.cognome;
this.cognome = cognome;
changeSupport.firePropertyChange("cognome", oldCognome, cognome);
}
public String getNomeCompleto() {
return nomeCompleto;
}
public void setNomeCompleto(String nomeCompleto) {
Object old = this.nomeCompleto;
this.nomeCompleto = nomeCompleto;
}
public void setSesso(Gender sesso) {
Gender oldSesso = this.sesso;
this.sesso = sesso;
changeSupport.firePropertyChange("sesso", oldSesso, sesso);
}
public void setPaeseNascita(Paese paeseNascita) {
Paese old = this.paeseNascita;
this.paeseNascita = paeseNascita;
changeSupport.firePropertyChange("paeseNascita", old, paeseNascita);
}
public void setDataNascita(Date dataNascita) {
Date old = this.dataNascita;
this.dataNascita = dataNascita;
changeSupport.firePropertyChange("dataNascita", old, dataNascita);
}
public void setProvinciaNascita(Provincia provinciaNascita) {
Provincia old = this.provincia;
this.provinciaNascita = provinciaNascita;
changeSupport.firePropertyChange("provinciaNascita", old, provinciaNascita);
}
public void setComuneNascita(String comuneNascita) {
String old = this.comuneNascita;
this.comuneNascita = comuneNascita;
changeSupport.firePropertyChange("comuneNascita", old, comuneNascita);
}
public void setCodiceFiscale(String codiceFiscale) {
String old = this.codiceFiscale;
this.codiceFiscale = codiceFiscale;
changeSupport.firePropertyChange("codiceFiscale",old,codiceFiscale);
}
public void setTitolo(String titolo) {
String old = this.titolo;
this.titolo = titolo;
changeSupport.firePropertyChange("titolo",old,titolo);
}
public void setSocieta(String societa) {
String old = this.societa;
this.societa = societa;
changeSupport.firePropertyChange("societa",old,societa);
}
public void setProfessione(Professione professione) {
Professione old = this.professione;
this.professione = professione;
changeSupport.firePropertyChange("professione",old,professione);
}
public void setSettore(Settore settore) {
Settore old = this.settore;
this.settore = settore;
changeSupport.firePropertyChange("settore",old,settore);
}
public void setSocietaWeb(String societaWeb) {
String old = this.societaWeb;
this.societaWeb = societaWeb;
changeSupport.firePropertyChange("societaWeb",old,societaWeb);
}
public void setTitoloStudio(TitoloStudio titoloStudio) {
TitoloStudio old = this.titoloStudio;
this.titoloStudio = titoloStudio;
changeSupport.firePropertyChange("titoloStudio",old,titoloStudio);
}
public void setEmail(String email) {
/* FIXME è un workarround finké nn trovo una soluzione migliore */
if(email!=null&&email.trim().length()==0)
email=null;
String old = this.email;
this.email = email;
changeSupport.firePropertyChange("email",old,email);
}
public void setTelefoni(List telefoni){
List old = this.telefoni;
this.telefoni = telefoni;
changeSupport.firePropertyChange("telefoni",old,telefoni);
}
public void setComune(String comune) {
String old = this.comune;
this.comune = comune;
changeSupport.firePropertyChange("comune",old,comune);
}
public void setPaese(Paese paese) {
Paese old = this.paese;
this.paese = paese;
changeSupport.firePropertyChange("paese",old,paese);
}
public void setProvincia(Provincia provincia) {
Provincia old = this.provincia;
this.provincia = provincia;
changeSupport.firePropertyChange("provincia",old,provincia);
}
public void setDomicilio(String domicilio) {
String old = this.domicilio;
this.domicilio = domicilio;
changeSupport.firePropertyChange("domicilio",old,domicilio);
}
public void setCap(String cap) {
String old = this.cap;
this.cap = cap;
changeSupport.firePropertyChange("cap",old,cap);
}
public void setNote(String note) {
String old = this.note;
this.note = note;
changeSupport.firePropertyChange("note",old,note);
}
public void setIscritto(boolean iscritto) {
boolean old = this.iscritto;
this.iscritto = iscritto;
changeSupport.firePropertyChange("iscritto",old,iscritto);
}
public void setDataIscrizione(Date dataIscrizione) {
Date old = this.dataIscrizione;
this.dataIscrizione = dataIscrizione;
changeSupport.firePropertyChange("dataIscrizione",old,dataIscrizione);
}
public void setDataPrimaIscrizione(Date dataPrimaIscrizione) {
Date old = this.dataPrimaIscrizione;
this.dataPrimaIscrizione = dataPrimaIscrizione;
changeSupport.firePropertyChange("dataPrimaIscrizione",old,dataPrimaIscrizione);
}
public void setDataDimissioni(Date dataDimissioni) {
Date old = this.dataDimissioni;
this.dataDimissioni = dataDimissioni;
changeSupport.firePropertyChange("dataDimissioni",old,dataDimissioni);
}
public void setSociPresentatori(String sociPresentatori) {
String old = this.sociPresentatori;
this.sociPresentatori = sociPresentatori;
changeSupport.firePropertyChange("sociPresentatori",old,sociPresentatori);
}
public void setTipo(TipoSocio tipo) {
TipoSocio old = this.tipo;
this.tipo = tipo;
changeSupport.firePropertyChange("tipo",old,tipo);
}
public void setSport(Sport sport) {
Sport old = this.sport;
this.sport = sport;
changeSupport.firePropertyChange("sport",old,sport);
}
public void setAssente(boolean assente) {
boolean old = this.assente;
this.assente = assente;
changeSupport.firePropertyChange("assente",old,assente);
}
public void setDataAssenza(Date dataAssenza) {
Date old = this.dataAssenza;
this.dataAssenza = dataAssenza;
changeSupport.firePropertyChange("dataAssenza",old,dataAssenza);
}
public void setSospeso(boolean sospeso) {
boolean old = this.sospeso;
this.sospeso = sospeso;
changeSupport.firePropertyChange("sospeso",old,sospeso);
}
public void setDiffusione(boolean diffusione) {
boolean old = this.diffusione;
this.diffusione = diffusione;
changeSupport.firePropertyChange("diffusione",old,diffusione);
}
public void setConto(Conto conto) {
Conto oldConto = this.conto;
this.conto = conto;
changeSupport.firePropertyChange("conto",oldConto,conto);
}
public void setUser(User user) {
User old = this.user;
this.user = user;
changeSupport.firePropertyChange("user",old,user);
}
public void setBadge(Badge badge) {
Badge old = this.badge;
this.badge = badge;
changeSupport.firePropertyChange("badge",old,badge);
}
/* Getters */
public Long getId() {
return id;
}
public String getNome() {
return nome;
}
public String getCognome() {
return cognome;
}
public String getCodiceFiscale() {
return codiceFiscale;
}
public Conto getConto() {
return conto;
}
public String getEmail() {
return email;
}
public String getTitolo() {
return titolo;
}
public Gender getSesso() {
return sesso;
}
public int getVersion() {
return version;
}
public String getSocieta() {
return societa;
}
public Professione getProfessione() {
return professione;
}
public TipoSocio getTipo() {
return tipo;
}
public Sport getSport() {
return sport;
}
public Settore getSettore() {
return settore;
}
public String getSocietaWeb() {
return societaWeb;
}
public List getTelefoni(){
return this.telefoni;
}
public TitoloStudio getTitoloStudio() {
return titoloStudio;
}
public String getNote() {
return note;
}
public String getSociPresentatori() {
return sociPresentatori;
}
public java.util.Date getDataNascita() {
return dataNascita;
}
public Paese getPaeseNascita() {
return paeseNascita;
}
public Provincia getProvinciaNascita() {
return provinciaNascita;
}
public String getComuneNascita() {
return comuneNascita;
}
public String getComune() {
return comune;
}
public Provincia getProvincia() {
return provincia;
}
public Paese getPaese() {
return paese;
}
public String getCap() {
return cap;
}
public String getDomicilio() {
return domicilio;
}
public boolean isDiffusione() {
return diffusione;
}
public boolean isAssente() {
return assente;
}
public Date getDataAssenza() {
return dataAssenza;
}
public boolean isIscritto() {
return iscritto;
}
public Date getDataPrimaIscrizione() {
return dataPrimaIscrizione;
}
public Date getDataDimissioni() {
return dataDimissioni;
}
public boolean isSospeso() {
return sospeso;
}
public Date getDataIscrizione() {
return dataIscrizione;
}
public User getUser() {
return user;
}
public Badge getBadge() {
return badge;
}
/* Access methods */
public void addTelefono(Telefono telefono){
int index = telefoni.size();
this.telefoni.add(telefono);
changeSupport.fireIndexedPropertyChange("telefoni",index,null,telefono);
}
public void removeTelefono(Telefono telefono){
this.telefoni.remove(telefono);
changeSupport.firePropertyChange("telefoni",null,telefoni);
}
/* JavaBean methods */
public void addPropertyChangeListener(PropertyChangeListener l) {
changeSupport.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
changeSupport.removePropertyChangeListener(l);
}
public void addVetoableChangeListener(VetoableChangeListener l) {
vetos.addVetoableChangeListener(l);
}
public void removeVetoableChangeListener(VetoableChangeListener l) {
vetos.removeVetoableChangeListener(l);
}
/* Commons methods */
public boolean equals(Object obj) {
boolean res = false;
if (id != null) {
if (obj instanceof Socio) {
Socio other = (Socio) obj;
res = id.equals(other.id);
}
} else {
res = super.equals(obj);
}
return res;
}
public int hashCode() {
if (id != null)
return getClass().hashCode() + getId().hashCode();
else
return super.hashCode();
}
/* Business Methods */
public void addebitaQuota(double quota) {
throw new UnsupportedOperationException();
}
public List<Richiesta> getRichieste() {
return richieste;
}
public void setRichieste(List<Richiesta> richieste) {
Object old = this.richieste;
this.richieste = richieste;
changeSupport.firePropertyChange("richieste", old, richieste);
}
}
<b>I've this problem:</b>
When i do a query like:
Code:
public List<Socio> findByBirthday(Date byrthday) {
Calendar date = GregorianCalendar.getInstance();
date.setTime(byrthday);
Criterion criterion = Restrictions.conjunction()
.add(Restrictions.sqlRestriction("MONTH({alias}.soc_nascita_data) = " + (date.get(Calendar.MONTH) + 1)))
.add(Restrictions.sqlRestriction("DAY({alias}.soc_nascita_data) = " + date.get(Calendar.DATE)));
return findByCriterion(criterion);
}
the resulting sql is:
Code:
SELECT this_.soc_id AS soc1_0_12_, this_.soc_version AS soc2_0_12_, this_.soc_titolo AS soc3_0_12_, this_.soc_nome AS soc4_0_12_, this_.soc_cognome AS soc5_0_12_, this_.soc_sesso AS soc6_0_12_, this_.soc_nascita_comune AS soc7_0_12_, this_.prv_nascita_sigla AS prv8_0_12_, this_.pse_nascita_sigla AS pse9_0_12_, this_.soc_nascita_data AS soc10_0_12_, this_.soc_codice_fiscale AS soc11_0_12_, this_.prf_id AS prf12_0_12_, this_.stt_id AS stt13_0_12_, this_.tst_id AS tst14_0_12_, this_.soc_societa AS soc15_0_12_, this_.soc_sito_societa AS soc16_0_12_, this_.prv_sigla AS prv17_0_12_, this_.pse_sigla AS pse18_0_12_, this_.soc_comune AS soc19_0_12_, this_.soc_cap AS soc20_0_12_, this_.soc_indirizzo AS soc21_0_12_, this_.soc_email AS soc22_0_12_, this_.tpo_id AS tpo23_0_12_, this_.cnt_id AS cnt24_0_12_, this_.spr_id AS spr25_0_12_, this_.soc_iscritto AS soc26_0_12_, this_.soc_data_prima_iscrizione AS soc27_0_12_, this_.soc_data_iscrizione AS soc28_0_12_, this_.soc_data_dimissioni AS soc29_0_12_, this_.soc_assente AS soc30_0_12_, this_.soc_data_assenza AS soc31_0_12_, this_.soc_sospeso AS soc32_0_12_, this_.soc_soci_presentatori AS soc33_0_12_, this_.soc_note AS soc34_0_12_, this_.soc_diffusione AS soc35_0_12_, CONCAT( this_.soc_cognome, ' ', this_.soc_nome ) AS formula0_12_, provincia2_.prv_sigla AS prv1_3_0_, provincia2_.prv_nome AS prv2_3_0_, paese3_.pse_sigla AS pse1_7_1_, paese3_.pse_nome AS pse2_7_1_, profession4_.prf_id AS prf1_4_2_, profession4_.prf_nome AS prf2_4_2_, settore5_.stt_id AS stt1_5_3_, settore5_.stt_nome AS stt2_5_3_, titolostud6_.tst_id AS tst1_6_4_, titolostud6_.tst_nome AS tst2_6_4_, provincia7_.prv_sigla AS prv1_3_5_, provincia7_.prv_nome AS prv2_3_5_, paese8_.pse_sigla AS pse1_7_6_, paese8_.pse_nome AS pse2_7_6_, telefoni9_.soc_id AS soc1_14_, telefoni9_.tlf_numero AS tlf2_14_, telefoni9_.tlf_note AS tlf3_14_, telefoni9_.tlf_tipo AS tlf4_14_, telefoni9_.tlf_idx AS tlf5_14_, tiposocio10_.tpo_id AS tpo1_2_7_, tiposocio10_.tpo_descrizione AS tpo2_2_7_, tiposocio10_.tpo_assente AS tpo3_2_7_, tiposocio10_.tpo_sport AS tpo4_2_7_, conto11_.cnt_id AS cnt1_9_8_, conto11_.cnt_descrizione AS cnt2_9_8_, conto11_.cnt_codice AS cnt3_9_8_, conto11_.cnt_ecc_dare AS cnt4_9_8_, conto11_.cnt_ecc_avere AS cnt5_9_8_, conto11_.cnt_tipo AS cnt6_9_8_, conto11_.mst_id AS mst7_9_8_, mastro12_.mst_id AS mst1_15_9_, mastro12_.mst_codice AS mst2_15_9_, mastro12_.mst_descrizione AS mst3_15_9_, sport13_.spr_id AS spr1_14_10_, sport13_.cnt_id AS cnt2_14_10_, sport13_.spr_nome AS spr3_14_10_, conto14_.cnt_id AS cnt1_9_11_, conto14_.cnt_descrizione AS cnt2_9_11_, conto14_.cnt_codice AS cnt3_9_11_, conto14_.cnt_ecc_dare AS cnt4_9_11_, conto14_.cnt_ecc_avere AS cnt5_9_11_, conto14_.cnt_tipo AS cnt6_9_11_, conto14_.mst_id AS mst7_9_11_
FROM socio this_
LEFT OUTER JOIN provincia provincia2_ ON this_.prv_nascita_sigla = provincia2_.prv_sigla
LEFT OUTER JOIN paese paese3_ ON this_.pse_nascita_sigla = paese3_.pse_sigla
LEFT OUTER JOIN professione profession4_ ON this_.prf_id = profession4_.prf_id
LEFT OUTER JOIN settore settore5_ ON this_.stt_id = settore5_.stt_id
LEFT OUTER JOIN titolo_studio titolostud6_ ON this_.tst_id = titolostud6_.tst_id
LEFT OUTER JOIN provincia provincia7_ ON this_.prv_sigla = provincia7_.prv_sigla
LEFT OUTER JOIN paese paese8_ ON this_.pse_sigla = paese8_.pse_sigla
LEFT OUTER JOIN telefoni telefoni9_ ON this_.soc_id = telefoni9_.soc_id
INNER JOIN tipo_soci tiposocio10_ ON this_.tpo_id = tiposocio10_.tpo_id
LEFT OUTER JOIN conto conto11_ ON this_.cnt_id = conto11_.cnt_id
LEFT OUTER JOIN mastro mastro12_ ON conto11_.mst_id = mastro12_.mst_id
LEFT OUTER JOIN sport sport13_ ON this_.spr_id = sport13_.spr_id
LEFT OUTER JOIN conto conto14_ ON sport13_.cnt_id = conto14_.cnt_id
WHERE (
MONTH( this_.soc_nascita_data ) =5
AND DAY( this_.soc_nascita_data ) =10
)
I obtain duplicate records if i remove the list of Telefoni this not appened. I think is a problem of equals() in sic.business.Telefono but it isn't.
Anyone has some ideas?