Bonjour à tous,
Lorsque j'exécute une requête d'insert avec hibernate, j'ai le message suivant:
org.hibernate.QueryException: can only generate ids as part of bulk insert with either sequence or post-insert style generators
Ma requete resemble à ceci vou remarquerez que je n'ai pas réécrit toutes mes collones ici, ce que je fais bien sur dans le code que j'éxécute.
i
nsert into Acashdetails (sysDetailsId, sysHeaderId,...) Select sysDetailsId, sysHeaderId ... from CashDetails where (condition)
Je désire récupérer les certaines valeurs d'une table et les insérer dans la seconde. Ces deux tables ont la même struceture. VOici à quoi resemble les fichiers de mapping que j'ai utilisé pour ces tables:

<hibernate-mapping>
<class entity-name="CashDetails" table="cashdetails" catalog="xms_sb_prg">
<id name="sysDetailsId" type="long">
<column name="SYS_DetailsId" />
<generator class="assigned" />
</id>
<property name="sysHeaderId" type="java.lang.Long">
<column name="SYS_HeaderId" />
</property>
<property name="sysTimestamp" type="timestamp">
<column name="SYS_Timestamp" length="19" />
</property>
<property name="valueDate" type="string">
<column name="ValueDate" length="35" />
</property>
<property name="entryDate" type="string">
<column name="EntryDate" length="35" />
</property>
<property name="dcmark" type="string">
<column name="DCMark" length="2" />
</property>
<property name="fundsCode" type="string">
<column name="FundsCode" length="10" />
</property>
<property name="amount" type="big_decimal">
<column name="Amount" precision="38" scale="6" />
</property>
<property name="transactionTypeId" type="string">
<column name="TransactionTypeId" length="35" />
</property>
<property name="accountOwnerRef" type="string">
<column name="AccountOwnerRef" length="155" />
</property>
<property name="accountServicingInstRef" type="string">
<column name="AccountServicingInstRef" length="155" />
</property>
<property name="supplementaryDetails" type="string">
<column name="SupplementaryDetails" />
</property>
<property name="businessSpecific1" type="string">
<column name="BusinessSpecific1" length="35" />
</property>
<property name="businessSpecific2" type="string">
<column name="BusinessSpecific2" length="35" />
</property>
<property name="businessSpecific3" type="string">
<column name="BusinessSpecific3" length="35" />
</property>
<property name="businessSpecific4" type="string">
<column name="BusinessSpecific4" length="35" />
</property>
<property name="businessSpecific5" type="string">
<column name="BusinessSpecific5" length="35" />
</property>
<property name="businessSpecific6" type="string">
<column name="BusinessSpecific6" />
</property>
<property name="businessSpecific7" type="string">
<column name="BusinessSpecific7" length="100" />
</property>
<property name="businessSpecific8" type="string">
<column name="BusinessSpecific8" length="35" />
</property>
<property name="businessSpecific9" type="string">
<column name="BusinessSpecific9" length="35" />
</property>
<property name="businessSpecific10" type="string">
<column name="BusinessSpecific10" />
</property>
<property name="sysMatchQuality" type="string">
<column name="SYS_MatchQuality" not-null="true" />
</property>
<property name="sysMatchDate" type="timestamp">
<column name="SYS_MatchDate" length="19" />
</property>
<property name="sysMatchkey" type="java.lang.Long">
<column name="SYS_Matchkey" />
</property>
<property name="sysMatchStatus" type="string">
<column name="SYS_MatchStatus" length="2" not-null="true" />
</property>
<property name="sysMatchIndex" type="java.lang.Integer">
<column name="SYS_MatchIndex" />
</property>
<property name="informationToAccountOwner" type="string">
<column name="InformationToAccountOwner" length="512" />
</property>
<property name="sysArchiveStatus" type="string">
<column name="SYS_ArchiveStatus" length="2" />
</property>
<property name="valorisation" type="big_decimal">
<column name="Valorisation" precision="38" scale="6" />
</property>
<property name="riskLevel" type="string">
<column name="RiskLevel" length="50" />
</property>
</class>
</hibernate-mapping>

<class entity-name="ACashDetails" table="a_cashdetails" catalog="xms_sb_prg">
<id name="sysDetailsId" type="long">
<column name="SYS_DetailsId" />
<generator class="assigned" />
</id>
<property name="sysHeaderId" type="java.lang.Long">
<column name="SYS_HeaderId" />
</property>
<property name="sysTimestamp" type="timestamp">
<column name="SYS_Timestamp" length="19" />
</property>
<property name="valueDate" type="string">
<column name="ValueDate" length="35" />
</property>
<property name="entryDate" type="string">
<column name="EntryDate" length="35" />
</property>
<property name="dcmark" type="string">
<column name="DCMark" length="2" />
</property>
<property name="fundsCode" type="string">
<column name="FundsCode" length="10" />
</property>
<property name="amount" type="big_decimal">
<column name="Amount" precision="38" scale="6" />
</property>
<property name="transactionTypeId" type="string">
<column name="TransactionTypeId" length="35" />
</property>
<property name="accountOwnerRef" type="string">
<column name="AccountOwnerRef" length="155" />
</property>
<property name="accountServicingInstRef" type="string">
<column name="AccountServicingInstRef" length="155" />
</property>
<property name="supplementaryDetails" type="string">
<column name="SupplementaryDetails" />
</property>
<property name="businessSpecific1" type="string">
<column name="BusinessSpecific1" length="35" />
</property>
<property name="businessSpecific2" type="string">
<column name="BusinessSpecific2" length="35" />
</property>
<property name="businessSpecific3" type="string">
<column name="BusinessSpecific3" length="35" />
</property>
<property name="businessSpecific4" type="string">
<column name="BusinessSpecific4" length="35" />
</property>
<property name="businessSpecific5" type="string">
<column name="BusinessSpecific5" length="35" />
</property>
<property name="businessSpecific6" type="string">
<column name="BusinessSpecific6" />
</property>
<property name="businessSpecific7" type="string">
<column name="BusinessSpecific7" length="100" />
</property>
<property name="businessSpecific8" type="string">
<column name="BusinessSpecific8" length="35" />
</property>
<property name="businessSpecific9" type="string">
<column name="BusinessSpecific9" length="35" />
</property>
<property name="businessSpecific10" type="string">
<column name="BusinessSpecific10" />
</property>
<property name="sysMatchQuality" type="string">
<column name="SYS_MatchQuality" not-null="true" />
</property>
<property name="sysMatchDate" type="timestamp">
<column name="SYS_MatchDate" length="19" />
</property>
<property name="sysMatchkey" type="java.lang.Long">
<column name="SYS_Matchkey" />
</property>
<property name="sysMatchStatus" type="string">
<column name="SYS_MatchStatus" length="2" not-null="true" />
</property>
<property name="sysMatchIndex" type="java.lang.Integer">
<column name="SYS_MatchIndex" />
</property>
<property name="informationToAccountOwner" type="string">
<column name="InformationToAccountOwner" length="512" />
</property>
<property name="sysArchiveStatus" type="string">
<column name="SYS_ArchiveStatus" length="2" />
</property>
<property name="valorisation" type="big_decimal">
<column name="Valorisation" precision="38" scale="6" />
</property>
<property name="riskLevel" type="string">
<column name="RiskLevel" length="50" />
</property>
</class>
</hibernate-mapping>
Avec mes entité ainsi déclarées, je parviens à récupérer les données qui se trouvent dans ma base de donnée mysql mais je ne parvient pas à effectuer un insert. Vous remarquerez qu'aucune de mes entité n'est liée à une classe java. Est-ce indispensable de lier mon entité à une classe java? Mes méthodes ne sont sensé faire que de l'archivage rien de plus et je ne voudrais pas avoir la contrainte de recompiler mes classe dès que ma base de donnée sera modifiée.