-->
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.  [ 1 post ] 
Author Message
 Post subject: Bug in PersistentClass.getRecursiveProperty
PostPosted: Fri Mar 10, 2006 2:32 am 
Newbie

Joined: Fri Mar 10, 2006 1:43 am
Posts: 1
Hi all,

I am posting here because did not found a place to report bugs.

Well, there comes:

I am using getRecursiveProperty(String propertyPath) because i am building a database component suite, using hibernate and Swing.

When i try to retrieve an property of Modelo class (categoria.descricao) with getRecursiveProperty, it raises a java.lang.ClassCastException

Because documentation of this method is poor (or none) , i decided debug the source, and found the exact point (Line 356 on PersistentClass.java):

//flat recursive algorithm
property = ( (Component) property.getValue() ).getProperty(element);

i am not sure, but i think (IMHO) the line should be changed to :
//flat recursive algorithm
property = property.getPersistentClass().getProperty(element);

Congratulations by this powerfull framework, and sorry by my poor english.

regards,

Carlos A. C. de Lima ( MacLeod )


Hibernate version:
3.1

Mapping documents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="br.com.highlands.extasy.model.inventario.Categoria">
<!-- Identificador da classe -->
<id name="idcategoria">
<generator class="native"/>
</id>
<!-- Propriedades da classe -->
<property name="descricao"/>
<many-to-one name="categoriapai" column= "idcategoriapai"/>
</class>
</hibernate-mapping>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="br.com.highlands.extasy.model.inventario.Modelo">
<!-- Identificador da classe -->
<id name="idmodelo">
<generator class="native"/>
</id>
<!-- Propriedades da classe -->
<property name="codigo"/>
<property name="descricao"/>
<many-to-one name="categoria" class="br.com.highlands.extasy.model.inventario.Categoria" column= "idcategoria"/>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

PersistentClass persistentClass = HibernateFactory.getConfiguration().getClassMapping(Modelo.class.getName());
Property p = persistentClass.getRecursiveProperty("categoria.descricao");


Full stack trace of any exception that occurs:
java.lang.ClassCastException
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:356)
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:334)
at br.com.highlands.extasy.hibernate.MappingUtils.getPropertyMapping(MappingUtils.java:22)
at br.com.highlands.extasy.NewJFrame.criaGrid(NewJFrame.java:144)
at br.com.highlands.extasy.NewJFrame.<init>(NewJFrame.java:54)
at br.com.highlands.extasy.NewJFrame.main(NewJFrame.java:47)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.