-->
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.  [ 10 posts ] 
Author Message
 Post subject: Hibernate Bug in joined-subclass lazy loading w outer-join??
PostPosted: Tue Apr 06, 2004 11:22 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Hi everyone,

I've got a JDBC exception from a SQL request triggered by the lazy loading of an object that has a set of joined-subclass component, when setting outer-join="true" for this set. (I know it's not very clear but it's tough to explain.)
The SQL request is simply false. (I checked it with SQL tool)
It becomes ok when I set outer-join="false"

Here's the request when trying to lazy load a DOSSIER_STAGIAIRE
Code:
Hibernate: select dossiersta0_.DOSSIER_STAGIAIRE_ID as DOSSIER_1_6_, dossiersta0_.DOSSIER_STAGIAIRE_NOM as DOSSIER_2_6_, dossiersta0_.DOSSIER_STAGIAIRE_PRENOM as DOSSIER_3_6_, dossiersta0_.DOSSIER_STAGIAIRE_NUMERO_SECU_SEXE_1 as DOSSIER_4_6_, dossiersta0_.DOSSIER_STAGIAIRE_NUMERO_SECU_AGE_2 as DOSSIER_5_6_, dossiersta0_.DOSSIER_STAGIAIRE_NUMERO_SECU_MOIS_3 as DOSSIER_6_6_, dossiersta0_.DOSSIER_STAGIAIRE_NUMERO_SECU_DEPT_4 as DOSSIER_7_6_, dossiersta0_.DOSSIER_STAGIAIRE_NUMERO_SECU_INSEE_5 as DOSSIER_8_6_, dossiersta0_.DOSSIER_STAGIAIRE_NUMERO_SECU_CPT_6 as DOSSIER_9_6_, dossiersta0_.DOSSIER_STAGIAIRE_INITIATIVE_STAGE as DOSSIER10_6_, dossiersta0_.DOSSIER_STAGIAIRE_ADRESSE1 as DOSSIER11_6_, dossiersta0_.DOSSIER_STAGIAIRE_ADRESSE2 as DOSSIER12_6_, dossiersta0_.DOSSIER_STAGIAIRE_CP as DOSSIER13_6_, dossiersta0_.DOSSIER_STAGIAIRE_VILLE as DOSSIER14_6_, dossiersta0_.DOSSIER_STAGIAIRE_TELEPHONE as DOSSIER15_6_, dossiersta0_.DOSSIER_STAGIAIRE_SALAIRE_MENSUEL as DOSSIER16_6_, dossiersta0_.DOSSIER_STAGIAIRE_NBRE_HEURE_TRAVAILLE_MOIS as DOSSIER17_6_, dossiersta0_.DOSSIER_STAGIAIRE_ETAT_HTT as DOSSIER18_6_, dossiersta0_.DOSSIER_STAGIAIRE_NBRE_HEURE_HTT as DOSSIER19_6_, dossiersta0_.DOSSIER_STAGIAIRE_ETAT_DIF as DOSSIER20_6_, dossiersta0_.DOSSIER_STAGIAIRE_TYPE_CONTRAT as DOSSIER21_6_, dossiersta0_.DOSSIER_STAGIAIRE_DATE_FIN_CONTRAT as DOSSIER22_6_, dossiersta0_.DOSSIER_STAGIAIRE_NBRE_HEURE_PREVU as DOSSIER23_6_, dossiersta0_.DOSSIER_STAGIAIRE_DATE_DEBUT_CONTRAT as DOSSIER24_6_, dossiersta0_.DOSSIER_STAGIAIRE_ETAT_FSE_ANNEE1 as DOSSIER25_6_, dossiersta0_.DOSSIER_STAGIAIRE_ETAT_FSE_ANNEE2 as DOSSIER26_6_, dossiersta0_.DOSSIER_STAGIAIRE_ETAT_FSE_ANNEE3 as DOSSIER27_6_, dossiersta0_.DOSSIER_STAGIAIRE_SANCTION_DIPLOME as DOSSIER28_6_, dossiersta0_.DOSSIER_STAGIAIRE_COMMENTAIRE as DOSSIER29_6_, dossiersta0_.DOSSIER_STAGIAIRE_STATUT as DOSSIER30_6_, dossiersta0_.DOSSIER_STAGIAIRE_DATE_CREATION as DOSSIER31_6_, dossiersta0_.DOSSIER_STAGIAIRE_DATE_MAJ as DOSSIER32_6_, dossiersta0_.DOSSIER_STAGIAIRE_SITUATION_PROFESSIONNELLE_ID_FK as DOSSIER33_6_, dossiersta0_.DOSSIER_STAGIAIRE_ISSUE_CONTRAT_ID_FK as DOSSIER34_6_, dossiersta0_.DOSSIER_STAGIAIRE_DIPLOME_ID_FK as DOSSIER35_6_, dossiersta0_.DOSSIER_STAGIAIRE_EMPLOI_CODE_FK as DOSSIER36_6_, dossiersta0_.DOSSIER_STAGIAIRE_DOSSIER_ADHERENT_ID_FK as DOSSIER37_6_, dossiersta0_.DOSSIER_STAGIAIRE_UTILISATEUR_CODE_FK as DOSSIER38_6_, attestatio1_.ATTESTATION_PRESENCE_STAGIAIRE_ID_FK as ATTESTAT1___, attestatio1_.ATTESTATION_PRESENCE_STAGIAIRE_DOSSIER_STAGIAIRE_ID_FK as ATTESTAT2___, attestatio1_.ATTESTATION_PRESENCE_STAGIAIRE_ID_FK as ATTESTAT1_0_, attestatio1_.ATTESTATION_PRESENCE_STAGIAIRE_DOSSIER_STAGIAIRE_ID_FK as ATTESTAT2_60_0_, attestatio1__1_.ATTESTATION_PRESENCE_DATE_DEBUT as ATTESTAT2_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_DATE_FIN as ATTESTAT3_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_ETAT_INTERRUPTION as ATTESTAT4_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_DUREE_HEURE_PRESENCE as ATTESTAT5_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_DUREE_HEURE_ABSENCE as ATTESTAT6_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_DUREE_HEURE_TOTAL as ATTESTAT7_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_HEURE_NON_ATTESTEE as ATTESTAT8_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_COMMENTAIRE as ATTESTAT9_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_DATE_CREATION as ATTESTA10_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_DATE_MAJ as ATTESTA11_59_0_, attestatio1__1_.ATTESTATION_PRESENCE_UTILISATEUR_CODE_FK as ATTESTA12_59_0_, situationp2_.SITUATION_PROFESSIONNELLE_ID as SITUATIO1_1_, situationp2_.SITUATION_PROFESSIONNELLE_LIBELLE as SITUATIO2_1_, situationp2_.SITUATION_PROFESSIONNELLE_ETAT_ACTIVATION as SITUATIO3_1_, issuecontr3_.ISSUE_CONTRAT_ID as ISSUE_CO1_2_, issuecontr3_.ISSUE_CONTRAT_LIBELLE as ISSUE_CO2_2_, issuecontr3_.ISSUE_CONTRAT_ETAT_ACTIVATION as ISSUE_CO3_2_, diplome4_.DIPLOME_ID as DIPLOME_ID3_, diplome4_.DIPLOME_LIBELLE as DIPLOME_2_3_, diplome4_.DIPLOME_ETAT_ACTIVATION as DIPLOME_3_3_, emploi5_.EMPLOI_CODE as EMPLOI_C1_4_, emploi5_.EMPLOI_LIBELLE as EMPLOI_L2_4_, emploi5_.EMPLOI_ETAT_ACTIVATION as EMPLOI_E3_4_, emploi5_.EMPLOI_CATEGORIES_SOCIAUX_PROFESSIONNELLES_CODE_FK as EMPLOI_C4_4_, categories6_.CATEGORIES_SOCIAUX_PROFESSIONNELLES_CODE as CATEGORI1_5_, categories6_.CATEGORIES_SOCIAUX_PROFESSIONNELLES_LIBELLE as CATEGORI2_5_, categories6_.CATEGORIES_SOCIAUX_PROFESSIONNELLES_ETAT_ACTIVATION as CATEGORI3_5_ from DOSSIER_STAGIAIRE dossiersta0_ left outer join ATTESTATION_PRESENCE_STAGIAIRE attestatio1_ on dossiersta0_.DOSSIER_STAGIAIRE_ID=attestatio1_.ATTESTATION_PRESENCE_STAGIAIRE_DOSSIER_STAGIAIRE_ID_FK left outer join SITUATION_PROFESSIONNELLE situationp2_ on dossiersta0_.DOSSIER_STAGIAIRE_SITUATION_PROFESSIONNELLE_ID_FK=situationp2_.SITUATION_PROFESSIONNELLE_ID left outer join ISSUE_CONTRAT issuecontr3_ on dossiersta0_.DOSSIER_STAGIAIRE_ISSUE_CONTRAT_ID_FK=issuecontr3_.ISSUE_CONTRAT_ID left outer join DIPLOME diplome4_ on dossiersta0_.DOSSIER_STAGIAIRE_DIPLOME_ID_FK=diplome4_.DIPLOME_ID left outer join EMPLOI emploi5_ on dossiersta0_.DOSSIER_STAGIAIRE_EMPLOI_CODE_FK=emploi5_.EMPLOI_CODE left outer join CATEGORIES_SOCIAUX_PROFESSIONNELLES categories6_ on emploi5_.EMPLOI_CATEGORIES_SOCIAUX_PROFESSIONNELLES_CODE_FK=categories6_.CATEGORIES_SOCIAUX_PROFESSIONNELLES_CODE where dossiersta0_.DOSSIER_STAGIAIRE_ID=?

Not easy to read, but obviously wrong

Here's the SQL Exception (manually re-translated though):
com.jnetdirect.jsql.v: column prefix 'attestatio1__1_' doesn't correspond neither to table name nor to alias used in the request

Here're the mappings:
Code:
<hibernate-mapping>
    <class name="org.xx.dossierstagiaire.model.AttestationPresence" table="ATTESTATION_PRESENCE" lazy="true">
        <meta attribute="extends" inherit="false">org.xx.persistence.BusinessObject</meta>
        <cache usage="read-write"/>

        <id name="attestationPresenceId" type="java.lang.Long" column="ATTESTATION_PRESENCE_ID">
            <generator class="identity"/>
        </id>

        <property name="attestationPresenceDateDebut" type="java.util.Date" column="ATTESTATION_PRESENCE_DATE_DEBUT" not-null="true"/>
        <property name="attestationPresenceDateFin" type="java.util.Date" column="ATTESTATION_PRESENCE_DATE_FIN" not-null="true"/>
        <property name="attestationPresenceEtatInterruption" type="java.lang.Byte" column="ATTESTATION_PRESENCE_ETAT_INTERRUPTION" not-null="true"/>
        <property name="attestationPresenceDureeHeurePresence" type="java.lang.Double" column="ATTESTATION_PRESENCE_DUREE_HEURE_PRESENCE" not-null="true"/>
        <property name="attestationPresenceDureeHeureAbsence" type="java.lang.Double" column="ATTESTATION_PRESENCE_DUREE_HEURE_ABSENCE" not-null="true"/>
        <property name="attestationPresenceDureeHeureTotal" type="java.lang.Double" column="ATTESTATION_PRESENCE_DUREE_HEURE_TOTAL" not-null="true"/>
        <property name="attestationPresenceHeureNonAttestee" type="java.lang.Double" column="ATTESTATION_PRESENCE_HEURE_NON_ATTESTEE"/>
        <property name="attestationPresenceCommentaire" type="java.lang.String" column="ATTESTATION_PRESENCE_COMMENTAIRE"/>
        <property name="attestationPresenceDateCreation" type="java.util.Date" column="ATTESTATION_PRESENCE_DATE_CREATION" not-null="true"/>
        <property name="attestationPresenceDateMaj" type="java.util.Date" column="ATTESTATION_PRESENCE_DATE_MAJ" not-null="true"/>

        <many-to-one name="attestationPresenceUserCodeFk" column="ATTESTATION_PRESENCE_UTILISATEUR_CODE_FK" class="org.xx.user.model.User" not-null="true"/>

        <joined-subclass name="org.xx.dossierstagiaire.model.AttestationPresenceStagiaire" table="ATTESTATION_PRESENCE_STAGIAIRE" lazy="true">
            <key column="ATTESTATION_PRESENCE_STAGIAIRE_ID_FK"/>
            <many-to-one name="dossierStagiaire" class="org.xx.dossierstagiaire.model.DossierStagiaire" not-null="true">
                <column name="ATTESTATION_PRESENCE_STAGIAIRE_DOSSIER_STAGIAIRE_ID_FK"/>
            </many-to-one>
        </joined-subclass>

        <joined-subclass name="org.xx.dossierstagiaire.model.AttestationPresenceMasse" table="ATTESTATION_PRESENCE_MASSE" lazy="true">
            <key column="ATTESTATION_PRESENCE_MASSE_ID_FK"/>
            <many-to-one name="dossierFormationStd" class="org.xx.dossierformation.model.DossierFormationStd" not-null="true">
                <column name="ATTESTATION_PRESENCE_MASSE_DOSSIER_FORMATION_STD_ID_FK"/>
            </many-to-one>
        </joined-subclass>

    </class>
</hibernate-mapping>


Code:
<hibernate-mapping>
    <class name="org.xx.dossierstagiaire.model.DossierStagiaire" table="DOSSIER_STAGIAIRE" lazy="true">
        <meta attribute="extends" inherit="false">org.xx.persistence.BusinessObject</meta>
        <cache usage="read-write"/>

        <id name="dossierStagiaireId" type="java.lang.Long" column="DOSSIER_STAGIAIRE_ID">
            <generator class="identity"/>
        </id>

        <property name="dossierStagiaireNom" type="java.lang.String" column="DOSSIER_STAGIAIRE_NOM" not-null="true"/>
        <property name="dossierStagiairePrenom" type="java.lang.String" column="DOSSIER_STAGIAIRE_PRENOM"/>
        <property name="dossierStagiaireNumeroSecuSexe1" type="java.lang.Integer" column="DOSSIER_STAGIAIRE_NUMERO_SECU_SEXE_1" not-null="true"/>
        <property name="dossierStagiaireNumeroSecuAge2" type="java.lang.String" column="DOSSIER_STAGIAIRE_NUMERO_SECU_AGE_2" not-null="true"/>
        <property name="dossierStagiaireNumeroSecuMois3" type="java.lang.String" column="DOSSIER_STAGIAIRE_NUMERO_SECU_MOIS_3"/>
        <property name="dossierStagiaireNumeroSecuDept4" type="java.lang.String" column="DOSSIER_STAGIAIRE_NUMERO_SECU_DEPT_4"/>
        <property name="dossierStagiaireNumeroSecuInsee5" type="java.lang.String" column="DOSSIER_STAGIAIRE_NUMERO_SECU_INSEE_5"/>
        <property name="dossierStagiaireNumeroSecuCpt6" type="java.lang.String" column="DOSSIER_STAGIAIRE_NUMERO_SECU_CPT_6"/>
        <property name="dossierStagiaireInitiativeStage" type="java.lang.String" column="DOSSIER_STAGIAIRE_INITIATIVE_STAGE" not-null="true"/>
        <property name="dossierStagiaireAdresse1" type="java.lang.String" column="DOSSIER_STAGIAIRE_ADRESSE1"/>
        <property name="dossierStagiaireAdresse2" type="java.lang.String" column="DOSSIER_STAGIAIRE_ADRESSE2"/>
        <property name="dossierStagiaireCp" type="java.lang.String" column="DOSSIER_STAGIAIRE_CP"/>
        <property name="dossierStagiaireVille" type="java.lang.String" column="DOSSIER_STAGIAIRE_VILLE"/>
        <property name="dossierStagiaireTelephone" type="java.lang.String" column="DOSSIER_STAGIAIRE_TELEPHONE"/>
        <property name="dossierStagiaireSalaireMensuel" type="java.lang.Double" column="DOSSIER_STAGIAIRE_SALAIRE_MENSUEL"/>
        <property name="dossierStagiaireNbreHeureTravailleMois" type="java.lang.Integer" column="DOSSIER_STAGIAIRE_NBRE_HEURE_TRAVAILLE_MOIS"/>
        <property name="dossierStagiaireEtatHtt" type="java.lang.Byte" column="DOSSIER_STAGIAIRE_ETAT_HTT" not-null="true"/>
        <property name="dossierStagiaireNbreHeureHtt" type="java.lang.Short" column="DOSSIER_STAGIAIRE_NBRE_HEURE_HTT"/>
        <property name="dossierStagiaireEtatDif" type="java.lang.Byte" column="DOSSIER_STAGIAIRE_ETAT_DIF" not-null="true"/>
        <property name="dossierStagiaireTypeContrat" type="java.lang.String" column="DOSSIER_STAGIAIRE_TYPE_CONTRAT"/>
        <property name="dossierStagiaireDateFinContrat" type="java.util.Date" column="DOSSIER_STAGIAIRE_DATE_FIN_CONTRAT"/>
        <property name="dossierStagiaireNbreHeurePrevu" type="java.lang.Short" column="DOSSIER_STAGIAIRE_NBRE_HEURE_PREVU"/>
        <property name="dossierStagiaireDateDebutContrat" type="java.util.Date" column="DOSSIER_STAGIAIRE_DATE_DEBUT_CONTRAT"/>
        <property name="dossierStagiaireEtatFseAnnee1" type="java.lang.Byte" column="DOSSIER_STAGIAIRE_ETAT_FSE_ANNEE1"/>
        <property name="dossierStagiaireEtatFseAnnee2" type="java.lang.Byte" column="DOSSIER_STAGIAIRE_ETAT_FSE_ANNEE2"/>
        <property name="dossierStagiaireEtatFseAnnee3" type="java.lang.Byte" column="DOSSIER_STAGIAIRE_ETAT_FSE_ANNEE3"/>
        <property name="dossierStagiaireSanctionDiplome" type="java.lang.String" column="DOSSIER_STAGIAIRE_SANCTION_DIPLOME"/>
        <property name="dossierStagiaireCommentaire" type="java.lang.String" column="DOSSIER_STAGIAIRE_COMMENTAIRE"/>
        <property name="dossierStagiaireStatut" type="java.lang.String" column="DOSSIER_STAGIAIRE_STATUT" not-null="true"/>
        <property name="dossierStagiaireDateCreation" type="java.util.Date" column="DOSSIER_STAGIAIRE_DATE_CREATION" not-null="true"/>
        <property name="dossierStagiaireDateMaj" type="java.util.Date" column="DOSSIER_STAGIAIRE_DATE_MAJ" not-null="true"/>

        <!-- associations -->
        <!-- bi-directional one-to-many association to AttestationPresence -->
        <!-- WARNING: the outer-join MUST be set to FALSE, might be a Hibernate Bug -->
        <set name="attestationsPresences" lazy="true" inverse="true" sort="org.xx.dossierstagiaire.service.AttestationPresenceComparator" cascade="all-delete-orphan" outer-join="true">
            <key column="ATTESTATION_PRESENCE_STAGIAIRE_DOSSIER_STAGIAIRE_ID_FK"/>
            <one-to-many class="org.xx.dossierstagiaire.model.AttestationPresenceStagiaire"/>
        </set>

        <set name="engagements" inverse="false" lazy="true" order-by="ENGAGEMENT_ID asc" cascade="all-delete-orphan" outer-join="true">
            <key column="ENGAGEMENT_DOSSIER_STAGIAIRE_ID_FK"/>
            <one-to-many class="org.xx.engagementremboursement.model.Engagement"/>
        </set>

        <set name="remboursements" inverse="false" lazy="true" order-by="REMBOURSEMENT_ID asc" cascade="delete-orphan" outer-join="true">
            <key column="REMBOURSEMENT_DOSSIER_STAGIAIRE_ID_FK"/>
            <one-to-many class="org.xx.engagementremboursement.model.Remboursement"/>
        </set>

        <!-- bi-directional many-to-one association to SituationProfessionnelle -->
        <many-to-one name="situationProfessionnelle" class="org.xx.dossierstagiaire.model.SituationProfessionnelle" not-null="true">
            <column name="DOSSIER_STAGIAIRE_SITUATION_PROFESSIONNELLE_ID_FK"/>
        </many-to-one>
        <!-- bi-directional many-to-one association to IssueContrat -->
        <many-to-one name="issueContrat" class="org.xx.dossierstagiaire.model.IssueContrat">
            <column name="DOSSIER_STAGIAIRE_ISSUE_CONTRAT_ID_FK"/>
        </many-to-one>
        <!-- bi-directional many-to-one association to Diplome -->
        <many-to-one name="diplome" class="org.xx.dossierstagiaire.model.Diplome">
            <column name="DOSSIER_STAGIAIRE_DIPLOME_ID_FK"/>
        </many-to-one>
        <!-- bi-directional many-to-one association to Emploi -->
        <many-to-one name="emploi" class="org.xx.dossierstagiaire.model.Emploi" not-null="true">
            <column name="DOSSIER_STAGIAIRE_EMPLOI_CODE_FK"/>
        </many-to-one>

        <!-- bi-directional many-to-one association to DossierAdherent -->
        <many-to-one name="dossierStagiaireDossierAdherentIdFk" class="org.xx.dossieradherent.model.DossierAdherent">
            <column name="DOSSIER_STAGIAIRE_DOSSIER_ADHERENT_ID_FK" not-null="true"/>
        </many-to-one>

        <many-to-one name="dossierStagiaireUserCodeFk" class="org.xx.user.model.User" cascade="none" not-null="true">
            <column name="DOSSIER_STAGIAIRE_UTILISATEUR_CODE_FK"/>
        </many-to-one>

    </class>
</hibernate-mapping>


The exception doesn't occur any more when setting outer-join to false or auto. Note that It also doesn't occur when I instanciate myself the DOSSIER_STAGIAIRE.

Regards,
nodje


Last edited by nodje on Tue Jun 03, 2008 5:14 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 11:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Perhaps if you bothered to massively simplify your test case, someone would then bother to pay some attention to your post.

Honestly, dont ever post hundreds of lines of code and then claim that the bug must be in Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 3:26 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
OK, I apologize for that, I won't do it again ...
It seemed to me that the real environment was better than a test case.
But I'll take time to try to reproduce the bug with the most simple environment.

However, Hibernate is really issuing a wrong SQL request. Which I thought would probably be of interest for you guys.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 5:05 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
OK, after couple hours of work I've been able to reproduce the behavior.

The test case have been reduced to the minimum but is still consequent:

here's the mappings:

Code:
   
<class name="org.xx.test.Aclass" table="A_TABLE" lazy="true">
        <meta attribute="extends" inherit="false">org.xx.persistence.BusinessObject</meta>
        <cache usage="read-write"/>

        <id name="id" type="java.lang.Long" column="A_TABLE_ID">
            <generator class="identity"/>
        </id>

        <property name="aclassField" type="java.lang.String" column="A_TABLE_FIELD" not-null="true"/>

        <!-- associations -->
        <!-- bi-directional one-to-many association to BClass -->
        <!-- WARNING: the outer-join MUST be set to FALSE -->
        <set name="bclass1Set" lazy="true" inverse="true" sort="org.xx.test.BclassComparator" cascade="all-delete-orphan" outer-join="true">
            <key column="B_TABLE_1_A_TABLE_ID_FK"/>
            <one-to-many class="org.xx.test.Bclass1"/>
        </set>

    </class>

    <class name="org.xx.test.Bclass" table="B_TABLE" lazy="true">
        <meta attribute="extends" inherit="false">org.xx.persistence.BusinessObject</meta>
        <cache usage="read-write"/>

        <id name="id" type="java.lang.Long" column="B_TABLE_ID">
            <generator class="identity"/>
        </id>

        <property name="bclassDate" type="java.util.Date" column="B_TABLE_DATE" not-null="true"/>

        <joined-subclass name="org.xx.test.Bclass1" table="B_TABLE_1" lazy="true">
            <key column="B_TABLE_1_IF_FK"/>
            <many-to-one name="aclass" class="org.xx.test.Aclass" not-null="true">
                <column name="B_TABLE_1_A_TABLE_ID_FK"/>
            </many-to-one>
        </joined-subclass>

        <joined-subclass name="org.xx.test.Bclass2" table="B_TABLE_2" lazy="true">
            <key column="B_TABLE_2_ID_FK"/>
            <many-to-one name="cclass" class="org.xx.test.Cclass" not-null="true">
                <column name="B_TABLE_1_C_TABLE_ID_FK"/>
            </many-to-one>
        </joined-subclass>

    </class>



The exception is thrown when doing a object.getAclass.getAclassField();
(Object referencing Aclass as many-to-one):

Here's the SQL request:
Code:
Hibernate: select aclass0_.A_TABLE_ID as A_TABLE_ID1_, aclass0_.A_TABLE_FIELD as A_TABLE_2_1_, bclass1set1_.B_TABLE_1_IF_FK as B_TABLE_1___, bclass1set1_.B_TABLE_1_A_TABLE_ID_FK as B_TABLE_2___, bclass1set1_.B_TABLE_1_IF_FK as B_TABLE_ID0_, bclass1set1_.B_TABLE_1_A_TABLE_ID_FK as B_TABLE_2_81_0_, bclass1set1__1_.B_TABLE_DATE as B_TABLE_2_80_0_ from A_TABLE aclass0_ left outer join B_TABLE_1 bclass1set1_ on aclass0_.A_TABLE_ID=bclass1set1_.B_TABLE_1_A_TABLE_ID_FK where aclass0_.A_TABLE_ID=?


Here's the exception

Code:
10:43:54,875  WARN JDBCExceptionReporter:38 - SQL Error: 107, SQLState: S0002
10:43:54,875 ERROR JDBCExceptionReporter:46 - Le prefixe de colonne 'bclass1set1__1_' ne correspond ni au nom de table ni au nom d'alias utilises dans la requete.
10:43:54,906 ERROR JDBCExceptionReporter:38 - could not load: [org.xx.test.Aclass#2]


Approximative translation of the message:
column prefix 'bclass1set1__1_' doesn't correspond neither to table name nor to alias used in the request

And consistently if you do a simple ((Aclass)session.load(Aclass.class, id)).getAclassField(); you get the same exception.

Hope this helps clarifying the problem and make it more understandable

regards,
nodje


Last edited by nodje on Tue Jun 03, 2008 5:16 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 7:31 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Have read you post quickly.
Does this looks like this one
http://opensource.atlassian.com/projects/hibernate/browse/HB-810

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 7:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I just tested this kind of mapping against current Hibernate v21branch CVS and it worked prefectly. I hope you are not using an obsolete version of Hibernate!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 7:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Emmanuel, it is not related to HB-810 - which, by the way, is fixed in my sandbox, by some refactorings I won't find time to finish and commit for a few days.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 8:36 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
OK, good if it worked with your latest CVS branch.

I'm using Hibernate 2.1.2 and it doesn't, that's for sure.

So I should probably get the latest version from CVS then.

More generally, I'm just wondering if it makes sense having lazy=true and outer-join=true for collections that reference proxied object??

nodje


Last edited by nodje on Tue Jun 03, 2008 5:16 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 08, 2004 8:06 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
nodje wrote:
OK, good if it worked with your latest CVS branch.

No Gavin said your mapping works perfectly on 2.1.2
He told me HB-810 was solved in it's sandbox, but it's not related to you.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 08, 2004 8:31 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Well I understand
Quote:
current Hibernate v21branch CVS

as a more recent version than the 2.1.2 distrib.

I'm using the latest distrib, 2.1.2, and it doesn't work. neither my production mapping nor the tests I posted.


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