Hi I start with hibernate
this is my error
Code:
19:49:33,860 DEBUG SessionImpl:1828 - Dont need to execute flush
[B]19:49:33,860 DEBUG QueryTranslator:207 - HQL: select from ca.croixbleue.qc.model.base.BaseAvinfoge as base where base.noDossier = ?
19:49:33,860 DEBUG QueryTranslator:208 - SQL: select baseavinfo0_.noGroupe as noGroupe, baseavinfo0_.noCertificat as noCertif2_, baseavinfo0_.dtEvenement as dtEvenem3_, baseavinfo0_.noDossier as noDossier, baseavinfo0_.IG_ID_DOUBLE_ASS as IG_ID_DO5_, baseavinfo0_.IG_DT_EVENEMENT as IG_DT_EV6_, baseavinfo0_.IG_GROUPE_CLIENT as IG_GROUP7_, baseavinfo0_.IG_NO_DOSSIER as IG_NO_DO8_, baseavinfo0_.IG_NO_CERTIFICAT_SAM as IG_NO_CE9_, baseavinfo0_.IG_NO_CERTIFICAT as IG_NO_C10_, baseavinfo0_.IG_NO_GROUPE as IG_NO_G11_, baseavinfo0_.IG_ID_USER as IG_ID_USER, baseavinfo0_.IG_DT_MODIF as IG_DT_M13_, baseavinfo0_.IG_ID_ACCIDENT as IG_ID_A14_ from AVINFOGE baseavinfo0_ where (baseavinfo0_.IG_NO_DOSSIER=? )
19:49:33,875 DEBUG BatcherImpl:204 - about to open: 0 open PreparedStatements, 0 open ResultSets
19:49:33,875 DEBUG SQL:230 - select baseavinfo0_.noGroupe as noGroupe, baseavinfo0_.noCertificat as noCertif2_, baseavinfo0_.dtEvenement as dtEvenem3_, baseavinfo0_.noDossier as noDossier, baseavinfo0_.IG_ID_DOUBLE_ASS as IG_ID_DO5_, baseavinfo0_.IG_DT_EVENEMENT as IG_DT_EV6_, baseavinfo0_.IG_GROUPE_CLIENT as IG_GROUP7_, baseavinfo0_.IG_NO_DOSSIER as IG_NO_DO8_, baseavinfo0_.IG_NO_CERTIFICAT_SAM as IG_NO_CE9_, baseavinfo0_.IG_NO_CERTIFICAT as IG_NO_C10_, baseavinfo0_.IG_NO_GROUPE as IG_NO_G11_, baseavinfo0_.IG_ID_USER as IG_ID_USER, baseavinfo0_.IG_DT_MODIF as IG_DT_M13_, baseavinfo0_.IG_ID_ACCIDENT as IG_ID_A14_ from AVINFOGE baseavinfo0_ where (baseavinfo0_.IG_NO_DOSSIER=? )
19:49:33,875 DEBUG BatcherImpl:253 - preparing statement
19:49:33,969 DEBUG StringType:46 - binding '420517' to parameter: 1
19:49:34,000 DEBUG JDBCExceptionReporter:49 - SQL Exception
java.sql.SQLException: ORA-00904: "BASEAVINFO0_"."NODOSSIER": invalid [/B]identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1037)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at ca.croixbleue.qc.model.base.BaseAvinfogeDAO.find(BaseAvinfogeDAO.java:169)
at ca.croixbleue.qc.model.base.BaseAvinfoge.estDansLaBase(BaseAvinfoge.java:189)
at ca.croixbleue.qc.service.ServicePersistance.estDansLaBase(ServicePersistance.java:23)
at ca.croixbleue.qc.batch.MettreJourInfogene.creerInfogene(MettreJourInfogene.java:231)
at ca.croixbleue.qc.batch.MettreJourInfogene.iniFichier(MettreJourInfogene.java:216)
at ca.croixbleue.qc.batch.MettreJourInfogene.traiter(MettreJourInfogene.java:170)
at ca.croixbleue.qc.batch.MettreJourInfogene.<init>(MettreJourInfogene.java:130)
at ca.croixbleue.qc.batch.MettreJourInfogene.main(MettreJourInfogene.java:731)
19:49:34,000 WARN JDBCExceptionReporter:57 - SQL Error: 904, SQLState: 42000
19:49:34,000 ERROR JDBCExceptionReporter:58 - ORA-00904: "BASEAVINFO0_"."NODOSSIER": invalid identifier
19:49:34,000 DEBUG BatcherImpl:211 - done closing: 0 open PreparedStatements, 0 open ResultSets
19:49:34,000 DEBUG BatcherImpl:275 - closing statement
19:49:34,000 DEBUG JDBCExceptionReporter:49 - Could not execute query
java.sql.SQLException: ORA-00904: "BASEAVINFO0_"."NODOSSIER": invalid identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1037)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at ca.croixbleue.qc.model.base.BaseAvinfogeDAO.find(BaseAvinfogeDAO.java:169)
at ca.croixbleue.qc.model.base.BaseAvinfoge.estDansLaBase(BaseAvinfoge.java:189)
at ca.croixbleue.qc.service.ServicePersistance.estDansLaBase(ServicePersistance.java:23)
at ca.croixbleue.qc.batch.MettreJourInfogene.creerInfogene(MettreJourInfogene.java:231)
at ca.croixbleue.qc.batch.MettreJourInfogene.iniFichier(MettreJourInfogene.java:216)
at ca.croixbleue.qc.batch.MettreJourInfogene.traiter(MettreJourInfogene.java:170)
at ca.croixbleue.qc.batch.MettreJourInfogene.<init>(MettreJourInfogene.java:130)
at ca.croixbleue.qc.batch.MettreJourInfogene.main(MettreJourInfogene.java:731)
19:49:34,000 WARN JDBCExceptionReporter:57 - SQL Error: 904, SQLState: 42000
19:49:34,000 ERROR JDBCExceptionReporter:58 - ORA-00904: "BASEAVINFO0_"."NODOSSIER": invalid identifier
19:49:37,423 DEBUG SessionImpl:578 - closing session
19:49:37,423 DEBUG SessionImpl:3383 - disconnecting session
19:49:37,423 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
net.sf.hibernate.exception.SQLGrammarException: Could not execute query
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:69)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4131)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1557)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at ca.croixbleue.qc.model.base.BaseAvinfogeDAO.find(BaseAvinfogeDAO.java:169)
at ca.croixbleue.qc.model.base.BaseAvinfoge.estDansLaBase(BaseAvinfoge.java:189)
at ca.croixbleue.qc.service.ServicePersistance.estDansLaBase(ServicePersistance.java:23)
at ca.croixbleue.qc.batch.MettreJourInfogene.creerInfogene(MettreJourInfogene.java:231)
at ca.croixbleue.qc.batch.MettreJourInfogene.iniFichier(MettreJourInfogene.java:216)
at ca.croixbleue.qc.batch.MettreJourInfogene.traiter(MettreJourInfogene.java:170)
at ca.croixbleue.qc.batch.MettreJourInfogene.<init>(MettreJourInfogene.java:130)
at ca.croixbleue.qc.batch.MettreJourInfogene.main(MettreJourInfogene.java:731)
Caused by: java.sql.SQLException: ORA-00904: "BASEAVINFO0_"."NODOSSIER": invalid identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1037)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:89)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:880)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:273)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
... 9 more
So the sql statement genare it not good
this is my class
Code:
package ca.croixbleue.qc.model.base;
import java.io.Serializable;
import net.sf.hibernate.HibernateException;
import ca.croixbleue.qc.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;
[B]private java.lang.String noDossier;[/B]
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 java.lang.String id;
private AvinfogeDAO dao;
// constructors
public BaseAvinfoge () {
initialize();
}
public BaseAvinfoge (String cleDossier) {
this.setNoDossier(cleDossier);
}
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 getDtEvenement() {
return dtEvenement;
}
public void setDtEvenement(java.lang.Integer dtEvenement) {
this.dtEvenement = dtEvenement;
}
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 java.lang.String getId() {
return id;
}
public void setId(java.lang.String 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 getNoCertificat() {
return noCertificat;
}
public void setNoCertificat(java.lang.String noCertificat) {
this.noCertificat = noCertificat;
}
public java.lang.String getNoCertificatSam() {
return noCertificatSam;
}
public void setNoCertificatSam(java.lang.String noCertificatSam) {
this.noCertificatSam = noCertificatSam;
}
[B]public java.lang.String getNoDossier() {
return noDossier;
}
public void setNoDossier(java.lang.String noDossier) {
this.noDossier = noDossier;
}[/B]
public java.lang.String getNoGroupe() {
return noGroupe;
}
public void setNoGroupe(java.lang.String noGroupe) {
this.noGroupe = noGroupe;
}
public void estDansLaBase(BaseAvinfoge uneBaseAvinfoge) throws HibernateException {
if(dao==null)
this.setDao(new AvinfogeDAO());
this.getDao().find(uneBaseAvinfoge);
}
public AvinfogeDAO getDao() {
return dao;
}
public void setDao(AvinfogeDAO dao) {
this.dao = dao;
}
}
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.croixbleue.qc.model.base">
<class
name="BaseAvinfoge"
table="AVINFOGE"
>
<composite-id class="ca.croixbleue.qc.model.base.AvinfogeId">
<key-property name="noGroupe"/>
<key-property name="noCertificat"/>
<key-property name="dtEvenement"/>
<key-property name="noDossier"/>
</composite-id>
<property
name="doubleAss"
column="IG_ID_DOUBLE_ASS"
type="string"
not-null="false"
length="1"
/>
<property
name="dtEvenement"
column="IG_DT_EVENEMENT"
type="integer"
not-null="false"
length="8"
/>
<property
name="groupeClient"
column="IG_GROUPE_CLIENT"
type="string"
not-null="false"
length="8"
/>
[B]<property
name="noDossier"
column="IG_NO_DOSSIER"
type="string"
not-null="false"
length="6"
/>[/B] <property
name="noCertificatSam"
column="IG_NO_CERTIFICAT_SAM"
type="string"
not-null="false"
length="20"
/>
<property
name="noCertificat"
column="IG_NO_CERTIFICAT"
type="string"
not-null="false"
length="10"
/>
<property
name="noGroupe"
column="IG_NO_GROUPE"
type="string"
not-null="false"
length="6"
/>
<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>
What wong the my project thank
Code:
public List find(BaseAvinfoge uneBaseAvinfoge) throws HibernateException {
Session session = null;
List list = null;
try {
session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
list = session.createQuery(
" select from BaseAvinfoge as base where base.noDossier = ?").setString(0,
uneBaseAvinfoge.getNoDossier()).list();
//list = session.createCriteria(BaseAvinfoge.class)
// .add(Expression.like("IG_NO_DOSSIER", "111111") )
// .list();
tx.commit();
HibernateUtil.closeSession();
return list;
} catch (HibernateException e) {
HibernateUtil.closeSession();
e.printStackTrace();
}
return list;
}