I have a two ibatis sql maps that are linked together via a sub select like the simplified example below:
<resultMap id="order" class="Order">
<collection property="orderLines" ofType="OrderLine" resultMap=”orderLine”/>
</resultMap>
I have an order object that contains a collection of line objects that are returned by a join and an ...
If it is possible to auto-format code before and after a source control commit, checkout, diff, etc. does a company really need a standard code style?
It feels like standard coding style debates that have been raging since programming began like "put the bracket on the following line" or "properly indent your (" are no longer essential....
Consider the following source snippets:
Snippet #1
StoredProcedure sp = new StoredProcedure( "PROC_NAME", getConnection() );
sp.putParameter( "ID", getId() );
sp.execute();
Snippet #2
StoredProcedure sp = new StoredProcedure( "PROC_NAME" );
sp.setConnection( getConnection() );
sp.putParameter( "ID", getId() );
sp.execu...
I understand that the Set returned from a Map's keySet() method does not guarantee any particular order.
My question is, does it guarantee the same order over multiple iterations. For example
Map<K,V> map = getMap();
for( K k : map.keySet() )
{
}
...
for( K k : map.keySet() )
{
}
In the above code, assuming that the map is not mo...
I have a java list
List<myclass> myList = myClass.selectFromDB("where clause");
//myClass.selectFromDB returns a list of objects from DB
But I want a different list, specifically.
List<Integer> goodList = new ArrayList<Integer>();
for(int i = 0;i++; i<= myList.size()) {
goodList[i] = myList[i].getGoodInteger();
}
Yes, I could...
Hi there,
atm I'm fetchin a small amount of data (round a bout 100 records) as list and let displaytag render a table for this data. Now I'm facing a problem: I'm in need to show more results at once. If the query results in a size of > 5000 objects everything slows extremly down.
I was wondering if there are any best-practices to reci...
MyFaces Orchestra adds a ?conversationContext=x to each resource on a page. Since I'm not using the conversation scope for the public part of my project (only for the admin part), I'd like to get rid of that parameter for two reasons:
it breaks the browser caching of static resources
it's ugly :)
I'm now going to take a look at Orche...
I am trying to get a sublist of a List but I want the sublist to be serialized. I found out that when we get sublist from an ArrayList the sublist is not serialized.
To overcome this, this is what I am doing:
ArrayList serializedSublist = new ArrayList();
//getQuestions() returns RandomAccessSubList
getQuestions().addAll(serializedSu...
hi, I want to get data from the database(MySQL) by JPA, I wand it sorted by some column value,
So, what is the best practice, to:
Retrieve the data from the database as list of objects (JPA), then sort it programmatically using some java APIs.
OR
Let the database sort it by using a sorting select query.
??
thanx in advance
...
My System.out.println() and System.err.println() calls aren't being printed to the console in the order I make them.
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
System.out.println("out");
System.err.println("err");
}
}
This produces:
out
out
out
out
out
err
err
err
err
err
Instead of alternating out...
I'm reading Effective Java and it uses %n for the newline character everywhere. I have used \n rather successfully for newline in Java programs.
Which is the 'correct' one? What's wrong with '\n' ? Why did Java change this C convention?
...
I have done some reading and playing and I still have some questions I was hoping someone might answer:
So, can I use two or more backing beans in a single JSF page?
<h:intputText value="#{myFirstBean.firstProperty}" />
<h:intputText value="#{mySecondBean.secondProperty}" />
If I can, why should I not do it? (I assume I should not, b...
I have been programming in Python for a while now, and I'd like to learn a more "hireable" language like Java or the C/C++/C# family. I'm acquainted with (though not necessarily good at) all of them. I'm leaning towards Java because it runs just about everywhere, and I'd like to start developing for the Android.
Coming from a dynamic l...
I have a bunch of images on a server. When client requests url for image, the client can specify to either receive the full image or get a thumbnail of the image. So, I'm looking to implement a servlet type solution that processes request, and generates thumbnail on demand if needed. It needs to support jpg, gif, tif, png.
It looks like...
We have several JSF portlets running in a websphere portal environment. A developer wants to create a Utility jar which would live in the shared library, so all portlets could access it. In this jar he wants a faces utility class which would have a static method; this method would access the current FacesContext instance and return that ...
Each document in my Lucene index is kind of similar to a post in stackoverflow and I am trying to search through the index (which contains millions of documents). Each user should only be able to search through the user's company posts only. I have no control over how the data is indexed and I only need to implement a simple search (tha...
I have a web page with an applet that opens a popup window and also makes Javascript calls. When that Javascript call results in a focus() call on an HTML input, that causes the browser window to push itself in front of the applet window. But only on certain browsers, namely MSIE. On Firefox the applet window remains on top. How can I ke...
I have a Tomcat application that requires multiple passwords on startup.
My current configuration uses a Java Properties object to load in the passwords from a password.conf file.
There's now a requirement that no passwords are allowed in 'the clear' on the system. I had suggested encrypting the password file, but this isn't an option.
...
Hi,
I am working on a form with a bunch of selection criteria that will generate a report when the form is submitted. I also have a number of different reports that can be generated form this same criteria, and want the type of report to be selectable by using a tab system where each tab clicked on submits the form and generates the cor...
I'm trying to hook up my SOAP webservice to be used as a crystal reports data service and I'm running into some problems. I follow the wizard and after I enter my WSDL URL and my credentials, I go on to the final page. On this page, the drop down boxes are empty. I manually enter the service name, port and method, and then hit finish ...