hi everyone
this is my class
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.base.BaseAvinfogeDAO;
/**
* 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.String groupeClient;
private java.lang.String noCertificatSam;
private java.lang.String idUser;
private java.lang.Integer dtModif;
private java.lang.String idAccident;
private AvinfogeId id;
private BaseAvinfogeDAO 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.trim());
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().trim());
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 BaseAvinfogeDAO());
List l = this.getDao().find(cleDossier);
if (l != null)
return true;
return false;
}
public BaseAvinfogeDAO getDao() {
return dao;
}
public void setDao(BaseAvinfogeDAO 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;
}
}
this is my comp id
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;
}
}
and my hbm
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>
hibernate conf
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>
and my delete method
Code:
public void delete(ca.canassistance.pojo.BaseAvinfoge avinfoge)
throws net.sf.hibernate.HibernateException {
Session session = null;
Transaction tx = null;
try {
session = HibernateUtil.currentSession();
tx = session.beginTransaction();
[b]int nb = session.delete("from BaseAvinfoge as base where base.id.noDossier = '425363'");[/b]
[b]ou int nb = session.delete(avinfoge);[/b]
tx.commit();
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
throw new ServiceException(e.getMessage(), e);
}
finally {
HibernateUtil.closeSession();
}
}
everything looking good
in my table de data of No_groupe is null
but my pojo.No_groupe is null to
this is one of the my attribute comp id
when I call my method delete nothing is delete
even it return 1 without throwing exception.
I don t understands what happening
the is the console show
Quote:
17:03:04,913 DEBUG QueryTranslator:207 - HQL: from pojo.BaseAvinfoge as base where base.id.noDossier = '425363'
17:03:04,913 DEBUG QueryTranslator:208 - SQL: select baseavinfo0_.IG_NO_GROUPE as IG_NO_GR1_, baseavinfo0_.IG_NO_CERTIFICAT as IG_NO_CE2_, baseavinfo0_.IG_DT_EVENEMENT as IG_DT_EV3_, baseavinfo0_.IG_NO_DOSSIER as IG_NO_DO4_, baseavinfo0_.IG_ID_DOUBLE_ASS as IG_ID_DO5_, baseavinfo0_.IG_GROUPE_CLIENT as IG_GROUP6_, baseavinfo0_.IG_NO_CERTIFICAT_SAM as IG_NO_CE7_, baseavinfo0_.IG_ID_USER as IG_ID_USER, baseavinfo0_.IG_DT_MODIF as IG_DT_MO9_, baseavinfo0_.IG_ID_ACCIDENT as IG_ID_A10_ from AVINFOGE baseavinfo0_ where (baseavinfo0_.IG_NO_DOSSIER='425363' )
17:03:04,913 DEBUG BatcherImpl:204 - about to open: 0 open PreparedStatements, 0 open ResultSets
17:03:04,913 DEBUG SQL:230 - select baseavinfo0_.IG_NO_GROUPE as IG_NO_GR1_, baseavinfo0_.IG_NO_CERTIFICAT as IG_NO_CE2_, baseavinfo0_.IG_DT_EVENEMENT as IG_DT_EV3_, baseavinfo0_.IG_NO_DOSSIER as IG_NO_DO4_, baseavinfo0_.IG_ID_DOUBLE_ASS as IG_ID_DO5_, baseavinfo0_.IG_GROUPE_CLIENT as IG_GROUP6_, baseavinfo0_.IG_NO_CERTIFICAT_SAM as IG_NO_CE7_, baseavinfo0_.IG_ID_USER as IG_ID_USER, baseavinfo0_.IG_DT_MODIF as IG_DT_MO9_, baseavinfo0_.IG_ID_ACCIDENT as IG_ID_A10_ from AVINFOGE baseavinfo0_ where (baseavinfo0_.IG_NO_DOSSIER='425363' )
17:03:04,913 DEBUG BatcherImpl:253 - preparing statement
17:03:04,913 DEBUG Loader:281 - processing result set
17:03:04,913 DEBUG StringType:64 - returning null as column: IG_NO_GR1_
17:03:04,913 DEBUG StringType:68 - returning '000096461 ' as column: IG_NO_CE2_
17:03:04,913 DEBUG IntegerType:68 - returning '20081201' as column: IG_DT_EV3_
17:03:04,913 DEBUG StringType:68 - returning '425363' as column: IG_NO_DO4_
17:03:04,913 DEBUG Loader:484 - result row: ca.canassistance.pojo.AvinfogeId@b3636754
17:03:04,913 DEBUG Loader:615 - Initializing object from ResultSet: ca.canassistance.pojo.AvinfogeId@b3636754
17:03:04,913 DEBUG Loader:684 - Hydrating entity: ca.canassistance.pojo.BaseAvinfoge#ca.canassistance.pojo.AvinfogeId@b3636754
17:03:04,913 DEBUG StringType:68 - returning 'O' as column: IG_ID_DO5_
17:03:04,913 DEBUG StringType:68 - returning '85000 ' as column: IG_GROUP6_
17:03:04,913 DEBUG StringType:68 - returning '96461 ' as column: IG_NO_CE7_
17:03:04,913 DEBUG StringType:68 - returning 'STAR' as column: IG_ID_USER
17:03:04,913 DEBUG IntegerType:68 - returning '20090209' as column: IG_DT_MO9_
17:03:04,913 DEBUG StringType:68 - returning 'N' as column: IG_ID_A10_
17:03:04,913 DEBUG Loader:298 - done processing result set (1 rows)
17:03:04,913 DEBUG BatcherImpl:211 - done closing: 0 open PreparedStatements, 0 open ResultSets
17:03:04,913 DEBUG BatcherImpl:275 - closing statement
17:03:04,913 DEBUG Loader:318 - total objects hydrated: 1
17:03:04,913 DEBUG SessionImpl:2216 - resolving associations for [ca.canassistance.pojo.BaseAvinfoge#ca.canassistance.pojo.AvinfogeId@b3636754]
17:03:04,913 DEBUG SessionImpl:2247 - done materializing entity [ca.canassistance.pojo.BaseAvinfoge#ca.canassistance.pojo.AvinfogeId@b3636754]
17:03:04,913 DEBUG SessionImpl:3161 - initializing non-lazy collections
17:03:04,913 DEBUG SessionImpl:1169 - deleting a persistent instance
17:03:04,913 DEBUG SessionImpl:3435 - running Session.finalize()
17:03:04,913 DEBUG SessionImpl:1189 - deleting [ca.canassistance.pojo.BaseAvinfoge#ca.canassistance.pojo.AvinfogeId@b3636754]
17:03:09,942 DEBUG JDBCTransaction:59 - commit
17:03:09,942 DEBUG SessionImpl:2267 - flushing session
17:03:09,942 DEBUG SessionImpl:2467 - Flushing entities and processing referenced collections
17:03:09,942 DEBUG SessionImpl:2808 - Processing unreferenced collections
17:03:09,942 DEBUG SessionImpl:2822 - Scheduling collection removes/(re)creates/updates
17:03:09,942 DEBUG SessionImpl:2291 - Flushed: 0 insertions, 0 updates, 1 deletions to 1 objects
17:03:09,942 DEBUG SessionImpl:2296 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
17:03:09,942 DEBUG Printer:75 - listing entities:
17:03:09,942 DEBUG Printer:82 - ca.canassistance.pojo.BaseAvinfoge{groupeClient=85000 , idAccident=N, idUser=STAR, dtModif=20090209, noCertificatSam=96461 , doubleAss=O, id=AvinfogeId{noDossier=425363, noGroupe=null, noCertificat=000096461 , dtEvenement=20081201}}
17:03:09,942 DEBUG SessionImpl:2380 - executing flush
17:03:09,942 DEBUG EntityPersister:552 - Deleting entity: [ca.canassistance.pojo.BaseAvinfoge#ca.canassistance.pojo.AvinfogeId@b3636754]
17:03:09,958 DEBUG BatcherImpl:204 - about to open: 0 open PreparedStatements, 0 open ResultSets
17:03:09,958 DEBUG SQL:230 - delete from AVINFOGE where IG_NO_GROUPE=? and IG_NO_CERTIFICAT=? and IG_DT_EVENEMENT=? and IG_NO_DOSSIER=?
17:03:09,958 DEBUG BatcherImpl:253 - preparing statement
17:03:09,958 DEBUG StringType:41 - binding null to parameter: 1
17:03:09,958 DEBUG StringType:46 - binding '000096461 ' to parameter: 2
17:03:09,958 DEBUG IntegerType:46 - binding '20081201' to parameter: 3
17:03:09,958 DEBUG StringType:46 - binding '425363' to parameter: 4
17:03:09,958 DEBUG BatcherImpl:28 - Adding to batch
17:03:09,958 DEBUG BatcherImpl:50 - Executing batch size: 1
17:03:09,958 DEBUG BatcherImpl:58 - success of batch update unknown: 0
17:03:09,958 DEBUG BatcherImpl:211 - done closing: 0 open PreparedStatements, 0 open ResultSets
17:03:09,958 DEBUG BatcherImpl:275 - closing statement
17:03:09,958 DEBUG SessionImpl:2852 - post flush
17:03:09,958 DEBUG SessionImpl:596 - transaction completion