-->
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.  [ 3 posts ] 
Author Message
 Post subject: could not determine a property type
PostPosted: Wed Jan 11, 2006 10:38 am 
Newbie

Joined: Fri Jan 06, 2006 12:23 pm
Posts: 11
Hi, I'm having the following error, but I don't know what to do.
This is the error:

"could not determine a property type".

I have a "Persona" class like this:


using System;
using System.Collections;

namespace NHibernateWinForms
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Persona
{
public Persona()
{
//
// TODO: Add constructor logic here
//
}

int _id = 0;
string _nombre = "";
string _apellido = "";
IList _direcciones = new ArrayList(); // Uno a muchos

public int Id
{
get{return _id;}
set{_id = value;}
}

public string Nombre
{
get{return _nombre;}
set{_nombre = value;}
}

public string Apellido
{
get{return _apellido;}
set{_apellido = value;}
}

public IList Direcciones
{
get { return this._direcciones; }
}
}
}




And a "Direcciones" class like this:

using System;

namespace NHibernateWinForms
{
/// <summary>
/// Summary description for Direccion.
/// </summary>
public class Direccion
{
public Direccion()
{
//
// TODO: Add constructor logic here
//
}

int _id = 0;
int _numero = 0;
int _piso = 0;
int _personaId = 0;
string _tipo = "";
string _calle = "";
string _depto = "";
string _telefono = "";
Persona _persona = new Persona(); // Muchos a uno

public int Id
{
get{return _id;}
set{_id = value;}
}

public int Numero
{
get{return _numero;}
set{_numero = value;}
}

public int Piso
{
get{return _piso;}
set{_piso = value;}
}

public string Tipo
{
get{return _tipo;}
set{_tipo = value;}
}

public string Calle
{
get{return _calle;}
set{_calle = value;}
}

public string Depto
{
get{return _depto;}
set{_depto = value;}
}

public string Telefono
{
get{return _telefono;}
set{_telefono = value;}
}

public Persona Persona
{
get { return this._persona; }
set
{
this._persona = value;
if (value != null)
{
this._personaId = value.Id;
}
}
}
}
}



In the xml I wrote the next:

<class name="NHibernateWinForms.Persona, NHibernateWinForms" table="Persona" discriminator-value="?">
<id name="Id" column="PersonaId" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Nombre" column="PersonaNombre" not-null="false" />
<property name="Apellido" column="PersonaApellido" not-null="false" />
<property name="Direcciones" column="PersonaDireccion" not-null="false" />
<bag name="Direcciones" cascade="all" access="nosetter.camelcase" lazy="false" inverse="true">
<key column="PersonaId" />
<one-to-many class="NHibernateWinForms.Direccion, NHibernateWinForms" />
</bag>
</class>




<class name="NHibernateWinForms.Direccion, NHibernateWinForms" table="Direccion" discriminator-value="?">
<id name="Id" column="DireccionId" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Tipo" column="DireccionTipo" not-null="true" />
<property name="Calle" column="DireccionCalle" not-null="true" />
<property name="Numero" column="DireccionNumero" not-null="true" />
<property name="Piso" column="DireccionPiso" not-null="false" />
<property name="Depto" column="DireccionDepto" not-null="false" />
<property name="Telefono" column="DireccionTelefono" not-null="false" />
<many-to-one name="Persona" column="PersonaId" class="NHibernateWinForms.Persona, NHibernateWinForms" cascade="none" />
</class>




But I get that error.
I don't know what exactly it means.
I have a "Persona" table, and a "Direccion" table.
The "Direccion" talbe has a foreign key to the Person table.

What I'm doing wrong?


Thanks a lot !!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 10:40 am 
Newbie

Joined: Fri Jan 06, 2006 12:23 pm
Posts: 11
The exact error is:

"could not determine a property type for: Direcciones"

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 11:03 am 
Newbie

Joined: Fri Jan 06, 2006 12:23 pm
Posts: 11
I found the error.
I feel so stupid... :(

In the Persona.hbm.xml, I have two lines describing the "Direcciones" property.
That's because at first, I only have one "Direccion" per "Persona", but then I have to replace that, adding the "<bag>" tag and stuff, but I didn't delete the other line.

Anyway...


Thanks.


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