-->
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: Projections Help (using with JSf)
PostPosted: Tue Nov 27, 2007 11:14 am 
Newbie

Joined: Tue Nov 27, 2007 10:34 am
Posts: 1
I have this projection that passes a list to a bean:
Code:
public List projectNames()
   {

      Criteria criteria = this.getSession().createCriteria(User.class)
      .setProjection( Projections.projectionList(Projections.projectionList()
      .add( Projections.property("user_ID"))
      .add( Projections.property("user_Name"))
      );
      
      return criteria.list();


And when I try to retrieve the data for a jsf datatable I get results like
Code:
User ID: [Ljava.lang.Object;@14782b2
User Name: [Ljava.lang.Object;@14782b2
...
etc (but displayed in a table)


When I just add 1 projection property it works fine... by simplying using mylist.get(0).toString() mylist.get(1).toString() etc in the Bean
Code:
public List projectNames()
   {

      Criteria criteria = this.getSession().createCriteria(User.class)
      .setProjection( Projections.projectionList(Projections.projectionList()
      .add( Projections.property("user_Name"))
      );
      
      return criteria.list();

Code:
User Name: John51
User Name: Mark65
...
etc (but displayed in a table)

Ive searched all over and cant find a solution...
Does anyone know any examples or sites that expain how to deal with this?

Or does anyone know a better way to do this? (simply display info from a database table in a datatable using jsf and hibernate)
Thanks for any help


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.