java

JPA, How to use the same class (entity) to map different tables?

I have two tables: Ta and Tb. They have exactly the same table structure but different table names. I try to create one entity class to map the table structures. Some of my common application modules will use this entity class to dynamically query and update either Ta or Tb based on parameters. Can it be done in JPA? How can I write ...

CRC error-correction library?

Is there a CRC library that enables the user not only detect errors but also correct them? I'm looking for a C/C++ or Java library, ideally open-source. ...

non flash multi file upload for php

looking into multi file - drag and drop - upload scripts. we were using swfupload until flash 10 destroyed it. the other options we are investigating are java and google gears. what would you recommend and do you know of libraries/examples/frameworks that support these options like the swfupload. thanks, Josh ...

Java Project Configuration

I'm curious as to what other people use in the Java world for configuring their applications. I've previously used Spring's PropertyPlaceHolderConfigurer and PropertyOverrideConfigurer to load various properties files and bind them using the default Spring property editors. This is a perfectly acceptable solution for what I've done, ...

How to create a SSL connection in Websphere

Hi, I'm trying to figure to do a easy secure connection in rad 7.5 for my application. Don't want to install http server with openssl. Is it possible to doing it directly in WAS? ...

Does Java support default parameter values?

I came across some Java code that had the following structure: public MyParameterizedFunction(String param1, int param2) { this(param1, param2, false); } public MyParameterizedFunction(String param1, int param2, boolean param3) { //use all three parameters here } I know that in C++ I can assign a parameter a default value. F...

AOP, Spring and transaction scoping

Hi, imagine a transactional, multithreaded java application using spring, jdbc and aop with n classes in m packages all taking part in database transations. Now let's say there is the need to scope an arbitrary set of classes within one transaction. Furthermore there is always one class T within the scope that commits the transaction whe...

java: basic web service interface without a web server

hi everyone, how hard is adding a basic web services interface to an existing java server application without having to turn it into a .war, or embedding a small web server like jetty? say, xml-rpc instead of more modern approaches, if it helps. if not too hard, can you suggest a starting point? thank you in advance :) ...

Testing methods that make http requests

I have some methods in my app that make http requests. Is there a good way to simulate network failures and bad responses for the unit tests? ...

Using the Deployment Toolkit to detect openjdk under Ubuntu?

Hi, I'm using deployJava.js to detect and redirect for java compatibility. Now, however, I've noticed that deployJava.js does NOT detect openjdk. Is there a modified version of this file that does this? I'm digging through the script right now to attempt to hack in a fix, but it would be nice if this was an already solved problem. Linka...

c:foreach using List: Must evaluate to a Collection, Map, Array, or null

So I'm trying to loop over a List<MyClass> for display in the view of my spring webflow application. However I get the error Must evaluate to a Collection, Map, Array, or null. <c:forEach items="#{orderedStuff}" var="a"> #{a.PrettyName}test </c:forEach> I've also tried $ instead of #. Here is my xml flow definition. <view-state ...

Selecting text from a JLabel?

Is it possible to enable the selection of text from a JLabel? If not, what's the best alternative control to use, and how can it be configured to appear like a JLabel? ...

Alternative to servicewrapper for java?

I've used ServiceWrapper a few times in the past, however, the dual license is somewhat complex for commercial products (generally you have to pay them). Are there are fully FOSS alternatives with similar functionality? ...

How do you install JDK?

I have eclipse and I can test run java apps but I am not sure how to compile them. I read that I should type javac -version into my cmd.exe and see if it is recognized. It is not. So I went to sun's website and downloaded/installed JDK v6. Yet it still says 'javac' is an unrecognized command. What am I doing wrong? Thanks! UPDATE OK af...

DTD download error while parsing XHTML document in XOM

Hello, I am trying to parse an HTML document with the doctype declared to use the transitional dtd as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; When I do Builder.build on the document, I get the following exception: java.io.IOException: Serv...

clone utility for HashMap in java

Hello, Is there java utility that does "clone" method for Hashmap such that it does copy of the map elements not just the map object ( as the clone() in Hashmap class )?? thanx ...

Managing os-specific libraries with Ivy

Assuming there's a os-specific library ( .so/.dll ) attached to a Java project, what's the way of handling this using Ivy? ...

How to assert something at compile time in Java?

Sometimes data structures should have certain relationships that can't be directly described in Java, but that are good to check as early as possible when code is edited. Classic examples are that an array is big enough or that enums in different modules have corresponding members. BOOST provides a fine "static assert" facility in C++ t...

GWT Custom Event Handler

Can someone give me an example of creating a custom set of an Event and a Handler. Say you have a Person object that you want your widgets to know if it got updated. You create a HandlerManager and now you have to create an Event and a Handler. How would you define those classes so that you can subscribe and fire events? Most of the Ev...

What do you do when you start a new POJO class?

Let's say that you are setting up a POJO. What do you define when you setup the class? Here's my list Constructor to create an object with supplied fields (so that I can make fields final and hence immutable) toString equals hashcode implements comparable get methods (where applicable) [Optional] copy constructors for mutable fields...