-->
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.  [ 4 posts ] 
Author Message
 Post subject: insert = "false" ?? where?
PostPosted: Thu Aug 25, 2005 7:50 am 
Newbie

Joined: Wed Jul 13, 2005 10:10 am
Posts: 8
Location: Brasil
I did not obtain to find where he arranges this
somebody can help me?

:)

Endereco mapping:
Code:

<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : Endereco.hbm.xml
    Created on : 9 de Agosto de 2005, 09:28
    Author     : gian
    Description:
        Purpose of the document follows.
-->

<!DOCTYPE hibernate-mapping PUBLIC
'-//Hibernate/Hibernate Mapping DTD//En'
'http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd'>

<hibernate-mapping>
    <class
        name = "net.unesc.kiron.uti.map.Endereco"
        table = "ENDERECO">
       
        <id
            name = "codEnder"
            column="CODENDER"
            type="java.lang.Integer">
            <generator class = "sequence"/>
         </id>         

               
             <property
                name="codPac"
                column="CODPAC"
               
                type="java.lang.Integer"/>               
               
               
               
                                     
         <property
            name="logradouro"
            column="LOGRADOURO"
            type="string"/>

         <property
            name="numero"
            column="NUMERO"
            type="java.lang.Integer"/>

           
           
                       
     </class>
</hibernate-mapping>






Paciente mapping:

Code:


<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : Paciente.hbm.xml
    Created on : 8 de Agosto de 2005, 10:48
    Author     : gian
    Description:
        Purpose of the document follows.
-->

<!DOCTYPE hibernate-mapping PUBLIC
'-//Hibernate/Hibernate Mapping DTD//En'
'http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd'>
<hibernate-mapping>
    <class name="net.unesc.kiron.uti.map.Paciente"
           table="PACIENTE">

       
        <id
            name = "codPac"
            column = "CODPAC"
            type = "java.lang.Integer">
            <generator class="sequence"/>
           
     
           
         </id>           
         
         <property
            name = "numeroRegistro"
            column = "NUM_REGISTRO"
            type = "java.lang.Integer"/>
       
         <property
            name = "nome"
            column = "NOME"
            type = "string"/>
           
         <property
            name = "dataNasc"
            column = "DATA_NASC"
            type = "date"/>
           
         <property
            name = "sexo"
            column = "SEXO"
            type = "java.lang.Character"/>

         <property
            name = "fone01"
            column = "FONE01"
            type = "string"/>
           
         <property
            name = "fone02"
            column = "FONE02"
            type = "string"/>
           
         <property
            name = "complemento"
            column = "COMPLEMENTO"
            type = "string"/>
           
           

      <many-to-one name="endereco" cascade="all" class="net.unesc.kiron.uti.map.Endereco" column="CODPAC" not-null="true" />
                   
     </class>
</hibernate-mapping>





this error:
Code:
Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: net.unesc.kiron.uti.map.Paciente column: CODPAC (should be mapped with insert="false" update="false")


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 8:13 am 
Newbie

Joined: Fri Jul 30, 2004 9:02 am
Posts: 9
Location: Ukraine
Hi,
in many-to-one you are using CODPAC column, but id has the same name. So you should use different columns names. Or if you need to join using primary keys, try to find how one-to-one asociation works.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 8:14 am 
Newbie

Joined: Thu Aug 25, 2005 7:59 am
Posts: 1
for you mapped column 'CODPAC' twice

put insert="false", update="false" here:

<many-to-one
name="endereco"
cascade="all"
class="net.unesc.kiron.uti.map.Endereco"
column="CODPAC"
not-null="true"
insert="false"
update="false"
/>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 8:31 am 
Newbie

Joined: Wed Jul 13, 2005 10:10 am
Posts: 8
Location: Brasil
how I make the mapping one-to-one?

this did not give certain

:)


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