ok no problem
my hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory name="factcan" >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:oracle:thin:@s1ora01s:1521:s1ora01i</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.username">factcan</property>
<property name="hibernate.connection.password">factcan</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for Oracle (any version) -->
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<!--
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
-->
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<mapping resource="Avinfoge.hbm.xml"/>
</session-factory>
</hibernate-configuration>
my hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="ca.canassistance.pojo">
<class
name="BaseAvinfoge"
table="AVINFOGE"
>
<composite-id name="id" class="ca.canassistance.pojo.AvinfogeId">
<key-property name="noGroupe" column="IG_NO_GROUPE" type="string" length="6"/>
<key-property name="noCertificat" column="IG_NO_CERTIFICAT" type="string" length="10"/>
<key-property name="dtEvenement" column="IG_DT_EVENEMENT" type="integer" length="8"/>
<key-property name="noDossier" column="IG_NO_DOSSIER" type="string" length="6"/>
</composite-id>
<property
name="doubleAss"
column="IG_ID_DOUBLE_ASS"
type="string"
not-null="false"
length="1"
/>
<property
name="groupeClient"
column="IG_GROUPE_CLIENT"
type="string"
not-null="false"
length="8"
/>
<property
name="noCertificatSam"
column="IG_NO_CERTIFICAT_SAM"
type="string"
not-null="false"
length="20"
/>
<property
name="idUser"
column="IG_ID_USER"
type="string"
not-null="false"
length="4"
/>
<property
name="dtModif"
column="IG_DT_MODIF"
type="integer"
not-null="false"
length="8"
/>
<property
name="idAccident"
column="IG_ID_ACCIDENT"
type="string"
not-null="false"
length="1"
/>
</class>
</hibernate-mapping>
and for finish
my class BaseAvinfoge
Code:
package pojo;
import java.io.Serializable;
import java.util.List;
import net.sf.hibernate.HibernateException;
import ca.canassistance.model.Avinfoge;
import ca.canassistance.model.dao.AvinfogeDAO;
/**
* This class has been automatically generated by Hibernate Synchronizer. For
* more information or documentation, visit The Hibernate Synchronizer page at
* http://www.binamics.com/hibernatesync or contact Joe Hudson at
* joe@binamics.com.
*
* This is an object that contains data related to the AVINFOGE table. Do not
* modify this class because it will be overwritten if the configuration file
* related to this class is modified.
*
* @hibernate.class table="AVINFOGE"
*/
public class BaseAvinfoge implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2444185467393453780L;
// fields
private java.lang.String doubleAss;
//private java.lang.Integer dtEvenement;
private java.lang.String groupeClient;
//private java.lang.String noDossier;
private java.lang.String noCertificatSam;
// private java.lang.String noCertificat;
// private java.lang.String noGroupe;
private java.lang.String idUser;
private java.lang.Integer dtModif;
private java.lang.String idAccident;
private AvinfogeId id;
private AvinfogeDAO dao;
// constructors
public BaseAvinfoge(String doubleAss, Integer dtEvenement,
String groupeClient, String noDossier, String noCertificatSam,
String noCertificat, String noGroupe, String idUser,
Integer dtModif, String idAccident)
{
AvinfogeId avinfogeId = new AvinfogeId();
avinfogeId.setDtEvenement(dtEvenement);
avinfogeId.setNoCertificat(noCertificat);
avinfogeId.setNoDossier(noDossier);
avinfogeId.setNoGroupe(noGroupe);
this.setDoubleAss(doubleAss);
this.setGroupeClient(groupeClient);
this.setNoCertificatSam(noCertificatSam);
this.setIdUser(idUser);
this.setDtModif(dtModif);
this.setIdAccident(idAccident);
this.setId(avinfogeId);
}
public BaseAvinfoge() {
initialize();
}
public BaseAvinfoge(Avinfoge avinfoge) {
AvinfogeId id = new AvinfogeId();
id.setDtEvenement(avinfoge.getDtEvenement());
id.setNoCertificat(avinfoge.getNoCertificat());
id.setNoDossier(avinfoge.getNoDossier());
id.setNoGroupe(avinfoge.getNoGroupe());
this.setId(id);
this.setDoubleAss(avinfoge.getIdDoubleAss());
//this.setDtModif(avinfoge.getModif);
this.setGroupeClient(avinfoge.getGroupeClient());
this.setIdAccident(avinfoge.getIdAccident());
this.setNoCertificatSam(avinfoge.getNoCertificatSam());
//avinfoge.getn
}
protected void initialize() {
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public java.lang.String getDoubleAss() {
return doubleAss;
}
public void setDoubleAss(java.lang.String doubleAss) {
this.doubleAss = doubleAss;
}
public java.lang.Integer getDtModif() {
return dtModif;
}
public void setDtModif(java.lang.Integer dtModif) {
this.dtModif = dtModif;
}
public java.lang.String getGroupeClient() {
return groupeClient;
}
public void setGroupeClient(java.lang.String groupeClient) {
this.groupeClient = groupeClient;
}
public AvinfogeId getId() {
return id;
}
public void setId(AvinfogeId id) {
this.id = id;
}
public java.lang.String getIdAccident() {
return idAccident;
}
public void setIdAccident(java.lang.String idAccident) {
this.idAccident = idAccident;
}
public java.lang.String getIdUser() {
return idUser;
}
public void setIdUser(java.lang.String idUser) {
this.idUser = idUser;
}
public java.lang.String getNoCertificatSam() {
return noCertificatSam;
}
public void setNoCertificatSam(java.lang.String noCertificatSam) {
this.noCertificatSam = noCertificatSam;
}
public boolean estDansLaBase(String cleDossier)
throws HibernateException {
if (dao == null)
this.setDao(new AvinfogeDAO());
List l = this.getDao().find(cleDossier);
if (l!=null)
return true;
return false;
}
public AvinfogeDAO getDao() {
return dao;
}
public void setDao(AvinfogeDAO dao) {
this.dao = dao;
}
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result
+ ((doubleAss == null) ? 0 : doubleAss.hashCode());
result = PRIME * result + ((dtModif == null) ? 0 : dtModif.hashCode());
result = PRIME * result
+ ((groupeClient == null) ? 0 : groupeClient.hashCode());
result = PRIME * result + ((id == null) ? 0 : id.hashCode());
result = PRIME * result
+ ((idAccident == null) ? 0 : idAccident.hashCode());
result = PRIME * result + ((idUser == null) ? 0 : idUser.hashCode());
result = PRIME * result
+ ((noCertificatSam == null) ? 0 : noCertificatSam.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final BaseAvinfoge other = (BaseAvinfoge) obj;
if (dao == null) {
if (other.dao != null)
return false;
} else if (!dao.equals(other.dao))
return false;
if (doubleAss == null) {
if (other.doubleAss != null)
return false;
} else if (!doubleAss.equals(other.doubleAss))
return false;
if (dtModif == null) {
if (other.dtModif != null)
return false;
} else if (!dtModif.equals(other.dtModif))
return false;
if (groupeClient == null) {
if (other.groupeClient != null)
return false;
} else if (!groupeClient.equals(other.groupeClient))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (idAccident == null) {
if (other.idAccident != null)
return false;
} else if (!idAccident.equals(other.idAccident))
return false;
if (idUser == null) {
if (other.idUser != null)
return false;
} else if (!idUser.equals(other.idUser))
return false;
if (noCertificatSam == null) {
if (other.noCertificatSam != null)
return false;
} else if (!noCertificatSam.equals(other.noCertificatSam))
return false;
return true;
}
}
and the id class AvinfogeId
Code:
package pojo;
import java.io.Serializable;
public class AvinfogeId implements Serializable {
/**
*
*/
private static final long serialVersionUID = -5624859234341440063L;
private Integer dtEvenement;
private String noDossier;
private String noCertificat;
private String noGroupe;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getDtEvenement() {
return dtEvenement;
}
public void setDtEvenement(Integer dtEvenement) {
this.dtEvenement = dtEvenement;
}
public String getNoCertificat() {
return noCertificat;
}
public void setNoCertificat(String noCertificat) {
this.noCertificat = noCertificat;
}
public String getNoDossier() {
return noDossier;
}
public void setNoDossier(String noDossier) {
this.noDossier = noDossier;
}
public String getNoGroupe() {
return noGroupe;
}
public void setNoGroupe(String noGroupe) {
this.noGroupe = noGroupe;
}
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((noCertificat == null) ? 0 : noCertificat.hashCode());
result = PRIME * result + ((noDossier == null) ? 0 : noDossier.hashCode());
result = PRIME * result + ((noGroupe == null) ? 0 : noGroupe.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final AvinfogeId other = (AvinfogeId) obj;
if (noCertificat == null) {
if (other.noCertificat != null)
return false;
} else if (!noCertificat.equals(other.noCertificat))
return false;
if (noDossier == null) {
if (other.noDossier != null)
return false;
} else if (!noDossier.equals(other.noDossier))
return false;
if (noGroupe == null) {
if (other.noGroupe != null)
return false;
} else if (!noGroupe.equals(other.noGroupe))
return false;
return true;
}
}