Mike Watts

Greenhorn
+ Follow
since Aug 17, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Watts

Hi Folks,

I have this latency issue when trying to retrieve records from the database. I'm running EJB3 with Hibernate Persistence on a Tomcat 6.1 server. Database is SQL Server 2005, front-end is JSF.

The problem is it takes forever for a query to return entities using this set up. If I run the query itself on the database directly, it takes less than a second. So i know the query is not taking long.

Here's a little sample code. When calling qsummary.getResultList(), this goes out to the DB and this is where it takes a long time to execute. 100 rows can take up to almost a minute

public List<Data> getData( DataQuery p_query, Integer cm ) {

createEntityManager( );
StringBuffer query = new StringBuffer("SELECT TOP 10 * FROM tableData");


applyWhereClause(p_query, query);
if (cm != null )
query.append("AND ClearingMember = :cm ");

RowCounter.getInstance( ).resetCounter( );
Query qsummary = em.createNativeQuery(query.toString(), Data.class);
applyParameters( p_query, qsummary );

if (cm != null )
qsummary.setParameter( "cm", cm );

/** QUERY STRING **/
System.out.println(query.toString());

List<Data> results = ( List<Data> )qsummary.getResultList();
closeEntityManager();
return results;

}

Anyone have an idea what can potentially be the problem?
I passed the SCJP5 test today at a local Prometric center. My results were given to me and they said "You Passed, Congratulations". That was it. Nothing else. My question is, How does Prometric know that I passed. Am I suppose to have done anything else. Ex. Sign any paperwork or receive confirmation that I passed? Is there a way to check the status of the certification process? It just seemed to simple to be true. Nothing else was done when I was there.

One last question, I hear that once you past the certification test, you can get a logo that signifies that you are Sun Certified. Where/how can I go about getting this logo.

Thanks for all your help.
I am using the command line to view the file. I can use "more" or the VI editor. The file essentially comes from a C-program that prints out to a file containing English and German text. I can view the output (from the C program) fine using the command line. But through Java, its not correctly coming out.

I will also try and specify the charsets to see if that fixes the problem.

Another question:

Is there a way to insert text into a file without reading through the whole file, inserting the text, and then writing it out again.

I deal with thousands of text files with over 100,000 of lines. It takes quite some time to do such a thing.

The way I have been doing it is not very effecient. I read through the whole file, store each line into a Collection while checking for conditions, and then if the condition is true, I insert some text. After my readline=null, I write out my Collection line by line to a new file.

Thanks in advance!
18 years ago
Is there a way to Read in a file which contains English and German text, and then writing it out to another file?

Here is my problem:

I am reading in a file (which contains mostly English Text with a little German). I use a FileReader and then putting it into a BufferedReader. I read it line by line searching for particular strings (English text) and then storing it to an ArrayList. After I'm done, using a BufferedWriter,I write out to a file which contains all the Strings in my ArrayList. The problem is when there are German/Foreign text, for example W�HRUNG , it is coming out as W?HRUNG. The special characters are not being converted.

I would like to thank you in advance for any advice given.

~Mike
18 years ago