-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate and Struts
PostPosted: Wed Oct 08, 2003 1:31 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hi,

I

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 08, 2003 2:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Take a look at the new keyword syntax in the docs.

It allows you to do: "select new Person(p.name, p.address) from Person p"

thus returning Persion objects.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 08, 2003 2:33 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
But if I use some columns of other tables????

or using joins????

The result will be List of Object[].

_________________
Tads


Top
 Profile  
 
 Post subject: Lightweight
PostPosted: Wed Oct 08, 2003 3:40 pm 
Senior
Senior

Joined: Sun Aug 31, 2003 3:14 pm
Posts: 151
Location: Earth (at the moment)
Try using the lightweight pattern:
http://www.hibernate.org/41.html
Or, if you don't need updateable objects just make a view in your database that has the joins you are looking for and make a simple class to map to the view.

Maybe a better answer would be, "Yes, I think you do need to create a new bean".


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 08, 2003 3:49 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Thanks for help me,

[]

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 08, 2003 4:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
tads wrote:
But if I use some columns of other tables????

or using joins????

The result will be List of Object[].



eh -no ?

"select new Whatever(x,y,z,v) from X as x, Y as y, Z as z, V as v ...."

You just need a valuebean that takes all the arguments as constrcutor.



and besides, if you get an Object[] the actual data referred is of the correct type and you should be able to jsut create the stuff by hand...right ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: I don't understand that
PostPosted: Fri Oct 10, 2003 3:58 pm 
Newbie

Joined: Thu Oct 09, 2003 9:50 am
Posts: 2
Location: Brazil
I don't understand that

_________________
Rodrigo Magno
Powerlogic Consultoria e Sistemas Ltda


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 10, 2003 5:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
And I don't understand your not understanding :)

What is it you do not understand here. Say your have a class:
Code:
public class MyReportBean
{
    private String someString;
    private Integer someInteger;
    MyReportBean(String someString, Integer someInteger)
    {
        this.someString = someString;
        this.someInteger = someInteger;
    }
    ...
}


Hibernate lets you do something like:
"select new MyReportBean(x.stringProp, w.integerProp) from X as x..."
which will return a collection of MyReportBean instances.


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