473,799 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

returning database records via arraylist

Dan
Hello,

I'm getting started on my first java project. I'm likely going to use
jsp/servlets connected to javabeans. The beans will connect to my
backend and get/set information for me. When returning database
records from the bean, what common methods to people use? I've seen
records returned as arraylists, but I'm not sure I like this method
too well. To get the information in the next column, I can use
nextElement(), but then I'm required to know the order in which the
columns are returned from the beans. I know this is a matter of
personal preference, but perhaps someone has a method they're
particularly fond of. It seems that passing the resultset directly
would work better.
Jul 17 '05 #1
3 7353
Dan,

Have you looked into using a framework for your servlets? I highly
recommend the Spring Framework (www.springframework.org) for the
framework, and iBATIS (www.ibatis.com) for your database layer.

These excellent frameworks will handle what your asking for, and then
some. I would gladly write you a very simple web app using the above,
and comment it for you.

Josh

Dan wrote:
Hello,

I'm getting started on my first java project. I'm likely going to use
jsp/servlets connected to javabeans. The beans will connect to my
backend and get/set information for me. When returning database
records from the bean, what common methods to people use? I've seen
records returned as arraylists, but I'm not sure I like this method
too well. To get the information in the next column, I can use
nextElement(), but then I'm required to know the order in which the
columns are returned from the beans. I know this is a matter of
personal preference, but perhaps someone has a method they're
particularly fond of. It seems that passing the resultset directly
would work better.

Jul 17 '05 #2
Dan
Haven't heard of this framework. I was going to go with some model 2
architecture, such as several controller servlets and some jsp pages
for views. The controller servlets would set up some parameters and
then call on javabeans to perform some of the business logic. Does
spring work along these lines? How does it treat recordsets?

Josh Eckerman <j.************ **@NOJUNKmchsi. com> wrote in message news:<Fr_0d.178 874$Fg5.68562@a ttbi_s53>...
Dan,

Have you looked into using a framework for your servlets? I highly
recommend the Spring Framework (www.springframework.org) for the
framework, and iBATIS (www.ibatis.com) for your database layer.

These excellent frameworks will handle what your asking for, and then
some. I would gladly write you a very simple web app using the above,
and comment it for you.

Josh

Dan wrote:
Hello,

I'm getting started on my first java project. I'm likely going to use
jsp/servlets connected to javabeans. The beans will connect to my
backend and get/set information for me. When returning database
records from the bean, what common methods to people use? I've seen
records returned as arraylists, but I'm not sure I like this method
too well. To get the information in the next column, I can use
nextElement(), but then I'm required to know the order in which the
columns are returned from the beans. I know this is a matter of
personal preference, but perhaps someone has a method they're
particularly fond of. It seems that passing the resultset directly
would work better.

Jul 17 '05 #3
If you like ArrayList you can use it as list and as array too:
ArrayList a = new ArrayList();
a.add("1"); a.add("2"); a.add("3"); a.add("4");
for (int i=0;i<a.size(); i++) System.out.prin tln(i+") "+a.get(i)) ;

Alex Kizub.

Dan wrote:
Hello,

I'm getting started on my first java project. I'm likely going to use
jsp/servlets connected to javabeans. The beans will connect to my
backend and get/set information for me. When returning database
records from the bean, what common methods to people use? I've seen
records returned as arraylists, but I'm not sure I like this method
too well. To get the information in the next column, I can use
nextElement(), but then I'm required to know the order in which the
columns are returned from the beans. I know this is a matter of
personal preference, but perhaps someone has a method they're
particularly fond of. It seems that passing the resultset directly
would work better.


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4079
by: news | last post by:
Hi there, Looking for a way of returning the Xth to Yth records of an Oracle database I thought using ROWNUM. Here is the solution I came up with. SELECT * FROM ( SELECT ROWNUM RECID, t.*,
4
1809
by: brent | last post by:
Currently our application is reading from the web.config, and retrieves a section, "softwareRequirements". Because the section will begin to grow dramatically, I'd like to place it in the SQL database instead. I've imported the values, and am retrieving them as FOR XML AUTO in the stored proc to mimic the structure in the web.config. I'm confused now - what data type is being returned by...
1
2068
by: Matthias De Ridder | last post by:
Hello, I really hope that someone will be able to help me, because I'm desperate now! I'm a student, graduating this year, and I'm working on a thesis where C# Web Services are involved. I only have three weeks to finish it all! My GUI and Web services were finished, but I hadn't tested them. So I linked the GUI to the Web service and started testing them.
5
19601
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
10
4741
by: Sek | last post by:
I have a property that returns a ArrayList object. On failure condition, is it right to return null or return an ArrayList object with zero elements?
6
1528
by: oaklander | last post by:
I have this part of a class that outputs fake data in my Tomcat 4.17 container. Now I want to substitute the fake data for real data that fetches the field value of lastname records from the Oracle database, but not sure how? public static final int INIT_SIZE = 32; private String strs = null; public MyContentGenerator() { strs = new String; for (int i=0; i<INIT_SIZE; i++) {
2
2636
by: =?Utf-8?B?RHJldw==?= | last post by:
I have a current requirement to all a subsidiary to use a current legacy application and interface with my new system to inject data when appropriate. I wanted to create a web service since we are both .Net shops and this would seem to be the easiest method. But I ran into one snafu. I wanted to return to the subsidiary an ArrayList of my Organization objects which contain the orgs id, name etc. so they can use that information in the data...
3
6670
rsmccli
by: rsmccli | last post by:
Access 2002 Hi. I have a command button that will "approve" all records currently being looked at by an "approver". For some reason, even though there are multiple records that exist in the recordsetclone, EOF is returning true. I think this may have something to do with the sort order of the underlying query, but I'm not sure; at any rate, I don't want to change the sort order. I thought you had to check for BOF and EOF, or at least EOF before...
1
2150
by: AllBeagle | last post by:
Hello Everyone, I'm trying to build a web-based application for a client of mine and I keep finding holes in my design, so I could use some guidance if anyone has any to offer. Let me try to explain what it is I'm trying to do and hopefully someone has an idea that's not going to take me a long time to implement and isn't above my not-so-advanced skill level. My attempts with data tables and arraylists have failed thus far. Looks like my...
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.