-->
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: ClassMetadata
PostPosted: Fri Dec 24, 2004 3:37 pm 
Newbie

Joined: Wed Dec 08, 2004 12:28 pm
Posts: 8
I would like to read gladly by this interface ClassMetadata the data from a database. However I can only read data of simple PropertyTyp by the method ClassMetadata.getPropertyValue(Object obj, propertyName) and I cannot read data of CollectionTyp.
Please if someone know how to read data of CollectionTyp by the interface ClassMetadata please writes some solutions.

This is my Mapping name: Category
and a Category has a set of items

<hibernate-mapping package="dms.business">
<class
name="Category"
table="category"
proxy="Category"
>
<id
name="id"
type="integer"
column="id"
>
<generator class="native"/>
</id>

<property
name="description"
column="description"
type="string"
not-null="false"
length="100"
/>
<property
name="name"
column="name"
type="string"
not-null="true"
length="50"
/>

<set
cascade="delete-orphan"
name="items"
table="link_category_item"
inverse="true"
lazy="true"
>
<key column="category_id" />
<one-to-many class="Item" />
</set>

</class>
</hibernate-mapping>


This is the Methode to read the data

public void createRow(Object dao,String names[], ClassMetadata metadata) throws HibernateException
{
for(int j = 0; j < names.length; j++)
{
if(!metadata.getPropertyType(names[j]).isPersistentCollectionType())
{
System.out.println(metadata.getPropertyValue(dao,names[j]));
}
else
{
// How to read PersistentCollection ?
}

}
}


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.