Tanel Alumae

+ Follow
since Aug 26, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tanel Alumae

Check the tutorial.
Rather toward the end of the tutorial there's a code sample that has the following comment:

This might be fixed in a later version of torque.
Check this tutorial anyway, it has a good sample how to use foreign keys.
17 years ago
Factory methods are indeed expected to return the object they create. You say that instead of returning the object, it puts it into a collection. Have you thought of refactoring the method to a real factory method, and then creating another method that calls the factory method and puts the result in the collection? Something like:
Well, check out the JBoss Forums. There are both JBoss specific as well as general J2EE sections.
JBoss, as you probably know, is one of the best open-source J2EE servers.
Have you taken a look at RefactorIT? Besides automatic refactoring, it can also calculate and display around 20 different source metrics. Integrates with many IDEs. It's a commercial tool but you can get an evaluation version. Also there is a freeware license for projects with up to 50 source files.
I modestly recommend using RefactorIT. Integrates with NetBeans/Forte, JBuilder, JDeveloper. Evaluation version available.
Actually, I think doing this with Jakarta Torque is even simpler.
Have you taken a look at Castor?
Usually this happens when one tries to put the field value directly into the SQL statement. Are you using parameters?
I have to mention that your post is quite messy. First, if you post any code, put it between the CODE tags using the button below the text box where you enter the text. Next, you say that the compiler says that the expression f.createFile() has problems, but your code doesn't even seem to have that line, so I assume that you mean the expression f.createNewFile(). Third, you don't mention what does the compiler say about that line. Probably you are just not catching the IOException that the method can throw. Alternatively you can declare the main method to throw that exception.
[ September 11, 2002: Message edited by: Tanel Alumae ]
18 years ago
A search on Google on "simple java web server" gives a good starting point, a page at the Sun java site.
It shouldn't be a problem as long as you are sure that you close the ResultSet after using it.
But, I think a better ways is to convert the ResultSet to a List or array of objects that encapsulate the data that is in the ResultSet and return that List (or array). That way, the client class does not have to care about the details of ResultSet closing and it even doesn't need to know that the data is coming from a relational database.
Connection pooling is usually done to improve application performance and decrease the load on the database.
DriverManager is only responsible for creating new connection to the database. As you probably know, creating a connection and logging in to the database is relatively time-consuming. Therefore, connection pool is often used. A connection pool is like a facade to the DriverManager. Application can use the Connection Pool to ask for a connection to database. Connection Pool caches the connections to the database. This means that once an application ends using a database connection (e.g. at the end of transaction), Connection Pool does not release it, but reuses it when the application asks for the connection again. Anyway, you can find much information on this topic for example here.
[ September 09, 2002: Message edited by: Tanel Alumae ]
If I understand correctly, what you want to do is called resultset paging.
You can find much information on this topic in this thread
An exhaustive review of the topic with implementation is given in this article at serverside.com
[ September 09, 2002: Message edited by: Tanel Alumae ]
There are numerous methods in the DatabaseMetaData inteface for querying for existing tables, schemas, stored procedures, etc.
If the jdbc driver of your database doesn't support it, you can use a direct SQL query on the database metadata (e.g. "select table_name from user_tables" in Oracle) but then you lose portability.
Hope this helps.