Hi,
First of all, Happy New Year !
Then, I have a problem :-) And it is just the beginning of the year..
My problem is Hibernate.
I try to do a mapping on a view and i'm passing by a composite-id for the ID but i get an error. I dunno if it is a problem in my view table or else.
Here is the mapping file :
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="INTetatACAV.etatACAV.metier.entite" >
<!-- Couche Hibernate des derniers etats en faisant appel à la vue -->
<class name="MIFetatACAV" table="ETAT_ACAV_Pk_view">
<composite-id name="id_acav" class="INTetatACAV.etatACAV.metier.entite.MIFetatACAVPk" >
<key-many-to-one name="idacavattente" column="ID_ACAV_ATTENTE" class="INTetatACAV.etatACAV.metier.entite.MIFAcavAttente" />
<key-many-to-one name="idacavactif" column="ID_ACAV_ACTIF" class="INTetatACAV.etatACAV.metier.entite.MIFAcavActif"/>
<key-many-to-one name="idacavpassif" column="ID_ACAV_PASSIF" class="INTetatACAV.etatACAV.metier.entite.MIFAcavPassif"/>
</composite-id>
<many-to-one insert="false" update="false" name="libellecourt" column="LIBELLE_COURT" class="INTgestiondonnee.produitsupport.metier.entite.MifProduitSupport"></many-to-one>
<many-to-one insert="false" update="false" name="valeur" column="VALEUR" class="INTetatACAV.etatACAV.metier.entite.MIFVL"></many-to-one>
<many-to-one insert="false" update="false" name="montantacava" column="MONTANT_ACAV_A" class="INTetatACAV.etatACAV.metier.entite.MIFAcavActif"></many-to-one>
<many-to-one insert="false" update="false" name="montantacavp" column="MONTANT_ACAV_P" class="INTetatACAV.etatACAV.metier.entite.MIFAcavPassif"></many-to-one>
<many-to-one insert="false" update="false" name="montantacavattente" column="MONTANT_ACAV_ATTENTE" class="INTetatACAV.etatACAV.metier.entite.MIFAcavAttente"></many-to-one>
<many-to-one insert="false" update="false" name="idacavattente" column="ID_ACAV_ATTENTE" class="INTetatACAV.etatACAV.metier.entite.MIFFluxAcav"></many-to-one>
<many-to-one insert="false" update="false" name="idflux" column="ID_FLUX" class="INTetatACAV.etatACAV.metier.entite.MIFFluxAcav"></many-to-one>
</class>
</hibernate-mapping>
I dunno why it puts the composite-key into the select in my request
Here is my View :
Quote:
CREATE OR REPLACE VIEW ETAT_ACAV_Pk_view (
ID_SUPPORT,
VALEUR,
LIBELLE_COURT,
MONTANT_ACAV_A,
MONTANT_ACAV_P,
MONTANT_ACAV_ATTENTE,
ID_ACAV_ATTENTE,
ID_FLUX,
CONSTRAINT Pk_ETAT_ACAV_view PRIMARY KEY (ID_SUPPORT,ID_ACAV_ATTENTE,ID_FLUX) DISABLE NOVALIDATE),
AS
SELECT
ID_SUPPORT ,
VALEUR ,
LIBELLE_COURT ,
MONTANT_ACAV_A ,
MONTANT_ACAV_P ,
MONTANT_ACAV_ATTENTE ,
ID_ACAV_ATTENTE ,
ID_FLUX
FROM ACAV_ATTENTE
INNER JOIN MIF_SUPPORT ON ACAV_ATTENTE.ID_SUPPORT=MIF_SUPPORT.ID_SUPPORT
INNER JOIN VL ON ACAV_ATTENTE.ID_SUPPORT=VL.ID_SUPPORT
INNER JOIN ACAV_ACTIF ON ACAV_ATTENTE.ID_SUPPORT=ACAV_ACTIF.ID_SUPPORT
INNER JOIN ACAV_passif ON ACAV_ATTENTE.ID_SUPPORT=ACAV_PASSIF.ID_SUPPORT
INNER JOIN FLUX_ACAV_ATTENTE ON ACAV_ATTENTE.ID_ACAV_ATTENTE=FLUX_ACAV_ATTENTE.ID_ACAV_ATTENTE
And here is the error message :
Code:
2009-01-02 14:01:47,173 [http-8080-1] DEBUG - [org.hibernate.util.JDBCExceptionReporter::] could not execute query [select mifetataca0_.ID_ACAV_ATTENTE as ID1_22_, mifetataca0_.ID_ACAV_ACTIF as ID2_22_, mifetataca0_.ID_ACAV_PASSIF as ID3_22_, mifetataca0_.LIBELLE_COURT as LIBELLE4_22_, mifetataca0_.VALEUR as VALEUR22_, mifetataca0_.MONTANT_ACAV_A as MONTANT6_22_, mifetataca0_.MONTANT_ACAV_P as MONTANT7_22_, mifetataca0_.MONTANT_ACAV_ATTENTE as MONTANT8_22_, mifetataca0_.ID_FLUX as ID9_22_ from ETAT_ACAV_Pk_view mifetataca0_]
java.sql.SQLException: ORA-00904: "MIFETATACA0_"."ID_ACAV_PASSIF" : identificateur non valide
I might have some problem with the composite key on the ID of the view.
Thanks for some help.