[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-1909) Incomplete insert and update using <<insert="false" update="false">>
Gail Badner (JIRA)
noreply at atlassian.com
Tue Aug 17 15:56:41 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner resolved HHH-1909.
------------------------------
Assignee: Gail Badner
Resolution: Rejected
Please use the user forum (https://forum.hibernate.org/) for help.
> Incomplete insert and update using <<insert="false" update="false">>
> --------------------------------------------------------------------
>
> Key: HHH-1909
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1909
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0 final
> Reporter: Peppe
> Assignee: Gail Badner
> Priority: Critical
>
> Hi, I've seen lots of people have problems using complex mappings.
> This is my situation, I've three mappings:
> <hibernate-mapping>
> <class name="unibiblio.dati.anagrafica.DAO.Persone" table="persone">
> <composite-id name="id" class="unibiblio.dati.anagrafica.DAO.PersoneId">
> <key-property name="idUtente" type="java.lang.Integer">
> <column name="id_utente" />
> </key-property>
> <key-property name="codbib" type="java.lang.Integer">
> <column name="codbib" />
> </key-property>
> </composite-id>
> <many-to-one name="dizTitolidistudio" class="unibiblio.dati.anagrafica.DAO.DizTitolidistudio" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" />
> <column name="codice_titolostudio" length="1" />
> </many-to-one>
> <many-to-one name="dizLingue" class="unibiblio.dati.anagrafica.DAO.DizLingue" fetch="select">
> <column name="lingua" length="2" />
> </many-to-one>
> <many-to-one name="dizProfessioni" class="unibiblio.dati.anagrafica.DAO.DizProfessioni" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" />
> <column name="codprofessione" length="2" not-null="true" />
> </many-to-one>
> <property name="userName" type="string">
> <column name="user_name" length="30" />
> </property>
> <property name="password" type="string">
> <column name="password" length="30" />
> </property>
> .
> .
> .
> .
> .
> .
> </class>
> </hibernate-mapping>
> <hibernate-mapping>
> <class name="unibiblio.dati.anagrafica.DAO.DizTitolidistudio" table="diz_titolidistudio">
> <composite-id name="id" class="unibiblio.dati.anagrafica.DAO.DizTitolidistudioId">
> <key-property name="lingua" type="string">
> <column name="lingua" length="2" />
> </key-property>
> <key-property name="codiceTitolostudio" type="string">
> <column name="codice_titolostudio" length="1" />
> </key-property>
> </composite-id>
> <many-to-one name="dizLingue" class="unibiblio.dati.anagrafica.DAO.DizLingue" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" not-null="true" />
> </many-to-one>
> <property name="titolo" type="string">
> <column name="titolo" length="50" not-null="true" />
> </property>
> <set name="persones" inverse="true">
> <key>
> <column name="lingua" length="2" />
> <column name="codice_titolostudio" length="1" />
> </key>
> <one-to-many class="unibiblio.dati.anagrafica.DAO.Persone" />
> </set>
> </class>
> </hibernate-mapping>
> <hibernate-mapping>
> <class name="unibiblio.dati.anagrafica.DAO.DizProfessioni" table="diz_professioni">
> <composite-id name="id" class="unibiblio.dati.anagrafica.DAO.DizProfessioniId">
> <key-property name="lingua" type="string">
> <column name="lingua" length="2" />
> </key-property>
> <key-property name="codprofessione" type="string">
> <column name="codprofessione" length="2" />
> </key-property>
> </composite-id>
> <many-to-one name="dizLingue" class="unibiblio.dati.anagrafica.DAO.DizLingue" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" not-null="true" />
> </many-to-one>
> <property name="professione" type="string">
> <column name="professione" length="50" />
> </property>
> <set name="persones" inverse="true">
> <key>
> <column name="lingua" length="2" />
> <column name="codprofessione" length="2" not-null="true" />
> </key>
> <one-to-many class="unibiblio.dati.anagrafica.DAO.Persone" />
> </set>
> </class>
> </hibernate-mapping>
> The problem is when I try to insert a new persone it make an incomplete SQL statement because
> <<update="false" insert="false">> in <many-to-one name="dizTitolidistudio"> and <many-to-one name="dizProfessioni">
> causes hiding setting of columns "codice_titolostudio" and "codprofessione" in the generated SQL
> Deleting that tag, of course, give me the exception
> ERROR [STDERR] org.hibernate.MappingException: Repeated column in mapping for entity: unibiblio.dati.anagrafica.DAO.Persone column: lingua (should be mapped with insert="false" update="false")
>
> I workarounded this extracting "codice_titolostudio" and "codprofessione" as properties in Persone and setting them with
> classes but I don't like this. Am I wrong or is it a bug?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list