Hibernate version:
3.2
Mapping documents:
This is the mapping document of my class, wich I want to persist data
Code:
<hibernate-mapping>
<class name="br.com.guepardus.coliseum.entidades.Clube" table="Clube">
<id name="id" column="CODIGO">
<generator class="sequence">
<param name="sequence">GEN_PK_CLUBE</param>
</generator>
</id>
<property name="nomeFantasia" column="NOMEFANTASIA"/>
<property name="CNPJ" column="CNPJ"/>
<property name="razaoSocial" column="RAZAOSOCIAL"/>
<property name="modalidade" column="MODALIDADE"/>
<property name="endereco" column="ENDERECO"/>
<property name="telefone" column="TELEFONE"/>
<property name="localLogo" column="LOCALLOGO"/>
<one-to-one name="responsavel"
class="br.com.guepardus.coliseum.entidades.Diretoria"/>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
no stacktrace, but one problem... I'll explain above...
Name and version of the database you are using:
Firebird 1.5 Dialect3
The generated SQL (show_sql=true):
To get the the data from this table to set on my Class "Clube" I got this SQL:
select clube0_.CODIGO as CODIGO6_2_, clube0_.NOMEFANTASIA as NOMEFANT2_6_2_, clube0_.CNPJ as CNPJ6_2_, clube0_.RAZAOSOCIAL as RAZAOSOC4_6_2_, clube0_.MODALIDADE as MODALIDADE6_2_, clube0_.ENDERECO as ENDERECO6_2_, clube0_.TELEFONE as TELEFONE6_2_, clube0_.LOCALLOGO as LOCALLOGO6_2_, diretoria1_.CODIGO as CODIGO8_0_, diretoria1_.CARGO as CARGO8_0_, pessoa2_.CODIGO as CODIGO2_1_, pessoa2_.NOME as NOME2_1_, pessoa2_.DATANASC as DATANASC2_1_, pessoa2_.SEXO as SEXO2_1_, pessoa2_.CIDADE as CIDADE2_1_, pessoa2_.ESTCIVIL as ESTCIVIL2_1_, pessoa2_.NATURALIDADE as NATURALI7_2_1_, pessoa2_.NACIONALIDADE as NACIONAL8_2_1_, pessoa2_.RG as RG2_1_, pessoa2_.ORGEXPED as ORGEXPED2_1_, pessoa2_.CPF as CPF2_1_, pessoa2_.CERTRESERV as CERTRESERV2_1_, pessoa2_.TITUELEIT as TITUELEIT2_1_, pessoa2_.ZONAELEIT as ZONAELEIT2_1_, pessoa2_.SECAOELEIT as SECAOELEIT2_1_, pessoa2_.CTPS as CTPS2_1_, pessoa2_.PASSAPORTE as PASSAPORTE2_1_, pessoa2_.DATAVALIDADE as DATAVAL18_2_1_, pessoa2_.BANCO as BANCO2_1_, pessoa2_.AGENCIA as AGENCIA2_1_, pessoa2_.CONTACORR as CONTACORR2_1_, pessoa2_.REGCBFS as REGCBFS2_1_, pessoa2_.REGFEDERA as REGFEDERA2_1_ from Clube clube0_ left outer join Diretoria diretoria1_ on clube0_.CODIGO=diretoria1_.CODIGO left outer join Pessoa pessoa2_ on diretoria1_.CODIGO=pessoa2_.CODIGO where clube0_.CODIGO=?
in this query, Pessoa is one table, wich is linked to Diretoria on one-to-one, and Diretoria, that is another table, linked to clube on one-to-one.
Well, the problem I've got is that when I persist a new row in the table Clube, with the method session.save(Clube object), the field "RESPONSAVEL" always get null on the database. It should, for example, be the value "1", because I chose in my application, the value "1" on a combo box, and get the object from "Diretoria class" with the ID "1" and set to the Clube.setResponsavel(RESPONSAVEL that came from hibernate with code "1") to persist in the database.
So the question is... why is this field getting null? Could be something in the mappping?
Thanks in advance