-->
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.  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ArrayList instead of List in query results??
PostPosted: Tue Oct 25, 2005 1:31 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
Is there any plan to have a hibernate query return an ArrayList instead of a List?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 1:50 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
just build an arraylist out of the list in your code. that's basically what would happen in the hibernate code if they did it.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 1:59 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
ArrayList is implementation and i think that hibernate will do this never

Why you need ArrayList ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 2:07 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
snpespe is right.

but if you're dyin to get that ArrayList made in the code, the result List is built in the SessionImpl.java file :)

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 2:53 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
snpesnpe wrote:
ArrayList is implementation and i think that hibernate will do this never

Why you need ArrayList ?


We use ArrayList in all of our code and I just thought, wouldn't it be nice if I didn't have to convert all the Lists to ArrayLists to use my results.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 2:54 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
kochcp wrote:
snpespe is right.

but if you're dyin to get that ArrayList made in the code, the result List is built in the SessionImpl.java file :)


Nooooooo thanks! I don't want to get into customizing Hibernate code.. :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 2:58 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Quote:
We use ArrayList in all of our code and I just thought, wouldn't it be nice if I didn't have to convert all the Lists to ArrayLists to use my results.


you have to use interface instead implementation


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 3:10 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
sarahsmith_books wrote:

Nooooooo thanks! I don't want to get into customizing Hibernate code.. :-)


sorry, I'm on a change the code kick today.

List can be traversed just like ArrayList because ArrayList implements List so I don't see what the problem is.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 3:21 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
kochcp wrote:
sarahsmith_books wrote:

Nooooooo thanks! I don't want to get into customizing Hibernate code.. :-)


sorry, I'm on a change the code kick today.

List can be traversed just like ArrayList because ArrayList implements List so I don't see what the problem is.


The problem is all of her existing methods are returning ArrayList (bad programming practice but it is what it is) and she has to convert all of the List's to ArrayList before returning them.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 3:31 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
pksiv wrote:
The problem is all of her existing methods are returning ArrayList (bad programming practice but it is what it is) and she has to convert all of the List's to ArrayList before returning them.


well I know that. I guess I didn't understand why they would be returning ArrayLists instead of Lists.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 9:08 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
well guys,
some of us here think they are better. :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 9:12 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
sarahsmith_books wrote:
well guys,
some of us here think they are better. :-)


Care to elaborate ?

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 10:16 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
pksiv wrote:
sarahsmith_books wrote:
well guys,
some of us here think they are better. :-)


Care to elaborate ?


Sorry, I was being facetious. My apololgies. I haven't really questioned why ArrayLists were used to begin with. I'm new to the team. But I'm sure there was a good reason. If I find out, I'll let you know.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:46 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
There wasn't a good reason. Just people who don't really understand what an interface is and what an implementation is.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 7:41 am 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
jamie_dainton wrote:
There wasn't a good reason. Just people who don't really understand what an interface is and what an implementation is.


These people have been programming for zillions of years. I can't believe they wouldn't understand the benefits of interfaces vs implementations.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 20 posts ]  Go to page 1, 2  Next

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.