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.  [ 1 post ] 
Author Message
 Post subject: Composite primary key and @Jointable, Bug?
PostPosted: Mon Jun 11, 2007 4:38 am 
Newbie

Joined: Mon Jun 11, 2007 4:00 am
Posts: 1
Hi,

I've got an entity with composite primary key (
COD_ETP ->String
and COD_VRS_VET-> Long
),

and a method defined by the following code

Code:
    @OneToMany
    @JoinTable(
         name="VET_REGROUPE_LSE",
         inverseJoinColumns = { @JoinColumn( name="COD_LSE")} ,
         joinColumns = {@JoinColumn( name="COD_ETP"),@JoinColumn( name="COD_VRS_VET")})
    public List<ListeElementPedagogique> getListeElementPedagogiqueList() {
     return listeElementPedagogiqueList;
    }


by when i try to access to this method, i get this:
Code:
org.hibernate.exception.SQLGrammarException: could not initialize a collection: [ucbl.apogee.pojo.VersionEtape.listeElementPedagogiqueList#component[cod_vrs_vet,cod_etp]{cod_etp=LS0062, cod_vrs_vet=106}]


But the quey generated by hibernate seems to have swaped between composite keys
cod_etp -> Long (106)
cod_vrs_vet -> String (LS0062)

but i should be

cod_vrs_vet -> Long (106)
cod_etp -> String (LS0062)

Code:
2007-06-11 09:41:56,058 DEBUG - select listeeleme0_.COD_ETP as COD2_4_, listeeleme0_.COD_VRS_VET as COD3_4_, listeeleme0_.COD_LSE as COD1_4_, listeeleme1_.COD_LSE as COD1_17_0_, listeeleme1_1_.COD_ETP as COD2_18_0_, listeeleme1_1_.COD_VRS_VET as COD3_18_0_, versioneta2_.cod_vrs_vet as cod1_16_1_, versioneta2_.cod_etp as cod2_16_1_, versioneta2_.COD_ETP as COD2_16_1_, versioneta2_.LIB_WEB_VET as LIB3_16_1_, versioneta2_.TEM_ADO as TEM4_16_1_, versioneta2_.TEM_TLS_VET as TEM5_16_1_, versioneta2_.TEM_SES_UNI as TEM6_16_1_, versioneta2_.TEM_RES_VET as TEM7_16_1_, versioneta2_.TEM_PNT_JUR_VET as TEM8_16_1_, versioneta2_.TEM_OPI_MIN_VET as TEM9_16_1_, versioneta2_.TEM_NOT_VET as TEM10_16_1_, versioneta2_.TEM_MND_VET as TEM11_16_1_, versioneta2_.TEM_JUR_VET as TEM12_16_1_, versioneta2_.TEM_DIP_VET as TEM13_16_1_, versioneta2_.TEM_ADI as TEM14_16_1_, versioneta2_.NBR_VOL_HOR_VET as NBR15_16_1_, versioneta2_.NBR_CRD_VET as NBR16_16_1_, versioneta2_.NBR_ADM_VET as NBR17_16_1_, versioneta2_.LIM3_VET as LIM18_16_1_, versioneta2_.LIM2_VET as LIM19_16_1_, versioneta2_.LIM1_VET as LIM20_16_1_, versioneta2_.LIB_CMT_VET as LIB21_16_1_, versioneta2_.DAT_FIN_MIN_VET as DAT22_16_1_, versioneta2_.DAT_DEB_MIN_VET as DAT23_16_1_, versioneta2_.COD_TRE_POS as COD24_16_1_, versioneta2_.COD_TRE_NEG as COD25_16_1_, versioneta2_.COD_PAN_4 as COD26_16_1_, versioneta2_.COD_PAN_3 as COD27_16_1_, versioneta2_.COD_PAN_2 as COD28_16_1_, versioneta2_.COD_PAN_1 as COD29_16_1_, versioneta2_.COD_ESI as COD30_16_1_, versioneta2_.COD_DUE as COD31_16_1_, versioneta2_.COD_CPG as COD32_16_1_, versioneta2_.COD_CNV as COD33_16_1_, versioneta2_.COD_CMP as COD34_16_1_, versioneta2_.COD_CIP_ADIP_VET as COD35_16_1_, versioneta2_.COD_CGE_MIN_VET as COD36_16_1_, versioneta2_.COD_CFM as COD37_16_1_, versioneta2_.BAR_SAI_VET as BAR38_16_1_, etape3_.COD_ETP as COD1_8_2_, etape3_.LIB_ETP as LIB2_8_2_, etape3_.NBR_MAX_INSC_DEUG as NBR3_8_2_, etape3_.COD_CYC as COD4_8_2_, etape3_.TEM_TYP_OPI as TEM5_8_2_, etape3_.TEM_OUV_DRT_SSO_ETP as TEM6_8_2_, etape3_.TEM_COU_ACC_TRV_ETP as TEM7_8_2_, etape3_.NBR_MAX_IAE_AUT as NBR8_8_2_, etape3_.LIC_ETP as LIC9_8_2_, etape3_.COD_CUR as COD10_8_2_, etape3_.COD_ACT as COD11_8_2_, composante4_.COD_CMP as COD1_5_3_, composante4_.LIB_CMP as LIB2_5_3_, composante4_.LIB_WEB_CMP as LIB3_5_3_, composante4_.INT_2_EDI_DIP_CMP as INT4_5_3_, composante4_.INT_1_EDI_DIP_CMP as INT5_5_3_, composante4_.COD_SIG as COD6_5_3_, composante4_.NUM_ORD_CMP as NUM7_5_3_, composante4_.TEM_MIN_CMP as TEM8_5_3_, composante4_.LIM3_CMP as LIM9_5_3_, composante4_.LIM2_CMP as LIM10_5_3_, composante4_.LIM1_CMP as LIM11_5_3_, composante4_.COD_NAT_CMP as COD12_5_3_, composante4_.TEM_EN_SVE_CMP as TEM13_5_3_, composante4_.TEM_ELC_CMP as TEM14_5_3_, composante4_.TEM_COU_ACC_TRV_CMP as TEM15_5_3_, composante4_.COD_COM_ADR_CMP as COD16_5_3_, composante4_.COD_POS_ADR_CMP as COD17_5_3_, composante4_.LIB_AD3_CMP as LIB18_5_3_, composante4_.LIB_AD2_CMP as LIB19_5_3_, composante4_.LIB_AD1_CMP as LIB20_5_3_, composante4_.LIB_CMT_CMP as LIB21_5_3_, composante4_.LIC_CMP as LIC22_5_3_, composante4_.COD_RNE_CMP as COD23_5_3_, composante4_.COD_TPC as COD24_5_3_ from VET_REGROUPE_LSE listeeleme0_ left outer join LISTE_ELP listeeleme1_ on listeeleme0_.COD_LSE=listeeleme1_.COD_LSE left outer join VET_REGROUPE_LSE listeeleme1_1_ on listeeleme1_.COD_LSE=listeeleme1_1_.COD_LSE left outer join VERSION_ETAPE versioneta2_ on listeeleme1_1_.COD_ETP=versioneta2_.cod_vrs_vet and listeeleme1_1_.COD_VRS_VET=versioneta2_.cod_etp left outer join ETAPE etape3_ on versioneta2_.COD_ETP=etape3_.COD_ETP left outer join COMPOSANTE composante4_ on versioneta2_.COD_CMP=composante4_.COD_CMP where listeeleme0_.COD_ETP=? and listeeleme0_.COD_VRS_VET=? - (AbstractBatcher.java:393 - org.hibernate.SQL)
2007-06-11 09:41:56,199 ERROR - ORA-01722: invalid number
                         - (JDBCExceptionReporter.java:78 - org.hibernate.util.JDBCExceptionReporter)



the following code works on my production server (tomcat+jvm sun)
but does'nt work on my developement server (OC4j+jvm oracle)

When i invert the field definition order, that works on my developement server, but bug on my production server.

Code:
    @OneToMany
    @JoinTable(
         name="VET_REGROUPE_LSE",
         inverseJoinColumns = { @JoinColumn( name="COD_LSE")} ,
         joinColumns = {@JoinColumn( name="COD_VRS_VET"),@JoinColumn( name="COD_ETP")})
    public List<ListeElementPedagogique> getListeElementPedagogiqueList() {
     return listeElementPedagogiqueList;
    }


Any suggestions?
Is this a bug ?

EM 3.2.1
hibernate 3.2.1


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.